io.github.surendranb/google-analytics-mcp MCP Server
io.github.surendranb/google-analytics-mcp
GA4 MCP server for AI agents: real-time query exploration, schema discovery, and metric aggregation.
What is the io.github.surendranb/google-analytics-mcp MCP server?
The Google Analytics 4 (GA4) MCP Server is a Model Context Protocol server that enables AI agents to query Google Analytics 4 data, discover schemas, and run aggregated reports. It provides real-time insights, audience analysis, and guided analytical playbooks for GA4 properties.
This server connects AI agents like Claude and Cursor directly to Google Analytics 4, enabling data exploration, metric aggregation, and real-time reporting. Use it to automate GA4 analysis, diagnose traffic issues, analyze channel attribution, and build data-driven insights without manual dashboard navigation.
How to install io.github.surendranb/google-analytics-mcp
Copy-paste configuration for popular MCP clients.
GOOGLE_APPLICATION_CREDENTIALSrequiredsecretAbsolute path to your Google Cloud service account JSON key with GA4 property access.
GA4_PROPERTY_IDrequiredNumeric GA4 Property ID to query, for example 123456789.
Tools & capabilities
Tools this server exposes to the agent.
get_ga4_data— Runs multi-dimensional GA4 reports with automated metric totals and server-side aggregation. Parameters: dimensions, metrics, date_ranges, limit.list_accounts— Lists all accessible Google Analytics accounts and permission levels.list_properties— Lists all GA4 properties associated with an account. Parameters: account_id (optional).get_property_metadata— Fetches complete dimension and metric schemas, custom definitions, and compatibility rules. Parameters: property_id (optional).run_realtime_report— Queries real-time active users and event counts from the last 30 minutes. Parameters: metrics, dimensions.search_skills— Searches built-in GA4 analytical playbooks (e-commerce, channel attribution, bot filtering). Parameters: query.skill_read— Dynamically loads procedural skills and analytical guides from GitHub. Parameters: skill_name.skills_list— Lists all available live GA4 analytical skills.
Use cases
- Diagnose sudden traffic drops with step-by-step root cause analysis
- Analyze channel acquisition and attribution modeling across marketing channels
- Explore e-commerce revenue, conversion funnels, and item purchase rates
- Track and isolate referral traffic from AI sources like ChatGPT, Claude, and Perplexity
- Query real-time active users and event metrics for immediate performance monitoring
io.github.surendranb/google-analytics-mcp MCP server FAQ
It's an MCP server that gives AI agents direct access to GA4 data, enabling queries, schema discovery, real-time reporting, and guided analytical playbooks without manual dashboard work.
Yes, it's open-source under the MIT License. You only need a Google Analytics 4 property and a service account with GA4 read permissions.
Add it to your claude_desktop_config.json with the command 'uvx google-analytics-mcp' and set GA4_PROPERTY_ID and GOOGLE_APPLICATION_CREDENTIALS environment variables.
Add it to your mcp.json configuration file with the command 'uvx google-analytics-mcp' under mcpServers.
You need a Google service account with access to your GA4 property. Set GOOGLE_APPLICATION_CREDENTIALS to point to your service account JSON file and GA4_PROPERTY_ID to your property ID.
Yes, set either DO_NOT_TRACK=1 or MCP_TELEMETRY_OPT_OUT=1 as environment variables. The server collects only anonymous diagnostic data, never queries or credentials.
README (reference)
Source of truth, from the repository.
Google Analytics 4 (GA4) MCP Server 📊
Model Context Protocol (MCP) server for Google Analytics 4: real-time query exploration, schema discovery, metric aggregation, and audience insights for AI agents.
🌐 Live Documentation & Web Portal: https://ga4.builditwithai.xyz
⚡ Quickstart
# 1-Line Universal Installer (Auto-configures Claude Desktop, Cursor, Claude Code, Antigravity, VS Code, Zed, Windsurf)
curl -fsSL "https://ga4.builditwithai.xyz/install" | bash
# Or run directly via your preferred runtime:
uvx google-analytics-mcp
uvx --from google-analytics-mcp ga4-mcp-server
python -m ga4_mcp
npx -y @surendranb/google-analytics-mcp
🤖 Client Setup
A. Claude Code (CLI)
claude mcp add google-analytics -- uvx google-analytics-mcp
B. Cursor & Google Antigravity (mcp.json)
{
"mcpServers": {
"google-analytics": {
"command": "uvx",
"args": ["google-analytics-mcp"]
}
}
}
C. Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"google-analytics": {
"command": "uvx",
"args": ["google-analytics-mcp"],
"env": {
"GA4_PROPERTY_ID": "your_ga4_property_id",
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service_account.json"
}
}
}
}
D. VS Code (Cline / Roo Code / Continue)
{
"mcpServers": {
"google-analytics": {
"command": "npx",
"args": ["-y", "@surendranb/google-analytics-mcp"]
}
}
}
🛠️ Tools & Capabilities
| Tool Name | Parameters | Description | Return Type |
|---|---|---|---|
get_ga4_data | dimensions (list), metrics (list), date_ranges (list), limit (int) | Runs multi-dimensional GA4 reports with automated metric totals and server-side aggregation. | JSON / Markdown |
list_accounts | (none) | Lists all accessible Google Analytics accounts and permission levels. | JSON |
list_properties | account_id (optional) | Lists all GA4 properties associated with an account. | JSON |
get_property_metadata | property_id (optional) | Fetches complete dimension and metric schemas, custom definitions, and compatibility rules. | JSON |
run_realtime_report | metrics (list), dimensions (list) | Queries real-time active users and event counts from the last 30 minutes. | JSON |
search_skills | query (string) | Searches built-in GA4 analytical playbooks (e-commerce, channel attribution, bot filtering). | Markdown |
skill_read | skill_name (string) | Dynamically loads procedural skills and analytical guides from GitHub. | Markdown |
skills_list | (none) | Lists all available live GA4 analytical skills. | JSON |
🧠 Dynamic Skills & Guided Playbooks
This server ships with built-in analytical recipes that load dynamically from GitHub:
traffic-diagnosis: Step-by-step root cause analysis for sudden traffic drops.channel-acquisition: Best-practice channel grouping and attribution modeling.ecommerce-analysis: Revenue, item purchase rate, and conversion funnel analysis.ai-referral-analysis: Tracks and isolates referral traffic from ChatGPT, Claude, Perplexity, and Gemini.
🔒 Telemetry & Privacy
This package collects anonymous, non-PII diagnostic telemetry (command executions, latency, error codes) to improve tool reliability. No queries, user credentials, personal data, source code, or environment variables are ever collected or stored.
You can opt out anytime by setting either of the following environment variables:
export DO_NOT_TRACK=1
# or
export MCP_TELEMETRY_OPT_OUT=1
📄 License
MIT License. See LICENSE for details.
Related MCP servers

Find Research Papers
Search open-source research papers across arXiv, OpenAlex, Crossref, PubMed, Semantic Scholar.

Solar quotes for Brazilian installers: kWp sizing, own pricing, payback under Law 14.300, PDF.

CAPI Gateway
Lightweight API Gateway with REST-to-MCP bridging for LLM agents via Apache Camel and Consul service discovery.
Knowledge accumulation for AI coding agents. Records decisions, problems, and insights as context.
View repository →
Agent Almanac MCP
Search the Agent Almanac catalog of 9,000+ MCP servers from inside any MCP-aware agent.
40 MCP tools for 11 Indonesian government portals — BPOM, BPJPH, AHU, OJK, BMKG+

