env.example•3.92 kB
# =============================================================================
# Google Analytics MCP Server Environment Configuration
# =============================================================================
#
# This file contains the environment variables needed to run the Google Analytics MCP Server.
# Copy this file to '.env' and fill in your actual values.
#
# IMPORTANT SECURITY NOTES:
# 1. Never commit your actual .env file to version control
# 2. Keep your OAuth credentials file secure and never share it
# 3. The .env file and OAuth credentials are automatically excluded via .gitignore
#
# =============================================================================
# -----------------------------------------------------------------------------
# Google Analytics API Configuration
# -----------------------------------------------------------------------------
# REQUIRED: Path to your Google Analytics OAuth 2.0 credentials JSON file
# This file is downloaded from Google Cloud Console when you create OAuth credentials
# Use ABSOLUTE path for best results
#
# Example (macOS/Linux):
# GOOGLE_ANALYTICS_OAUTH_CONFIG_PATH=/Users/yourname/path/to/client_secret_123456789.apps.googleusercontent.com.json
#
# Example (Windows - use forward slashes):
# GOOGLE_ANALYTICS_OAUTH_CONFIG_PATH=C:/Users/yourname/path/to/client_secret_123456789.apps.googleusercontent.com.json
#
GOOGLE_ANALYTICS_OAUTH_CONFIG_PATH=
# -----------------------------------------------------------------------------
# Optional Configuration
# -----------------------------------------------------------------------------
# Logging level (DEBUG, INFO, WARNING, ERROR)
# Default: INFO
LOG_LEVEL=INFO
# Token refresh buffer time in seconds
# How early to refresh tokens before they expire
# Default: 300 (5 minutes)
TOKEN_REFRESH_BUFFER=300
# =============================================================================
# Setup Instructions
# =============================================================================
#
# 1. Google Cloud Platform Setup:
# - Create a new project at https://console.cloud.google.com/
# - Enable the Google Analytics Reporting API and Google Analytics Admin API
# - Create OAuth 2.0 credentials (Desktop Application)
# - Download the credentials JSON file
#
# 2. Environment Setup:
# - Copy this file to '.env'
# - Set GOOGLE_ANALYTICS_OAUTH_CONFIG_PATH to your credentials file path
# - Use absolute paths to avoid issues
#
# 3. Google Analytics Access:
# - Ensure your Google account has access to the Analytics properties
# - The OAuth flow will request necessary permissions automatically
#
# 4. First Run:
# - The first time you run a command, it will open your browser for OAuth
# - Complete the authentication and return to Claude Desktop
# - Subsequent runs will use the stored token automatically
#
# =============================================================================
# Troubleshooting
# =============================================================================
#
# Token Issues:
# - If you get authentication errors, delete 'google_analytics_token.json'
# - This will force a new OAuth flow on the next run
#
# File Path Issues:
# - Always use absolute paths for GOOGLE_ANALYTICS_OAUTH_CONFIG_PATH
# - On Windows, use forward slashes (/) instead of backslashes (\)
# - Ensure the file exists and is readable
#
# Permission Issues:
# - Make sure your Google account has Analytics access
# - Check that the OAuth credentials are for the correct Google Cloud project
# - Verify the project has Analytics API enabled
#
# =============================================================================
# Optional: Custom port for OAuth redirect (if needed)
# OAUTH_REDIRECT_PORT=8080
# Optional: Custom timeout for API requests (seconds)
# API_REQUEST_TIMEOUT=30
# Optional: Enable debug logging for OAuth flow
# OAUTH_DEBUG=false