Integrations

Google Analytics MCP — Connect Google Analytics to Claude, ChatGPT, and Other AI Assistants

·14 min read

If you're searching for "Google Analytics MCP", you're asking one of two things: does Google Analytics have an MCP server? or how do I connect Google Analytics to an AI assistant via the Model Context Protocol?

⚠️ No official Google Analytics MCP server yet. Community options exist — details below.

What Is MCP?

Model Context Protocol (MCP) is an open standard developed by Anthropic that lets AI assistants — like Claude — connect to external tools, APIs, and data sources in a standardised way.

Before MCP, every AI integration required bespoke tooling: custom prompts, custom API wrappers, and custom glue code to pass context back and forth. MCP replaces that with a common interface: the AI asks the MCP server for data or actions, the server returns structured results, and the AI uses them to answer your question or complete a task.

In plain terms: MCP is how you give an AI assistant live access to Google Analytics — not just knowledge about it, but real, up-to-date data from your account.

What a Google Analytics MCP Integration Does

Once Google Analytics is connected via MCP, your AI assistant can:

  • Read live data — pull records, metrics, activity, and status directly from Google Analytics
  • Take actions — create, update, or log records based on your instructions
  • Cross-reference context — combine Google Analytics data with other connected tools mid-conversation

The key difference from a standard chatbot: the assistant is not working from training data or memory. It is reading your actual Google Analytics instance, in real time.

Practical Google Analytics MCP Use Cases

Read and query ${displayName} from chat

Instead of switching to the Google Analytics dashboard, ask your AI assistant to fetch the data you need and return it in a readable format — right in your conversation.

Write back to ${displayName} without leaving chat

Have the assistant create, update, or log records in Google Analytics based on your instructions — with a confirmation step before any write action executes.

Cross-tool context stitching

The assistant pulls data from Google Analytics alongside other connected tools and surfaces the combined context where it's most useful — without manual copy-paste.

Google Analytics MCP: The Part the Setup Guides Skip

Google publishes a first-party MCP server for Analytics, and the base template above was written for the world before it: enable the Data API, build a proxy around runReport, write a skill file documenting GA4's dimensions. That proxy route still works, and for one or two fixed reports it is still the cheapest thing to own. But if the question changes week to week — which landing pages lost conversions after the pricing change, which campaign started drifting on Tuesday — the official server is the shorter path, and most write-ups of it stop at "pipx run analytics-mcp" without mentioning the four things that actually break.

The Google Analytics MCP server documentation page on Google for Developers — prerequisites, authentication, and per-client configuration

Google's own page for the Analytics MCP server, which as of 21 October 2026 documents prerequisites, ADC setup, and per-client config.

Where the server actually lives

Two different things get called "the Google Analytics MCP server" in search results, and they are not the same artifact:

What people call it What it actually is Transport Install
Google Analytics MCP server Google's official, open-source server in googleanalytics/google-analytics-mcp, Apache-2.0, published to PyPI as analytics-mcp stdio only — runs as a local subprocess under your MCP client pipx run analytics-mcp or uvx --from analytics-mcp google-analytics-mcp
"Hosted GA MCP" listings Third-party aggregators that wrap the GA4 Data API behind their own hosted endpoint, sometimes with OAuth instead of a Google Cloud project Remote HTTP Their signup, not a Google install

Google's server is deliberately local. There is no Google-hosted remote endpoint for Analytics the way there is for Sheets (sheetsmcp.googleapis.com) or for Workspace in general. That one fact decides a lot: a local stdio server inherits the credentials of the machine it runs on, which is excellent for a laptop and awkward for a serverless agent.

The googleanalytics/google-analytics-mcp repository — Apache 2.0, Python, published on PyPI as analytics-mcp

The repository Google points you at from its own documentation. Note the tool list in the README: eight tools, all read-only by default.

The tool surface is small on purpose — and read-only by default

Google's docs are explicit that the server "is currently for read-only requests and cannot modify your Google Analytics settings." That is not a limitation of the API, it is a decision in the server. Eight tools ship by default:

Tool API call underneath What it is actually for
get_account_summaries accountSummaries.list Property discovery — the first call any agent should make
get_property_details properties.get Property configuration, including currency and time zone
list_google_ads_links properties.googleAdsLinks.list Which Ads accounts are linked, before blaming GA4 for an attribution gap
list_property_annotations properties.reportingDataAnnotations.list The annotations teammates left when they shipped something
get_custom_dimensions_and_metrics getMetadata The schema check that stops hallucinated dimension names
run_report runReport Standard reports — the workhorse
run_realtime_report runRealtimeReport Last-30-minutes checks, with a different dimension set
run_funnel_report runFunnelReport Funnel exploration, not just flat tables

