Google Analytics 4 MCP
Google Analytics 4 MCP
Read-only MCP server for Google Analytics 4. Seventeen tools cover the read surface of both the Data API and the Admin API: standard, batch, pivot, realtime and funnel reports; the metadata catalog and compatibility check; and admin lists for properties, streams, custom dimensions and metrics, key events, audiences, Google Ads links, annotations and access reports. We run this server in production for every analytics client.
Install
Claude Code:
claude mcp add ga4 -e GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json -- uvx scalably-ga4-mcpCodex:
codex mcp add ga4 --env GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json -- uvx scalably-ga4-mcpClaude Desktop: download ga4-mcp.mcpb from the latest GitHub release and open it.
Setup
In Google Cloud, create or pick a project and enable the Google Analytics Data API and the Google Analytics Admin API on it (APIs and Services, Library).
Create a service account in that project and download its JSON key.
Add the service account's email as a Viewer on each GA4 property you want to query (Admin, Property access management).
No OAuth consent screen is needed; the server authenticates as the service account with the analytics.readonly scope. One service account can read any property that grants it access, so there is no per-client configuration beyond step 3 above.
Call ga4_list_account_summaries first to discover which property_id values the service account can see, then pass one into the reporting or admin tools.
Tools (17)
Tool | What it does |
| List every GA4 account and its child properties accessible to this service account |
| Full metadata for a single GA4 property |
| List all data streams (web, iOS, Android) on a GA4 property |
| List custom dimensions configured on a GA4 property |
| List custom metrics configured on a GA4 property |
| List key events (formerly conversions) on a GA4 property |
| List audiences defined on a GA4 property |
| List Google Ads links attached to a GA4 property |
| List reporting annotations on a GA4 property |
| Audit log of who read what on a GA4 property, last 12 months |
| Fetch the full GA4 dimension and metric catalog for a property |
| Run a GA4 standard report, the workhorse tool |
| Run up to 5 GA4 reports in a single round trip |
| Run a GA4 pivot report |
| Run a GA4 real-time report covering the last 30 minutes |
| Validate whether a dimension and metric combo can be queried together |
| Run a GA4 funnel report (v1alpha, drop-off analysis) |
Configuration
Variable | Required | Purpose |
| yes | Path to a Google service-account JSON file with the |
| no | INFO (default) or DEBUG |
Filter expression shape
Every tool accepting dimension_filter / metric_filter takes a dict:
{"filter": {"field_name": "country", "string_filter": {"value": "US"}}}Compose with boolean groups:
{"and_group": {"expressions": [
{"filter": {"field_name": "country", "string_filter": {"value": "US"}}},
{"filter": {"field_name": "deviceCategory", "string_filter": {"value": "mobile"}}}
]}}A raw {"field_name": ..., "string_filter": ...} is auto-wrapped into {"filter": {...}}.
Reply shape
Every tool returns JSON with status (succeeded, partial, no_op), summary, result, proof, warnings, recovery. proof.nextOffset on a partial status means: continue from that offset. proof.propertyQuota carries the property's remaining Data API quota so the caller can self-throttle. proof.dataQualityLimited is true when the response was sampled, thresholded, or collapsed high-cardinality rows into (other); treat such a result as directionally useful, not exact.
Limits
250,000 rows per Data API response (the server caps any higher client-supplied limit). Batch reports: up to 5 per call. Funnel reports: up to 10 steps. Realtime reports use a separate, smaller dimension and metric catalog covering only the last 30 minutes; non-realtime data typically lags 24 to 48 hours. Funnel reporting is v1alpha and its shape can change upstream. Every quota bucket (core reports, realtime, funnel) allows roughly 14,000 quota tokens per project per property per hour (a complex query can cost more than one token); 360 properties get a 10x multiplier. Re-check Google's current quota page before relying on an exact number.
Verify
Each release lists the package version, the .mcpb sha256 and the production commit it was derived from in CHANGELOG.md. CI runs the tests and a clean install of the built wheel on every push.
Privacy Policy
This server runs locally, on your machine, under your own credentials. It collects no personal data, contains no telemetry, stores nothing persistently, and talks only to the vendor API it wraps. No third party, including Scalably, receives your data. Contact: hello@scalably.io. Canonical copy: https://scalably.io/connector-privacy.html
License
MIT. Copyright Scalably.
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/scalably-io/ga4-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server