Google Analytics MCP Server
The Google Analytics MCP Server connects AI agents and copilots to Google Analytics 4 for live data queries, schema discovery, and troubleshooting.
Query GA4 Data (get_ga4_data): Retrieve analytics data by specifying dimensions (e.g., date, city), metrics (e.g., totalUsers, sessions), date ranges, and filters — with built-in data volume protection, automatic server-side aggregation, and intelligent sorting.
Discover Schema:
search_schema: Keyword-search across 200+ GA4 dimension and metric API names.get_property_schema: Retrieve the complete list of dimensions and metrics — including custom ones — for your GA4 property.list_dimension_categories/get_dimensions_by_category: Browse dimension categories (e.g., Geography, Traffic Source, Device).list_metric_categories/get_metrics_by_category: Browse metric categories (e.g., User, Session, Revenue, Event).
Self-Healing Troubleshooting (get_troubleshooting_guide): Fetch live troubleshooting guides for setup issues, IAM/403 errors, or schema/filter errors — enabling AI agents to autonomously self-correct.
Smart Features:
Metric Auto-Aliasing: Maps legacy or common metric names (e.g.,
conversions→keyEvents) to prevent query failures.Data Volume Protection: Estimates row counts before executing large queries (>2,500 rows) to avoid overloading model context windows.
Server-Side Aggregation: Automatically computes property-level totals for non-time-series queries.
Multi-Platform Support: Works with Claude, ChatGPT, Gemini, Cursor, VS Code, and OpenClaw, installable via npm, PyPI, Homebrew, or a one-line script. Connects securely using Google Cloud Service Account credentials.
Provides access to Google Ads data within Google Analytics 4, allowing queries about campaign, ad group, and keyword performance.
Connects to Google Analytics 4 data, enabling natural language queries about website traffic, user behavior, and analytics with access to 200+ GA4 dimensions and metrics.
Uses Google Cloud for service account creation and API access to connect with Google Analytics data.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Google Analytics MCP Servershow me last week's top 5 pages by pageviews"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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-mcpRelated MCP server: GA4 MCP Server
🤖 Client Setup
A. Claude Code (CLI)
claude mcp add google-analytics -- uvx google-analytics-mcpB. 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 |
|
| Runs multi-dimensional GA4 reports with automated metric totals and server-side aggregation. |
|
| (none) | Lists all accessible Google Analytics accounts and permission levels. |
|
|
| Lists all GA4 properties associated with an account. |
|
|
| Fetches complete dimension and metric schemas, custom definitions, and compatibility rules. |
|
|
| Queries real-time active users and event counts from the last 30 minutes. |
|
|
| Searches built-in GA4 analytical playbooks (e-commerce, channel attribution, bot filtering). |
|
|
| Dynamically loads procedural skills and analytical guides from GitHub. |
|
| (none) | Lists all available live GA4 analytical skills. |
|
🧠 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.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables LLM applications to query Google Analytics 4 data through standard MCP interfaces, supporting real-time data, custom reports, and metadata discovery.51851MIT
- AlicenseAqualityBmaintenanceConnects MCP clients like Claude Desktop to Google Analytics 4 Data API, enabling natural language queries for reports, top pages, traffic sources, conversions, realtime users, and period comparisons.7MIT
- AlicenseNot gradedqualityDmaintenanceEnables querying Google Analytics 4 data using natural language through MCP clients like Claude and Cursor, supporting 200+ dimensions and metrics for traffic, user behavior, and e-commerce analysis.MIT
- FlicenseNot gradedqualityDmaintenanceEnables interactive Google Analytics 4 visualizations inside Claude conversations, supporting ad-hoc queries with line, bar, pie charts and data tables.
Related MCP Connectors
GA4 conversion analyst inside Claude — funnel drops, traffic anomalies, device gaps, with numbers.
Connect your team's living knowledge base — docs, data, issues, CRM — to Claude and ChatGPT.
Connect e-commerce and marketing data to AI assistants via MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/surendranb/google-analytics-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server