A ninth tool, create_property_annotation, exists in the open-source repo but only appears when you launch the server with --allow-write and grant the analytics.edit scope. So the honest version of "is GA4 MCP read-only" is: read-only unless you opt in twice. Note that Google's public docs page still describes the server as read-only — the write flag is documented in the repository, not on the marketing page.

Configuration that works on the first try

The server authenticates with Application Default Credentials, not with an API key and not with a client secret embedded in the JSON. That is the single biggest source of first-run failures, because people look for somewhere to paste a key and there isn't one.

The minimum viable setup, in order:

  1. Enable both APIs, not one. analyticsadmin.googleapis.com and analyticsdata.googleapis.com. Enabling only the Data API gives you a working run_report and a failing get_account_summaries, which reads as a permissions problem and is not one.
  2. Mint ADC credentials with the read-only scope plus cloud-platform so the quota project works:
gcloud auth application-default login \
  --scopes="https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform"
  1. Grant the identity Viewer on the GA4 property (roles/analytics.viewer) in the Analytics UI. A service account that can authenticate but has no property access returns an empty accountSummaries list rather than an error.
  2. Point the client at the credentials file with an absolute path and set the quota project:
{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": ["run", "analytics-mcp"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/Users/you/.config/gcloud/application_default_credentials.json",
        "GOOGLE_CLOUD_PROJECT": "your-project-id"
      }
    }
  }
}

That GOOGLE_CLOUD_PROJECT entry is the one people drop, and dropping it produces 403 ACCESS_NOT_CONFIGURED on every request — a credential error that is really a billing/quota-project error. If you would rather set it on the credentials file itself, gcloud auth application-default set-quota-project your-project-id does the same job.

The five failures you will actually hit

1. spawn pipx ENOENT / uvx: command not found. Desktop clients do not inherit your interactive shell's PATH. pipx lives in ~/.local/bin or /opt/homebrew/bin and MCP hosts do not expand shell variables inside JSON config. Replace "command": "pipx" with the absolute path from which pipx. This is the most common "the server won't start" report and it has nothing to do with Analytics.

2. Tilde paths in GOOGLE_APPLICATION_CREDENTIALS. ~/.config/gcloud/... is not expanded by most hosts. It has to be absolute. Google's own troubleshooting section calls this out by name, which tells you how often it happens.

3. 403 PERMISSION_DENIED after a successful login. Three different causes collapse into one error code: an API not enabled, the authenticating identity missing Viewer on the property, or a stale property ID. Check in that order.

4. 401 UNAUTHENTICATED on a setup that worked last month. ADC user credentials expire. Re-run gcloud auth application-default login — and if you are running this unattended, stop using user ADC and use service-account impersonation instead, because a laptop-shaped credential in a cron job will fail silently at the worst time.

5. Realtime reports that "don't have" the dimension you need. run_realtime_report uses a different, smaller dimension and metric set than run_report. Asking a realtime query for a session-scoped dimension returns an error that looks like a bad field name. Build the schema check into your prompt: call get_custom_dimensions_and_metrics before writing a report you intend to reuse.

Five workflows worth wiring up

Weekly landing-page decay check. "Compare sessions and key events by landing page for the last 7 days against the previous 7, and list every page where sessions held but key events dropped more than 15%." This is the query GA4's own UI makes you build in three screens, and it is the one that catches a broken form before a client does.

Annotation-aware anomaly triage. "Traffic to /pricing dropped 40% yesterday. Check the annotations on this property for the last 14 days and tell me whether anything shipped that explains it, then break the drop down by channel." list_property_annotations exists for exactly this — the answer is usually "we migrated the domain" and it is already written down somewhere nobody reads.

Paid vs organic divergence. "Which landing pages get the most paid sessions but convert worse than the site average? Cross-check the linked Google Ads accounts with list_google_ads_links." The Ads-link tool is what stops an agent from confidently blaming a landing page when the real story is a broken UTM in one campaign.

Funnel drop-off in plain language. "Run a funnel from session start through add_to_cart to purchase for the last 28 days, and tell me which step lost the most users relative to the previous period." run_funnel_report is the tool that keeps this honest — modelling a funnel as a series of separate run_report calls is how you get step counts that do not add up.

