Google Analytics MCP Server
@surendranb
Google Analytics 4 data to AI agents, agentic workflows, and MCP clients. Give agents analysis-ready access to website traffic, user behavior, and performance data with schema discovery, server-side aggregation, and safe defaults that reduce data wrangling.
概要
What is Google Analytics 4 MCP Server?
Google Analytics 4 MCP Server connects GA4 data directly to AI agents and MCP runtimes across Claude, ChatGPT, Gemini, Cursor, VS Code, and OpenClaw. It provides analysis-ready access with live schema discovery, metric auto-aliasing, server-side aggregation, and autonomous self-healing defenses.
How to use Google Analytics 4 MCP Server?
Install the server using the universal one‑line installer, Homebrew, npx, uvx, or pip. Configure it by setting GOOGLE_APPLICATION_CREDENTIALS (path to a service account JSON key) and GA4_PROPERTY_ID (numeric GA4 property ID) in your MCP client’s environment variables. Then invoke the server via your MCP runtime to access GA4 tools.
Key features of Google Analytics 4 MCP Server
- Autonomous self-healing that intercepts schema hallucinations
- Metric auto‑aliasing maps legacy names to GA4 terms
- Server‑side aggregation computes property totals dynamically
- Data volume protection limits queries over 2,500 rows
- Multi‑platform support (npm, PyPI, Homebrew, Gemini CLI, OpenAPI)
- Six ready‑to‑use tools for querying and exploring GA4 schemas
Use cases of Google Analytics 4 MCP Server
- Let an AI analyst answer natural‑language questions about GA4 data
- Enable a coding assistant to query GA4 metrics during development
- Automate GA4 report generation for recurring business reviews
- Let marketers explore GA4 schemas without leaving their chat interface
FAQ from Google Analytics 4 MCP Server
What prerequisites are needed to run the server?
You need a Google Cloud service account with a JSON key, the GA4 Data API enabled, and a GA4 property with the service account added as a Viewer.
How do I install the server?
Use the universal installer (curl -fsSL https://ga4.builditwithai.xyz | bash), Homebrew, npx, or uvx --from google-analytics-mcp ga4-mcp-server.
What tools does the server provide?
The server includes get_ga4_data, search_schema, get_property_schema, list_metric_categories, list_dimension_categories, and get_troubleshooting_guide.
Does the server collect telemetry?
Yes, anonymous usage telemetry (install, start, tool calls) is collected by default but can be opted out using DISABLE_TELEMETRY=1, GA_MCP_TELEMETRY=false, DO_NOT_TRACK=1, or NO_TELEMETRY=1. No credentials, PII, or report data are ever collected.
What clients or platforms are supported?
The server works with Claude Desktop, ChatGPT, Gemini CLI, Cursor, VS Code, OpenClaw, and any MCP‑compatible runtime.