Google Analytics
About
Access Google Analytics 4 (GA4) data using the Model Context Protocol.
Details
- Author
- ruchernchong
- Categories
- Cloud Service, Other
Jump to
Setup
Install Google Analytics in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/ruchernchong/mcp-server-google-analytics
Follow the installation instructions in the repository README, then restart your MCP client.
3. Grant Service Account Access to Google Analytics
- Open](https://console.cloud.google.com/)Google Analytics. - Navigate to theAdminsection of your GA4 property. - Under thePropertycolumn, click onProperty Access Management. - Click the"+"button to add a new user. - In the"Email address"field, paste theclient_emailfrom the JSON credentials file you downloaded.
- Assign the"Viewer"role. You do not need to notify the user.
- Click"Add".
The server requires the following environment variables:
- GOOGLE_CLIENT_EMAIL: Theclient_emailfrom your service account JSON file.
- GOOGLE_PRIVATE_KEY: Theprivate_keyfrom your service account JSON file.
- GA_PROPERTY_ID: Your Google Analytics 4 property ID.
You can set them in your environment or use a.envfile.
export GOOGLE_CLIENT_EMAIL="your-service-account@your-project.iam.gserviceaccount.com" export GOOGLE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_PRIVATE_KEY\n-----END PRIVATE KEY-----\n" export GA_PROPERTY_ID="your_property_id"
To install Google Analytics Server for Claude Desktop automatically via
Smithery:npx -y @smithery/cli install mcp-server-google-analytics --client claude
npm install -g mcp-server-google-analytics
Add this to your Claude Desktop configuration:
{ "mcpServers": { "google-analytics": { "command": "npx", "args": ["-y", "mcp-server-google-analytics"], "env": { "GOOGLE_CLIENT_EMAIL": "your-service-account@project.iam.gserviceaccount.com", "GOOGLE_PRIVATE_KEY": "your-private-key", "GA_PROPERTY_ID": "your-ga4-property-id" } } } }
Run a flexible report to get analytics data.
{ "startDate": "2024-01-01", "endDate": "2024-01-31", "dimensions": [{ "name": "country" }, { "name": "city" }], "metrics": [{ "name": "activeUsers" }, { "name": "newUsers" }], "dimensionFilter": { "filter": { "fieldName": "country", "stringFilter": { "value": "United States" } } } }
Get page view metrics for a specific date range:
{ "startDate": "2024-01-01", "endDate": "2024-01-31", "dimensions": ["page", "country"] // Optional }
{ "startDate": "2024-01-01", "endDate": "2024-01-31" }
{ "startDate": "2024-01-01", "endDate": "2024-01-31", "eventName": "purchase" // Optional }
{ "startDate": "2024-01-01", "endDate": "2024-01-31" }
- Least Privilege: Only grant the service account the "Viewer" role in Google Analytics.
- Key Management: Keep your service account key file secure and do not expose it in client-side code.
- Environment Variables: Use environment variables to store sensitive information like the client email, private key, and property ID.
Contributions are welcome! Please read ourContributing Guidefor details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see theLICENSEfile for details.
Access the Google Analytics Data API to retrieve and analyze website traffic data.
Connect AI assistants to live Meta Ads, GA4, and Search Console data. 100% local, machine-locked encryption, no cloud relay.
A read-only MCP server for querying live Google Analytics data using LLMs. Powered by CData.
Expose data observability, lineage, test results & incidents to AI agents via MCP
Connect your business data to any MCP client. AgenticBI agents find the right data, join across systems, run queries, build dashboards, generate reports, and automate analytics workflows. No SQL required.
Access eBay Analytics data via the CData JDBC Driver.
An MCP server for accessing YouTube Analytics data, powered by the CData JDBC Driver.
Access and manage ChartMogul data, including customers, plans, and analytics.
Real User Monitoring for Core Web Vitals. Query LCP, INP, CLS field data from real visitors at the p75 percentile.
Tracks DEX trading volume metrics from Dune Analytics, segmented by blockchain, aggregator, and more.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