Realtime launch watch. "Every 10 minutes for the next two hours, tell me realtime active users and top events, and alert me if purchase events stop entirely." The only workflow here that genuinely needs run_realtime_report, and the one where a stale property ID is most expensive.

Who should not use this

If what you want is a Slack bot that answers "how did the site do yesterday" without anyone touching a terminal, running a local Python server per person is the wrong shape — every teammate needs Python 3.10+, gcloud, ADC credentials and a working PATH. For teams, see OpenClaw for Google Analytics, which covers the hosted-assistant path, or How to connect Google Analytics to OpenClaw if you want to own the credentials and the schema yourself.

If you are already running the Sheets or Workspace servers, Google Workspace MCP explains the per-product split — Analytics is a separate server from the Workspace suite, with a separate install and a separate scope.

Also read

How to Connect Google Analytics via MCP

There are two main paths:

Option A: Use a community MCP server for Google Analytics

No company-maintained MCP server currently exists for Google Analytics. Community-built servers are available — search the MCP Registry or GitHub for "Google Analytics MCP server".

What you'll need:

  • An MCP-compatible client (Claude Desktop, OpenClaw, or another host)
  • A running MCP server process with Google Analytics credentials configured
  • Basic familiarity with running a local service or Docker container

Community servers vary in completeness and maintenance quality — review the repo before committing to one.

Option B: Use Cody (OpenClaw-based, managed)

Cody is built on OpenClaw and supports MCP-compatible integrations out of the box. You connect Google Analytics once from the Cody dashboard — no server to run, no code to write — and Cody handles authentication, context passing, and write-back actions with appropriate guardrails.

Cody works where your team already operates: Slack, Telegram, or the web chat. The Google Analytics connection is available to your entire team without each person setting up their own MCP client.

Want Google Analytics Connected to AI Without Running Your Own MCP Server?

Cody gives your team a Google Analytics assistant in Slack, so people can review traffic, conversions, landing-page performance, and channel changes without building GA4 reports or living inside dashboards.

Get started with Cody →

MCP vs Other AI Integration Patterns

Approach What it is Tradeoff
MCP Standardised protocol for live tool access Requires an MCP server; most powerful when set up correctly
RAG (retrieval) Pre-index Google Analytics content and retrieve it Good for static docs; not suitable for live/transactional data
Manual copy-paste Paste Google Analytics output into ChatGPT/Claude Fast to start; breaks for anything recurring or at scale
Custom API wrappers Bespoke integration code per tool Full control; high maintenance overhead

MCP wins when you need live data from Google Analytics and want to avoid rebuilding integrations as APIs change.

Common Mistakes

  • Using training data when live data is needed — if the AI doesn't have an MCP connection, it will answer from memory, which is often outdated or wrong for account-specific questions
  • No write-back guardrails — MCP can write to Google Analytics, so it's worth adding an approval step for any action that modifies records
  • Too many tools exposed at once — give the AI access to the Google Analytics actions it actually needs; a scoped connection is easier to reason about and audit
  • Skipping structured outputs — ask the AI to return structured JSON or clear fields when writing back to Google Analytics; free-form output is harder to validate

Google Analytics specific pitfalls

  • Two APIs, not one. analyticsadmin.googleapis.com and analyticsdata.googleapis.com are separate enablements. Half-working installs are almost always this.
  • ADC, not an API key. There is no key to paste. Credentials are a file path, and it must be absolute.
  • The quota project is a hard requirement for user credentials. Missing GOOGLE_CLOUD_PROJECT returns 403 ACCESS_NOT_CONFIGURED, which reads like a permissions bug and is not.
  • Empty results are usually access, not data. A service account with no Viewer grant gets accountSummaries: [] and no error.
  • Write access is opt-in twice. --allow-write in the launch args and the analytics.edit scope. Without both, create_property_annotation is absent from the tool list entirely.
  • Realtime has its own dialect. run_realtime_report supports a narrower dimension set than run_report; reuse a standard-report spec and it fails.
  • Dates are property-timezone, not yours. GA4 reports in the property's time zone, so "yesterday" in a UTC cron job and "yesterday" in the report can be different days.
  • Annotations are the cheapest context you can give an agent. One list_property_annotations call explains most traffic anomalies for free.

Related MCP Guides


Want the full workflow picture? See: Google Analytics AI Automation and How to Connect Google Analytics to OpenClaw.