google-analytics-mcp
MCP server by surendranb Community
Connects AI assistants to Google Analytics 4 for schema discovery, multi-dimensional reports and real-time queries. Includes guided analysis playbooks for traffic drops, channels and e-commerce. Built for analysts and marketers who use AI agents with GA4 data.
Install google-analytics-mcp
Built from the published package, never by AI.
claude mcp add google-analytics-mcp -e GOOGLE_APPLICATION_CREDENTIALS=YOUR_GOOGLE_APPLICATION_CREDENTIALS -e GA4_PROPERTY_ID=YOUR_GA4_PROPERTY_ID -- uvx google-analytics-mcpRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"google-analytics-mcp": {
"env": {
"GA4_PROPERTY_ID": "YOUR_GA4_PROPERTY_ID",
"GOOGLE_APPLICATION_CREDENTIALS": "YOUR_GOOGLE_APPLICATION_CREDENTIALS"
},
"args": [
"google-analytics-mcp"
],
"command": "uvx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
Step-by-step: install google-analytics-mcp in Claude Desktop
{
"mcpServers": {
"google-analytics-mcp": {
"env": {
"GA4_PROPERTY_ID": "YOUR_GA4_PROPERTY_ID",
"GOOGLE_APPLICATION_CREDENTIALS": "YOUR_GOOGLE_APPLICATION_CREDENTIALS"
},
"args": [
"google-analytics-mcp"
],
"command": "uvx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"google-analytics-mcp": {
"env": {
"GA4_PROPERTY_ID": "YOUR_GA4_PROPERTY_ID",
"GOOGLE_APPLICATION_CREDENTIALS": "YOUR_GOOGLE_APPLICATION_CREDENTIALS"
},
"args": [
"google-analytics-mcp"
],
"command": "uvx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add google-analytics-mcp --env GOOGLE_APPLICATION_CREDENTIALS=YOUR_GOOGLE_APPLICATION_CREDENTIALS --env GA4_PROPERTY_ID=YOUR_GA4_PROPERTY_ID -- uvx google-analytics-mcp{
"mcpServers": {
"google-analytics-mcp": {
"env": {
"GA4_PROPERTY_ID": "YOUR_GA4_PROPERTY_ID",
"GOOGLE_APPLICATION_CREDENTIALS": "YOUR_GOOGLE_APPLICATION_CREDENTIALS"
},
"args": [
"google-analytics-mcp"
],
"command": "uvx"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
Step-by-step: install google-analytics-mcp in Antigravity CLI
gemini mcp add google-analytics-mcp uvx google-analytics-mcpGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the google-analytics-mcp block.
About
google-analytics-mcp is a Model Context Protocol server for Google Analytics 4. It gives AI assistants tools to list accounts and properties, fetch property metadata including dimension and metric schemas, and run multi-dimensional GA4 reports with metric totals and server-side aggregation. It also includes a real-time report that covers the last 30 minutes.
The server ships with guided analytical skills that load dynamically from GitHub. These cover traffic diagnosis, channel acquisition, e-commerce analysis and AI referral analysis, which tracks referral traffic from ChatGPT, Claude, Perplexity and Gemini. It is aimed at analysts and marketers who want an AI agent to query GA4 data. It can be run with uvx or npx and is released under the MIT License.
Written from the project's README and checked against it.
Tools it gives your assistant
get_ga4_dataRuns multi-dimensional GA4 reports with automated metric totals and server-side aggregation.list_accountsLists all accessible Google Analytics accounts and permission levels.list_propertiesLists all GA4 properties associated with an account.get_property_metadataFetches dimension and metric schemas, custom definitions and compatibility rules.run_realtime_reportQueries real-time active users and event counts from the last 30 minutes.search_skillsSearches built-in GA4 analytical playbooks such as e-commerce and channel attribution.skill_readLoads procedural skills and analytical guides from GitHub.skills_listLists all available live GA4 analytical skills.
What you need
- A Google Analytics 4 property
- Google service account credentials file
- GA4 property ID
- Python with uvx, or Node.js with npx
| Setting | Needed | What it is |
|---|---|---|
GOOGLE_Environment variable, secret | Required | Absolute path to your Google Cloud service account JSON key with GA4 property access. |
GA4_Environment variable | Required | Numeric GA4 Property ID to query, for example 123456789. |
From the publisher's entry in the official MCP Registry. Required settings are already in the install config below as placeholders.
Try asking
- Run a GA4 report of sessions by channel group for the last 30 days.
- Show me the real-time active users and event counts for my property.
- Find referral traffic from ChatGPT and Perplexity in my GA4 data.
Good to know
- Real-time reports only cover the last 30 minutes.
- Collects anonymous diagnostic telemetry unless opted out.
- Analytical skills are loaded from GitHub at runtime.
Security check
C- Downloads a script from the internet and runs itIn
README.md:curl -fsSL "https://ga4.builditwithai.xyz/install" | bash
Checked automatically: README.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to google-analytics-mcp
All alternatives →World Monitor is a real-time global intelligence dashboard covering conflict, markets, energy, trade, shipping and cyber. Its MCP server gives AI assistants access to that data, and it is aimed at analysts, agents and scripts.
Lets AI agents create and change Power BI semantic models through a local MCP server. Built for developers who want natural language modeling in Power BI Desktop, Fabric workspaces and PBIP files.
Seal Open Data serves French public datasets from data.gouv.fr to AI assistants. It covers topics such as territories, companies, housing and population. It is aimed at users who want to query French open data from clients like Claude.
OpenMetadata MCP server lets MCP-compatible assistants search metadata, inspect lineage, and manage data quality tests. It is for data teams and AI agents that need governed context about enterprise data.
Compiles, validates and renders semantic chart specs for AI assistants through the Model Context Protocol. It is for agents that need reliable, good-looking and interactive charts across several chart libraries.
Query PostHog analytics, manage feature flags and experiments, and investigate errors from your AI assistant. It suits product teams and developers who already use PostHog for analytics, replays, and error tracking.
Compare with World Monitor, Power BI Authoring MCP Server (Local) or Seal Open Data
google-analytics-mcp: common questions
Does google-analytics-mcp collect my data?
The source says it collects anonymous, non-PII diagnostic telemetry such as command executions, latency and error codes. It states that no queries, user credentials, personal data or environment variables are collected.
How do I turn off telemetry in google-analytics-mcp?
Set either DO_NOT_TRACK=1 or MCP_TELEMETRY_OPT_OUT=1 as an environment variable. The source says you can opt out at any time this way.
Which analytical skills does the GA4 MCP server include?
The source lists traffic-diagnosis, channel-acquisition, ecommerce-analysis and ai-referral-analysis. These load dynamically from GitHub.
How do I install google-analytics-mcp?
In Claude Code run claude mcp add google-analytics-mcp -e GOOGLE_APPLICATION_CREDENTIALS=YOUR_GOOGLE_APPLICATION_CREDENTIALS -e GA4_PROPERTY_ID=YOUR_GA4_PROPERTY_ID -- uvx google-analytics-mcp. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.
Is google-analytics-mcp the official server?
google-analytics-mcp is a community project by surendranb, not verified by a company domain.
Is google-analytics-mcp free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is google-analytics-mcp safe to use?
It scores 82 of 100. Grades: maintenance A, licence A, quality B. Security check: grade C (downloads a script from the internet and runs it). Review the code before you install. How grades work.
What are alternatives to google-analytics-mcp?
Similar MCP servers: World Monitor, Power BI Authoring MCP Server (Local), Seal Open Data, OpenMetadata.
Does google-analytics-mcp work with ChatGPT?
Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.
