Home / Blog / Google Analytics MCP Server
How-to · 2026

Google Analytics MCP Server: Setup for Claude, What It Can Read, and Where It Stops

Google publishes an official MCP server for GA4. It is free and it works, and it asks you for a Google Cloud project, a command-line login and a config file. Here is the setup in order, and what the assistant can and cannot do once it is running.

By · Published November 25, 2026 · 9 min read

Google’s official Google Analytics MCP server lets Claude read your GA4 data. It is open source, read-only by default, and runs on your own computer, so setup means a Google Cloud project, a gcloud login and a config entry. This page walks through the setup as Google documents it, covers the errors that stop most first attempts, and explains what changes when an assistant, not you, chooses the report.

Checked against Google’s documentation and repository on November 25, 2026. Steps, flags and tool names change, so compare with Google’s page before you copy a command.

What the server is

It is a Python package, analytics-mcp, published by Google under the Apache-2.0 license. It exposes GA4 through the Admin API and the Data API as tools an MCP client can call. Google’s documentation lists these read tools:

The assistant picks the tool and the arguments, such as which dimensions, which metrics and which dates. That is the useful part, and it is also where numbers can go wrong, which a later section covers.

Setup, in order

  1. Install Python 3.10 or higher and pipx. uv works instead of pipx if you prefer it.
  2. Enable the two APIs in a Google Cloud project. Use a project you control. In a terminal:
    gcloud services enable analyticsadmin.googleapis.com \
      analyticsdata.googleapis.com \
      --project=YOUR_PROJECT_ID
  3. Give your Google account the Viewer role on the GA4 property. This is done in Google Analytics itself, under the property’s access management, not in Cloud.
  4. Sign in with Application Default Credentials. This asks for the read-only Analytics scope:
    gcloud auth application-default login \
      --scopes="https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform"
    The command prints a line starting Credentials saved to file:. Keep that path.
  5. Add the server to your client. For Claude Desktop, add this to the MCP servers section of its config file:
    {
      "mcpServers": {
        "analytics-mcp": {
          "command": "pipx",
          "args": ["run", "analytics-mcp"],
          "env": {
            "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
            "GOOGLE_CLOUD_PROJECT": "YOUR_PROJECT_ID"
          }
        }
      }
    }
    For Claude Code, Google gives a single command instead:
    claude mcp add analytics-mcp \
      --scope user \
      -e GOOGLE_APPLICATION_CREDENTIALS="PATH_TO_CREDENTIALS_JSON" \
      -e GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID" \
      -- pipx run analytics-mcp
  6. Restart the client and ask a question you can check. Sessions for last month is a good one.

Where first attempts fail

From years of being the person who explains a traffic number

When a setup like this fails, it is almost never the part you spent the afternoon on. It is the property permission that someone granted to a different login, or a time zone nobody remembers choosing. The assistant then returns a perfectly calm answer built on the wrong property or the wrong week.

So I treat the first question as a test of the plumbing, not of the assistant. One month, one metric, compared with the number GA4 already shows on its own screen. Only after that do I trust it with the interesting question.

Read-only, and the flag that changes that

Google’s documentation page says the server handles read requests only and cannot change your Analytics configuration. Its repository README goes further and lists three write tools: create_property_annotation, create_custom_dimension and create_key_event. They are off by default and need the --allow-write flag plus the analytics.edit scope. The two pages do not mention each other, so read both. For reporting, I would leave write off. An assistant that can create a key event can also create the wrong one, and a changed key event definition moves every conversion number after it.

Local, and the remote option

The configuration above runs the server as a local process, which is why it suits desktop clients and Claude Code. The README also describes starting the server with an HTTP transport so it can be shared, with Cloud Run and Docker instructions and an OAuth mode. We have not run that, and the documentation page does not cover it, so treat it as a path for an engineer, not a quick start.

What an assistant can get wrong with GA4

The server hands the assistant raw reporting, and the assistant decides how to ask for it. Three GA4 traps survive review because the answers look sensible:

The error is a number that is too high or too flat, it reads fluently, and nobody reopens a paragraph that sounds right. That is why the one-month check from the setup matters, and why a recurring figure belongs in a definition rather than in a prompt. The same drift problem is covered for CRM data in HubSpot MCP and Claude.

Which route I would pick

Where Quiriz stops. It does not read source or medium, UTM campaigns, event names, demographics, devices or geography, and landing pages are capped at the top 5,000 a month. It has no funnel or real-time report. If the question needs those, Google’s server is the right tool. Details are on the Google Analytics connector page.

For what a recurring GA4 deliverable should contain, see the GA4 report guide. For the other direction, paid clicks against analytics, see Google Ads conversions in GA4.

📚 Connector reference: every dataset and metric definition behind this, and how each is calculated, is in the Google Analytics connector. All connectors.

Ask GA4 without the Cloud project

Try a traffic question on sample data with no signup, then connect a GA4 property and ask which channel brought the most revenue last quarter.

Try Quiriz free →

Frequently asked questions

Does the Google Analytics MCP server work with the Claude chat on the web?
The configuration Google documents starts a local process on your computer, which suits Claude Desktop and Claude Code. A server running on your laptop is not reachable from the web chat. Google’s repository also describes a mode for hosting the server over HTTP, which we have not tried, so we cannot say how well it works with Claude’s web connectors.
Why does the server return no data?
The most common causes are the wrong Google account, no Viewer role on the property, one of the two APIs not enabled in the Cloud project named in GOOGLE_CLOUD_PROJECT, or a credentials path that is not absolute. Google’s troubleshooting notes say not to use ~ or $HOME in the path.
Can the assistant change my Google Analytics settings?
Not in the default setup. Google’s documentation describes the server as read-only. Its repository also lists three write tools, for annotations, custom dimensions and key events, that are off unless you start the server with the --allow-write flag and sign in with the analytics.edit scope. Leave that off for reporting.
Do requests count against my API quota?
Requests made with your own credentials need a quota project with the two APIs enabled, which is why GOOGLE_CLOUD_PROJECT is in the config. We did not find quota numbers on the pages we read, so check Google’s current limits if you plan to run many reports.
Is a service account better than my own login?
A service account avoids tying the setup to one person’s sign-in, and Google’s steps cover it: point GOOGLE_APPLICATION_CREDENTIALS at the key file and add the service account as a Viewer on the property. It also means a key file to store and rotate.