Set up Google Analytics MCP in Claude Desktop
Access GA4 data, run custom reports, and get real-time analytics from your AI editor. Official Google implementation.
1
Locate the config file
Claude Desktop reads MCP server configuration from the following file:
~/Library/Application Support/Claude/claude_desktop_config.jsonCreate this file if it does not already exist.
2
Add the configuration
Add the following to your Claude Desktop config file:
json
{
"mcpServers": {
"google-analytics-mcp": {
"command": "npx",
"args": [
"-y",
"@google-analytics/mcp"
],
"env": {
"GA_PROPERTY_ID": "YOUR_GA_PROPERTY_ID",
"GOOGLE_APPLICATION_CREDENTIALS": "YOUR_GOOGLE_APPLICATION_CREDENTIALS"
}
}
}
}3
Set up environment variables
Google Analytics MCP requires the following environment variables:
GA_PROPERTY_IDRequiredGoogle Analytics 4 property ID
GOOGLE_APPLICATION_CREDENTIALSRequiredPath to Google service account JSON key file
4
Verify it works
Restart Claude Desktop. Google Analytics MCP should appear in your MCP server list with 4 tools available.
This server adds approximately 2,060 tokens to your context window for tool definitions.