GA4 MCP server: connect Google Analytics 4 to Claude or Codex
Google's official Google Analytics MCP server reaches GA4 through the Admin API and Data API — account structure, core reports, realtime. It is the right free answer for asking questions. This guide covers the setup, what changes when the MCP server can also configure GA4, and the one GA4 modelling detail that makes an agent's answer wrong in a way that looks right.
What the official server gives you
Google's own Google Analytics MCP server connects an MCP client to GA4 via the Admin API (accounts, properties, data streams) and the Data API (core reports and realtime). For "what happened on the site last week, broken down by channel", that is the whole job and it costs nothing.
What a full MCP server adds
The GA4 write half is smaller than the Google Ads one and it matters for a different reason: most GA4 pain is configuration, not reporting. Creating a conversion event, adding a custom dimension, or linking a Google Ads account are the changes people actually need, and they are exactly the ones a read-only server leaves you to do by hand.
| Official GA4 MCP | Agent Planners MCP | |
|---|---|---|
| GA4 tools | Reporting + admin reads | 24 reads, 15 writes |
| Writes | None | Custom dimensions, conversion events, audiences, data streams, Ads links |
| Approval before a write | n/a | Every write, with an audit row |
| Joined to ad spend in one session | No | Google Ads, Meta, TikTok, DV360 on the same key |
| Joined to your warehouse | No | BigQuery on the same key |
How to configure it
- 1Create a key in API & MCP. `tools:read` for questions; add `tools:write` if the agent should be able to change GA4 configuration.
- 2Connect GA4 under Integrations. One authorization now grants both read and write scopes — before this, an ordinary re-authorize silently downgraded write access back to read-only.
- 3Add the server to your client with the snippet below.
- 4Start with `describe_permissions`, then `list_accounts` for the property ids.
claude mcp add --transport http agentplanners https://www.agentplanners.com/api/mcp \
--header "Authorization: Bearer ap_live_…"The GA4 trap that makes an agent confidently wrong
GA4's `firstUser*` dimensions are user-scoped and attributed to a first touch; the unprefixed versions are session-scoped. Both are correct and they answer different questions, so a report that mixes them produces numbers that never reconcile — and nothing in the API objects, because nothing is invalid.
There is a second one in the same family: `conversions` and `keyEvents` are the same metric under two names, and requesting both in one call is a deterministic API error rather than a duplicate column. A tool that collapses the alias before calling saves a round trip; one that does not hands the model an error to reason about.
Use cases
- Ad spend against GA4 outcomes in one question, because both families are on the same key — the join that a GA4-only server structurally cannot do.
- A/B test analysis broken down by device, traffic source and new versus returning, which is what one reviewer described using it for.
- Conversion-event and custom-dimension setup as a change the agent proposes and you approve, rather than a checklist you work through in the GA4 UI.
- Reconciling GA4 against BigQuery, on the same key, when the two disagree.
Frequently asked questions
- Is there an official GA4 MCP server?
- Yes — Google ships a Google Analytics MCP server that reaches GA4 through the Admin API and Data API, covering account structure, core reports and realtime data. It is read-oriented.
- Can an MCP server change my GA4 configuration?
- The official one does not. Agent Planners exposes 15 GA4 writes — custom dimensions, conversion events, audiences, data streams and Google Ads links — each pausing for approval and recording an audit row.
- Why do my GA4 numbers change depending on the dimension I pick?
- The firstUser* dimensions are user-scoped and attributed to a first touch, while the unprefixed versions are session-scoped. Both are valid and they answer different questions, so mixing them in one report gives numbers that cannot reconcile.
- Can one MCP session read GA4 and my ad accounts together?
- On a single-platform server, no. On this one, GA4 sits alongside Google Ads, Meta, TikTok, DV360, Search Console and BigQuery on the same key — which is what makes joining spend to outcomes a single question.