home / mcp / mcp search analytics server
MCP server for GA and GSC data analysis
Configuration
View docs{
"mcpServers": {
"vesivanov-mcp-search-analytics": {
"command": "python",
"args": [
"unified_analytics_server.py"
],
"env": {
"GSC_SITE_URL": "https://your-website.com",
"GA4_PROPERTY_ID": "your-property-id",
"ANALYTICS_CREDENTIALS_PATH": "YOUR_PATH_TO_CREDENTIALS.json"
}
}
}
}You run a dedicated MCP server that provides unified access to Google Analytics 4 and Google Search Console data, enabling real-time analytics queries via the MCP interface while keeping credentials securely managed through environment variables.
To use this MCP server, first ensure your MCP client is configured to connect to the local stdio server you start below. You will run the server locally and issue real-time analytics queries against the unified data sources (Analytics 4 and Search Console). Prepare any credentials using the environment variables described in the configuration steps, and test your credentials before starting the server to confirm access rights.
Prerequisites include Python 3.8 or newer, a Google Cloud Project with Analytics and Search Console APIs enabled, and a Google Service Account with suitable permissions.
Step 1: Set up your environment and dependencies
# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtStep 2: Prepare configuration
# Copy example environment file to actual env file
cp environment.example .env
# Populate environment variables in .env
# ANALYTICS_CREDENTIALS_PATH=/path/to/credentials.json
# GSC_SITE_URL=https://your-website.com
# GA4_PROPERTY_ID=your-property-idStep 3: Test credentials and run the server
# Test credentials
python test_credentials.py
# Start the MCP server
python unified_analytics_server.pySecurity best practices include never committing credential files or environment files to version control, storing credentials securely, rotating service account keys regularly, and following the principle of least privilege for API access.
Required environment variables you will set in your .env file include the credentials path, the site URL for Google Search Console, and the GA4 property ID.
- Never commit credential files (.json, .env) to version control
- Store credentials securely and use environment variables
- Regularly rotate service account keys
- Follow principle of least privilege for API access
See requirements.txt for Python dependencies.
1. Fork the project 2. Create a feature branch 3. Make your changes 4. Test thoroughly 5. Submit a pull request
Test provided Google API credentials against the configured Analytics and Search Console APIs.
Launch the MCP server to serve real-time queries against Analytics 4 and Search Console data.