Model Context Protocol server for Google Analytics, enabling LLMs to fetch and analyze web analytics data
An MCP server implementation for accessing Google Analytics 4 (GA4) data, built using the Model Context Protocol TypeScript SDK.
export GOOGLE_CLIENT_EMAIL="[email protected]"
export GOOGLE_PRIVATE_KEY="your-private-key"
export GA_PROPERTY_ID="your-ga4-property-id"
To install Google Analytics Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install mcp-server-google-analytics --client claude
pnpm install mcp-server-google-analytics
pnpm start
Add this to your Claude Desktop configuration:
{
"mcpServers": {
"google-analytics": {
"command": "npx",
"args": ["-y", "mcp-server-google-analytics"],
"env": {
"GOOGLE_CLIENT_EMAIL": "[email protected]",
"GOOGLE_PRIVATE_KEY": "your-private-key",
"GA_PROPERTY_ID": "your-ga4-property-id"
}
}
}
}
Get page view metrics for a specific date range:
{
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"dimensions": ["page", "country"] // Optional
}
Get active users metrics:
{
"startDate": "2024-01-01",
"endDate": "2024-01-31"
}
Get event metrics:
{
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"eventName": "purchase" // Optional
}
Get user behavior metrics:
{
"startDate": "2024-01-01",
"endDate": "2024-01-31"
}
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
{
"mcpServers": {
"mcp-server-google-analytics": {
"command": "npx",
"args": [
"-y",
"mcp-server-google-analytics"
]
}
}
}Related projects feature coming soon
Will recommend related projects based on sub-categories