Google Analytics MCP server: setup and what it can do
The Google Analytics MCP server is Google's official way to let an AI agent read your GA4 data. It is a Python package called analytics-mcp, it has 13 tools, and it runs on your own machine with credentials from a Google Cloud project. It uses the same Admin and Data APIs as the rest of GA4. The setup has several steps, and a Reddit thread titled "Google should be ashamed of how hard it is to install Google Analytics MCP" is among the first results when you search for it. This post goes through the setup for version 1.1.0, released on 6 November 2026, and then what the server does not do.
What is the Google Analytics MCP server?
It is an open-source server, published by Google in the googleanalytics/google-analytics-mcp repository, that exposes GA4 reports and property settings as tools an agent can call. Your agent asks for a report in the shape the GA4 Data API expects, and gets rows back. It works with any MCP client; Google documents Claude Code, Claude Desktop, Cursor and its own Antigravity and Gemini tools.
Two things are worth knowing before you start. It only reads data that GA4 has already collected, so you need a working GA4 property first. And there is no endpoint hosted by Google that you can point a client at: you either run it locally, which is what the steps below do, or host it yourself.
Set it up in four steps
You need Python 3.10 or later with pipx, the gcloud CLI, a Google Cloud project, and at least the Viewer role on the GA4 property. First, enable the two APIs in your project:
gcloud services enable \
analyticsadmin.googleapis.com \
analyticsdata.googleapis.com \
--project=YOUR_PROJECT_IDSecond, create an OAuth client in the Cloud console (desktop or web type), download its JSON file, and sign in so that gcloud stores Application Default Credentials with 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 \
--client-id-file=YOUR_CLIENT_JSON_FILEThird, copy the path from the line Credentials saved to file: [...]. Fourth, register the server with your client. For Claude Code:
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-mcpFor Claude Desktop or Cursor, the same thing goes into the client's MCP 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"
}
}
}
}A service account works too: either point GOOGLE_APPLICATION_CREDENTIALS at its key file, or use --impersonate-service-account in the login command. The account needs the Viewer role on the property either way.
The errors you are most likely to hit
Google's setup guide lists four errors that come up during installation, each with a specific fix.
| What you see | What it means |
|---|---|
spawn pipx ENOENT or uvx: command not found | The client cannot find the binary. Use the absolute path from which pipx as the command. |
401 UNAUTHENTICATED or a missing credentials file | The credentials path must be absolute. ~ and $HOME are not expanded. |
403 PERMISSION_DENIED | One of the two APIs is not enabled, or your account lacks the Viewer role on the property. |
403 ACCESS_NOT_CONFIGURED | No quota project. Set GOOGLE_CLOUD_PROJECT, or run gcloud auth application-default set-quota-project. |
An "insufficient scopes" error means the login ran without the Analytics scope, and the fix is to run the login command again with the full --scopes value.
13 tools, three of which can write
The server has ten read tools and three write tools, and the write tools are off unless you start it with --allow-write. Google's developer guide still lists nine and calls the server read-only; the repository is ahead of it.
| Tool | What it does |
|---|---|
get_account_summaries | Lists the accounts and properties you can see |
get_property_details | Settings of one property |
list_google_ads_links | Linked Google Ads accounts |
list_property_annotations | Annotations on a property |
list_key_events | Key events, formerly conversions |
get_custom_dimensions_and_metrics | Custom dimensions and metrics |
run_report | A standard report through the Data API |
run_funnel_report | A funnel report |
run_conversions_report | Conversions with ad cost, ROAS and attribution models |
run_realtime_report | Activity in the last half hour |
create_property_annotation | Write: adds an annotation |
create_custom_dimension | Write: adds a custom dimension (Editor role) |
create_key_event | Write: marks an event as a key event (Marketer or Editor role) |
The write tools also need the analytics.edit scope on your credentials. If you only want an agent that reads, leave the flag off and nothing changes in your property.
Is there a hosted version?
Not one that Google runs for you. Version 1.0.0, released on 3 November 2026, added an HTTP mode where each user signs in with their own Google account, but you host that server yourself. Google documents Cloud Run and Docker:
pipx run analytics-mcp \
--transport http --stateless-http --oauth --host 0.0.0.0 --port 8080That mode needs an OAuth client ID and secret, and the built-in sign-in keeps its state in memory, so Google's README says to run a single instance and expect users to sign in again after a restart. It suits a team that wants one shared server. For one developer the local install is simpler.
Where the server stops
The server gives an agent access to GA4 and nothing more, which leaves four limits.
- It does not collect anything. You still install GA4 on the site, and GA4 sets cookies, so in the EU you still need a consent banner.
- Queries are in GA4's own format. The agent has to compose dimensions, metrics and date ranges as nested arrays. That is flexible, but it takes more tokens than a tool with fixed parameters.
- Standard reports are not instant. Google says processing can take 24 to 48 hours, and that numbers may change during that time. The realtime tool covers the last 30 minutes.
- Setup is per machine. Credentials live in a file on your disk, so a second laptop or a teammate repeats the steps above.
If you already run GA4, and especially if you run Google Ads, none of this should put you off. The conversions report with ad cost and attribution models has no equivalent in Lodd.
The one-prompt route, if you do not need GA4 itself
If what you want is traffic data in your agent's context, and not GA4 in particular, a tool built around MCP from the start is quicker to set up. We make one, called Lodd. It is a separate analytics service, not a connector to GA4: it collects its own data with a small cookieless script, and it has no dashboard at all. Setup is one prompt to your coding agent:
add lodd.dev analytics to this projectThe agent reads the setup instructions, signs you up with a 6-digit email code, creates the site and adds the script. After that it has 43 tools with flat parameters, so "top pages this week" is {"site": "example.com", "period": "7d"} instead of a report definition. There is no Google Cloud project and no credentials file, and the hosted endpoint works the same from every machine.
Lodd does less than GA4 in several areas. It has no Google Ads integration, no BigQuery export and simpler attribution, the free tier stops at 2,500 events a month where GA4 is unlimited, and it is a newer product. The GA4 comparison page has the full table, and the post on GA4 for developers goes through the trade-offs in more detail.
Which one should you use?
Use Google's server when the data you care about is already in GA4, and use something lighter when you are starting from nothing and mainly want your agent to know how the site is doing. The two also run side by side without conflict, so GA4 can stay for ads and reporting while a lighter tool feeds the agent.
| Google Analytics MCP | Lodd | |
|---|---|---|
| Reads | Your existing GA4 property | Its own data, from its own script |
| Setup | Cloud project, two APIs, gcloud login, pipx | One prompt |
| Runs | Locally, or self-hosted over HTTP | Hosted, or locally with npx |
| Tools | 13 (3 write, behind a flag) | 43 |
| Cookies and consent banner | Yes, through GA4 | No cookies |
| Google Ads and attribution models | Yes | No |
| Price | Free | Free to 2,500 events a month, then €9.99 |
The setup details for Lodd are in the documentation.