How to Connect Google Analytics to Claude with the Official GA4 MCP Server

Google ships an official MCP server for GA4. Fifteen minutes of setup and you can ask your property questions in plain English: how many users yesterday, which products sold, which channels drove them. Here is the full setup, the PATH problem that breaks most first installs, and what to ask once it works.

I pull numbers out of GA4 constantly, and most of those pulls are the same five reports with different date ranges. Connecting the property to Claude through MCP has turned a lot of that into typed questions.

This is the setup guide I wish had existed when I did it.

🔒
Before anything else: the official server is read only. It can run reports and read property details. It cannot create goals, edit settings, or touch your configuration. That is the right default, and it is why connecting a production property is a reasonable thing to do.

What MCP Is, in One Paragraph

MCP, the Model Context Protocol, is a standard for letting an AI assistant call tools in outside systems. A server exposes one system as a set of tools, and the assistant decides when to call them. The Google Analytics server exposes GA4 reports. Your job is authentication and wiring. After that, the model writes and runs the queries.

The server is Google’s own, open source at googleanalytics/google-analytics-mcp, and it runs locally on your machine under your credentials. Nothing is hosted by a third party.

What You Need

RequirementWhere it comes from
A GA4 propertyYou have this already
A Google Cloud projectconsole.cloud.google.com, free
Two APIs enabledAnalytics Data API and Analytics Admin API, in that project
Python 3.10+ and pipxYour machine
The gcloud CLIFor Application Default Credentials

Budget 15 minutes if the Cloud project already exists, 25 if you’re starting from nothing.

The Setup

1. Enable the APIs. In your Cloud project, enable the Google Analytics Data API and the Google Analytics Admin API. Both, not one. The Data API runs reports, the Admin API lets the server discover your accounts and properties.

2. Install the server:

pipx install analytics-mcp

3. Authenticate. The server reads Application Default Credentials, so one gcloud command does it:

gcloud auth application-default login \
  --scopes=https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform

A browser opens, you sign in with the Google account that has access to the GA4 property, and the credentials land on disk where the server finds them. Note the scope: read only, deliberately.

4. Register it with your client. For Claude Code:

claude mcp add analytics-mcp --scope user -- analytics-mcp

For Claude Desktop, the equivalent entry in your MCP settings:

"analytics-mcp": {
  "command": "analytics-mcp"
}

5. Verify. Run claude mcp list and look for the server reported as connected, or just ask Claude “what can the analytics-mcp server do.”

💡
The failure that gets almost everyone: the server shows as failed because the client cannot find the analytics-mcp command. Clients launch servers outside your shell setup, so your PATH does not apply. Fix it by using the full path to the binary in the config, something like /Users/you/.local/bin/analytics-mcp, instead of the short name.

What It Can Do

The tool surface is small and useful: account and property summaries, standard reports against the Data API, and realtime queries. In practice that covers the questions that make up most day-to-day GA4 usage:

  • “How many users did we have yesterday, and from which channels?”
  • “Top selling products last week by revenue”
  • “Compare organic sessions this month against last month”
  • “What’s happening on the site right now?”

The model translates the question into the right dimensions and metrics, which quietly removes the worst part of GA4: remembering what anything is called in the API.

🧪
Spot-check the first week. The model will happily query a wrong date range or the wrong conversion event if you are vague. Check its first answers against the GA4 UI the way you would check a new analyst's work. Once you know where it is reliable, the checking stops being necessary.

The Limits, Honestly

Local clients only. Claude on the web cannot launch local processes. You need Claude Desktop, Claude Code, Cursor, or Gemini CLI. Hosted wrappers exist if browser access matters, with the tradeoff that your tokens then live with the host.

Read only cuts both ways. Nothing can go wrong, and nothing can be done. Acting on findings is your job.

The model sees what it reads. Property data flows into the conversation. For most businesses that’s fine; decide before connecting if yours is different.

The Real Value Is the Second Server

On its own, the GA4 server saves you report clicks. The step change comes when Google Ads is connected in the same conversation, because then you can ask the reconciliation questions: where Ads-reported conversions and GA4 purchase events disagree, by campaign, for the same period. That gap is where budgets quietly die, and I’ve written about the KPIs worth trusting precisely because the two systems never agree on their own.

The Ads setup is more involved, mostly because of a developer token approval that takes days if you don’t start it early. Full walkthrough here: connecting Google Ads to Claude with the official MCP server.


I’m Nikhil Sharma. I run data and operations engineering for a DTC brand and write about the systems underneath ecommerce. If you want help wiring your analytics into something your team can actually query, book a consultation.

Frequently asked questions

What is an MCP server?
MCP, the Model Context Protocol, is a standard that lets an AI assistant call tools in outside systems. An MCP server exposes one system as a set of tools. The Google Analytics MCP server exposes your GA4 reporting, so an assistant like Claude can pull metrics and run reports on your behalf instead of you exporting CSVs.
Is there an official Google Analytics MCP server?
Yes. Google maintains it at googleanalytics/google-analytics-mcp on GitHub, published on PyPI as analytics-mcp. It uses the Analytics Data API and Admin API.
Can the GA4 MCP server change my Analytics settings?
No. It is read only by design. It can run reports, read property details, and query realtime data, but it cannot create goals, edit settings, or change your configuration in any way.
What credentials does the Google Analytics MCP server need?
Application Default Credentials from the gcloud CLI, scoped to analytics.readonly, signed in as a Google account that has access to your GA4 property. No service account or API key is required for local use.
Does the GA4 MCP server work with Claude on the web?
Not directly. It runs locally on your machine, so you need a client that can launch local processes: Claude Desktop, Claude Code, Cursor, or Gemini CLI.
Why does my client show the analytics-mcp server as failed?
The usual cause is PATH. The client launches servers outside your shell setup, so the short command name may not resolve. Point the config at the full path to the analytics-mcp binary, typically under ~/.local/bin, and it connects.
Is it safe to connect Google Analytics to an AI model?
The server runs locally under your own credentials and is read only, so the risk is data exposure rather than damage. Whatever the model reads becomes part of the conversation, so treat it like a report export.
Can I connect Google Ads the same way?
Yes, Google ships a separate official MCP server for Google Ads. The setup is more involved because of the developer token approval process, and having both connected in one conversation is where the real value shows up.
Nikhil Sharma

Nikhil Sharma

I'm Nikhil Sharma. I write about Shopify, paid ads, email, and the systems I build for the DTC brands I work with.