Google Analytics MCP is Google’s free, open-source server that lets an AI agent like Claude run reports on your GA4 data. You install the analytics-mcp package, give it read-only Google credentials, and ask “which pages did organic search send the most visitors to last month?” in plain English.
MCP, the Model Context Protocol, is the open standard that lets an assistant call another product’s tools. If it’s new to you, our plain explainer on MCP covers it without the jargon.
We ran Google’s server, version 0.8.0, against contextbolt.com’s own GA4 property on October 31, 2026. First through a bare MCP client, then inside Claude Code. Reports came back within seconds from a service-account key. The account tools failed with a 403, because our Cloud project had the Admin API switched off.
The tool list also added about 9,200 tokens to every request in Claude Code. And when we asked which Google searches brought our organic visitors, the agent said GA4 couldn’t tell it.
- Google ships an official server.
analytics-mcpis free, Apache 2.0 licensed and read-only by default. Version 0.8.0, from October 22, 2026, offers nine tools, fromrun_reporttorun_funnel_report. - Setup takes four steps: enable the Analytics Admin and Data APIs, give an account Viewer access in GA4, create credentials, and add
pipx run analytics-mcpto your agent. - It costs context. In our Claude Code test the nine tool definitions added about 9,200 tokens to every request, before the agent did anything.
- It can’t see search queries. GA4’s API has no dimension for organic Google searches. Our agent found the term “(not provided)” on about 93% of organic sessions.
- Search Console has the queries. ContextBolt SEO reads your Search Console in the same agent without spending credits, so one prompt joins GA4’s top pages to the searches behind them.
What Google’s Analytics MCP server is
Google created the googleanalytics/google-analytics-mcp repository in July 2025 and published the first package, 0.1.0, on August 22, 2025. Checked on October 31, 2026, the repository has 3,599 stars and an Apache 2.0 license, and the newest release on PyPI is 0.8.0.
It runs on your own computer. Your agent starts it as a local process, and the server calls two Google APIs for you. The Analytics Admin API answers questions about accounts and properties. The Analytics Data API runs the reports.
Google’s setup page, last updated October 26, 2026, says the server “is available for read requests only.” The README names one write tool, create_property_annotation. It stays off unless you start the server with --allow-write and credentials that carry the analytics.edit scope.
The two documents list slightly different tools, so we asked the running server. Version 0.8.0 returned these nine:
| Tool | What it does | API |
|---|---|---|
get_account_summaries | Lists the accounts and properties you can reach | Admin |
get_property_details | Returns one property’s settings | Admin |
list_google_ads_links | Lists linked Google Ads accounts | Admin |
list_property_annotations | Reads your dated notes, like launches | Admin |
get_custom_dimensions_and_metrics | Lists your custom fields | Data |
run_report | Runs a standard report | Data |
run_realtime_report | Reports on activity right now | Data |
run_funnel_report | Runs a funnel on steps you define | Data |
run_conversions_report | Conversions, ad cost and attribution | Data |
run_report does most of the work. You name metrics, dimensions, filters and a date range, and it returns rows.
Set it up in Claude Code, Claude Desktop or Cursor
You need Python 3.10 or later, and pipx or uv to run the package. The commands below are for a Mac or Linux terminal, or Git Bash on Windows.
- Enable two APIs: in a Google Cloud project, turn on the Google Analytics Admin API and the Google Analytics Data API.
- Give an account Viewer access: in GA4, open Admin, then Property access management. Add your own Google account, or a service account’s email, with the Viewer role.
- Create credentials: download a JSON key for the service account, or sign in once with gcloud as yourself.
- Add the server to your agent: one command in Claude Code, one block in Claude Desktop or Cursor.
With the gcloud CLI, step 1 is one line:
gcloud services enable analyticsadmin.googleapis.com \
analyticsdata.googleapis.com
For step 3, we used a service account key, and it needed no gcloud sign-in at all. The server found the key through GOOGLE_APPLICATION_CREDENTIALS. To use your own Google login instead, run this and copy the credentials path it prints:
GA=https://www.googleapis.com/auth/analytics.readonly
CLOUD=https://www.googleapis.com/auth/cloud-platform
gcloud auth application-default login --scopes="$GA,$CLOUD"
Google’s page adds that requests made with your own login need a quota project with both APIs enabled. Set it with gcloud auth application-default set-quota-project YOUR_PROJECT_ID.
In Claude Code, one command adds the server to all your projects:
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
In Claude Desktop, open Settings, then Developer, then Edit Config, paste this block into claude_desktop_config.json and restart. Cursor reads the same block from ~/.cursor/mcp.json.
{
"mcpServers": {
"analytics-mcp": {
"command": "pipx",
"args": ["run", "analytics-mcp"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
"GOOGLE_CLOUD_PROJECT": "YOUR_PROJECT_ID"
}
}
}
}
No pipx? Set the command to uvx and the args to ["analytics-mcp"]. That’s how we ran it. The first run, download included, took about six seconds.
Start with “what GA4 properties can you see?” It’s one call, and it proves the sign-in works. If it fails with a 403, the fixes further down cover it.
What happened when we ran it on our own GA4
We pointed version 0.8.0 at the GA4 property for contextbolt.com on October 31, 2026, with a read-only service account. First we called each tool directly, so we could see the raw replies.
| What we asked | Tool | What came back |
|---|---|---|
| Which properties can you see? | get_account_summaries | 403, Admin API switched off |
| Sessions by channel, 28 days | run_report | Worked, 1 quota token used |
| Top organic landing pages | run_report | Worked, five rows |
Sessions by searchQuery | run_report | 400, “Did you mean searchTerm?” |
| Search Console clicks by page | run_report | 400, fields incompatible |
The 403 hit the two account tools we tried, which use the Admin API. Reports run on the Data API, which was on, so every report worked as long as we passed the property ID.
The quota reply showed how far one report goes. A 28-day channel report used 1 token from a daily allowance of 200,000, and 1 from an hourly 40,000. A small site won’t hit that by asking questions.
Replies are raw JSON with every field labeled. The five-row landing page report came back as 1,713 characters, and every character of it lands in your agent’s context.
The same question, asked in Claude Code
Then we gave Claude Code, running Sonnet 5.5, only Google’s server and asked one question, with our own property ID in it.
My GA4 property ID is YOUR_PROPERTY_ID. Which landing pages did
Organic Search send the most sessions to in the last 28
days, and which Google searches brought those visitors?
It made two run_report calls. The first returned the landing pages, led by our guide to finding X bookmarks. For the second it asked for sessionManualTerm, the campaign term, on organic sessions. About 93% of them came back as “(not provided)”.
Its answer listed the pages, then said GA4 couldn’t name the searches, and that Search Console reports queries per page.
What the tool list costs
We ran the same question again with no server attached. Claude Code’s first request carried 26,322 tokens of input. With Google’s server attached, it carried 35,555. The difference, about 9,200 tokens, is the nine tool definitions, and they ride along on every request in the session.
Most of that is the report tools’ descriptions. The run_report description alone is 12,735 characters, much of it hints on how to format arguments. It also points the agent to get_standard_dimensions and get_dimensions for valid field names, two tools the server doesn’t offer. Our agent picked valid fields anyway.
If you connect several servers, that weight adds up fast. Turn this one off in sessions that don’t need GA4.
What GA4 can’t tell your agent
GA4 only records people who reached your site, and it gets the search engine’s referral without the search behind it. So a few questions stay out of reach, however good the agent is.
- Which searches brought visitors: we pulled GA4’s own field list for our property. Of 378 dimensions, the ones with “query” or “search” in the name cover Google Ads queries, Search Ads 360 queries, your site’s own search box and URL query strings. None is the organic Google search.
- Search Console numbers without a link: the API does carry four Search Console metrics, clicks, impressions, click-through rate and average position. Each “requires an active Search Console link,” and on our property the API refused them with “The request’s dimensions & metrics are incompatible.”
- Searches that never became visits: impressions, the positions where you showed but weren’t clicked, and the keywords you don’t rank for yet never reach GA4.
- Your competitors: GA4 sees your site only. Who outranks you, and what they rank for, needs keyword data.
So the agent can tell you which page won organic traffic. It can’t tell you why, or what to write next.
Get the searches next to the sessions
Search Console holds the missing half: the queries, with impressions, clicks, click-through rate and position for each. ContextBolt SEO is ours, so weigh this section with that in mind. It connects your Search Console on Google’s own consent screen with read-only access, and its Search Console tools never spend a credit.
We ran it on the page GA4 named first, our guide to finding X bookmarks, for the last 28 days:
| Search | Impressions | Click rate | Position |
|---|---|---|---|
| x bookmarks | 2,700 | 1.5% | 4.6 |
| twitter bookmarks | 1,920 | 0.6% | 5.0 |
| how to find bookmarks on x | 1,075 | 0.7% | 4.1 |
| bookmarks on x | 701 | 1.0% | 5.8 |
GA4 said the page was winning. Search Console says where it’s leaking. “twitter bookmarks” shows the page 1,920 times at position 5 and gets clicked 0.6% of the time, so the title is the first thing to test. For the manual route, our guide to Search Console data for a specific page shows three ways to pull the same table.
With both servers connected, you can ask for the whole loop in one prompt:
Use Google Analytics to find my top 5 landing pages from
Organic Search in the last 28 days. Then use ContextBolt
SEO to get the top Search Console queries for each page,
with impressions, click rate and position. Flag queries
in positions 4 to 10 with a click rate under 2%. For the
best three, check volume and difficulty.
The last step uses keyword data, which costs credits: a difficulty check is 1. To try one keyword first, the free Keyword Difficulty Checker checks it with no account.
With ContextBolt SEO, the agent is where you ask, and every result saves automatically to your SEO Dashboard. The 7-day free trial includes 100 credits and requires a card. After that it’s $35 a month with 1,000 credits. Setup in your agent is one line, shown in our Claude Code setup page.
Fixes for the errors you’ll hit
“Google Analytics Admin API has not been used in project … before or it is disabled”: the 403 we got. Enable analyticsadmin.googleapis.com in the project named in the error and wait a few minutes. Until then, reports still work if you give the agent your property ID. It’s under Admin, then Property details, in GA4.
“Did you mean searchTerm? Field searchQuery is not a valid dimension”: the agent guessed a field name. GA4’s error suggests the nearest valid one, and a good agent retries with it. If it loops, point it at Google’s list of API dimensions and metrics.
“The request’s dimensions & metrics are incompatible”: some fields can’t share a report. We hit it with the four Search Console metrics, which Google’s field list says need an active Search Console link.
Reports refused for your property: the account in your credentials has no access to it. Add its email under Property access management with the Viewer role. With a service account, that’s the client_email from the JSON key.
“pipx: command not found”: install pipx, or switch the command to uvx. Both download and run the same package.
Is it worth setting up?
Yes, if you open GA4 every week to answer the same few questions. The server is free, read-only by default, and once the APIs are on, setup takes one command. Asking “what changed in signups since the launch?” beats building that report by hand.
Skip it if your real question is about search: why a page ranks, which queries to chase, what to write next. GA4 can’t see those, and the agent will tell you so.
The next step is to pair them. Connect Search Console through ContextBolt SEO, then ask the prompt above about your own top five pages.