Google Analytics MCP Server: Setup Guide (2026)
Set up Google's official Google Analytics MCP server in Claude Code, Codex, Cursor or Gemini CLI: the steps, common errors, quotas and prompts to try.

Updated October 20, 2026. Rillow publishes this guide and makes an SEO MCP server that reads Google Analytics too. We say below what it covers and what it doesn't. There are no affiliate links here.
The Google Analytics MCP server is Google's own open source server that lets an AI agent read your GA4 data. Once it is set up, Claude Code, Codex, Cursor or Gemini CLI can run reports, funnels and realtime reports for you, so you can ask "which pages brought the most sign-ups last month?" in plain words. Google says it is "available for read requests only", so it can't change your Analytics settings.
The server runs on your computer and signs in through a Google Cloud project, which is where most people get stuck. This guide walks through that setup for each agent, the errors you are likely to hit, the quotas that apply, and the prompts worth trying first.
What the Google Analytics MCP server does
Google describes the server on its developer site and keeps the code at googleanalytics/google-analytics-mcp on GitHub. In October 2026 the README still marks it Experimental. It is free under the Apache 2.0 license and has about 2,800 stars.
It gives your agent seven tools:
| Tool | What it does |
|---|---|
get_account_summaries | Lists your Analytics accounts and properties |
get_property_details | Returns one property's details |
list_google_ads_links | Lists the Google Ads accounts linked to a property |
run_report | Runs a report with the dimensions, metrics and dates you ask for |
run_funnel_report | Runs a funnel report |
get_custom_dimensions_and_metrics | Lists a property's custom dimensions and metrics |
run_realtime_report | Shows what is happening on the site right now |
run_report does most of the work. It uses the GA4 Data API, so anything you can build as a standard report, your agent can ask for: sessions by landing page, users by source, key events by campaign, and so on. It works with GA4 properties only.
What you need first
- A GA4 property that your Google account can read.
- Python 3.10 or newer and pipx, which runs the server's
analytics-mcppackage. - The Google Cloud CLI (
gcloud), for the sign-in. - A Google Cloud project with two APIs enabled: the Google Analytics Admin API and the Google Analytics Data API.
- An OAuth client ID of type Desktop app, created in that project, with its JSON file downloaded. Set up the OAuth consent screen first and add your Google account as a test user.
Step 1: Sign in with Google
The server reads Google's Application Default Credentials, so you sign in once with gcloud. This is the command from the README, with your client file in place of the placeholder:
gcloud auth application-default login \
--scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform \
--client-id-file=/Users/you/keys/client_secret.json
A browser window opens. Sign in with the Google account that can see your Analytics property. When it finishes, the command prints Credentials saved to file: and a path, usually ~/.config/gcloud/application_default_credentials.json on a Mac or Linux. Copy the full path for the next step.
The analytics.readonly scope is what keeps the server read-only. If your company prefers service accounts, the README also shows a login that impersonates one.
Step 2: Add the server to your agent
Every agent needs the same two values: GOOGLE_APPLICATION_CREDENTIALS, the path from step 1, and GOOGLE_PROJECT_ID, your Google Cloud project's ID. The examples use /Users/you/.config/gcloud/application_default_credentials.json and my-project. Replace both.
Claude Code
This is the README's own command:
claude mcp add analytics-mcp --scope user \
-e "GOOGLE_APPLICATION_CREDENTIALS=/Users/you/.config/gcloud/application_default_credentials.json" \
-e "GOOGLE_PROJECT_ID=my-project" \
-- pipx run analytics-mcp
--scope user makes it available in every project. Run /mcp inside Claude Code to check that analytics-mcp is connected.
Codex
The README has no Codex command, so this uses Codex's standard command for local servers:
codex mcp add analytics-mcp \
--env GOOGLE_APPLICATION_CREDENTIALS=/Users/you/.config/gcloud/application_default_credentials.json \
--env GOOGLE_PROJECT_ID=my-project \
-- pipx run analytics-mcp
Cursor
Add the server to ~/.cursor/mcp.json for every project, or .cursor/mcp.json for one (Cursor MCP docs). Cursor is a desktop app that may not see your terminal's PATH, so give the full path to pipx, which which pipx prints:
{
"mcpServers": {
"analytics-mcp": {
"command": "/opt/homebrew/bin/pipx",
"args": ["run", "analytics-mcp"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/Users/you/.config/gcloud/application_default_credentials.json",
"GOOGLE_PROJECT_ID": "my-project"
}
}
}
}
Gemini CLI
The README's example goes in ~/.gemini/settings.json, inside mcpServers:
{
"mcpServers": {
"analytics-mcp": {
"command": "pipx",
"args": ["run", "analytics-mcp"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/Users/you/.config/gcloud/application_default_credentials.json",
"GOOGLE_PROJECT_ID": "my-project"
}
}
}
}
Start Gemini CLI and type /mcp to see analytics-mcp in the list.
Claude desktop app and claude.ai
The Claude desktop app takes the same JSON in its claude_desktop_config.json file. Two Octobers set it up that way and then used it inside a Claude project. claude.ai in the browser can't run a server on your computer, so it needs a hosted option instead.
Step 3: Check that it works
Start with the README's own test prompts:
- "What can the analytics-mcp server do?"
- "Give me details about my Google Analytics property with 'example' in the name."
If the agent lists your property, the setup is done.
Common setup errors
pythonis not found. Newer Macs only havepython3. Install Python 3.10 or newer, then pipx.- The
gcloudlogin fails. An old Google Cloud CLI can be the cause. Rungcloud components updateand try again. - The agent sees no properties. The Google account you signed in with in step 1 can't open the property, or the login was missing the
analytics.readonlyscope. Sign in again with the command above. - "API has not been used in project" errors. One of the two APIs isn't enabled in the project named in
GOOGLE_PROJECT_ID. - The server won't start in Cursor or the Claude desktop app. Desktop apps often can't find
pipx. Use its full path as the command. - You have to sign in again every week. Google expires sign-ins for apps in Testing after 7 days (Google). Publish the app on the OAuth consent screen, or use a service account.
- Project ID variable name. The README's text mentions
GOOGLE_CLOUD_PROJECTfor Gemini, while its example configs useGOOGLE_PROJECT_ID. If one doesn't work, try the other.
Hosted options without Google Cloud
If you'd rather not create a Google Cloud project, a hosted service signs you in with Google instead:
- Windsor.ai connects GA4 to Claude, ChatGPT, Gemini and Claude Code. Its page says GA4 through Windsor "is read-only, the same as Google's server". The free plan covers one data source, and paid plans start at $19 a month billed yearly.
- Stape offers a free GA4 MCP server that signs in with Google OAuth. It needs Node.js 18 or newer.
- Rillow reads Google Analytics next to Search Console, covered at the end of this guide.
A hosted server is also the only way to use Analytics data in claude.ai in the browser or in ChatGPT.
Quotas and data freshness
Google's server calls the GA4 Data API directly, so its limits are the API's. For a standard (free) GA4 property, the Data API quotas are:
| Quota | Standard property |
|---|---|
| Tokens per property per day | 200,000 |
| Tokens per property per hour | 40,000 |
| Tokens per project per property per hour | 14,000 |
| Requests at the same time, per property | 10 |
Google says "most requests will charge 10 or fewer tokens", so a normal conversation won't come close. An agent looping over hundreds of pages with large reports can.
Data also arrives in stages. For a standard property, Google lists realtime data in "a few minutes", intraday data in 2 to 6 hours and full daily data in 12 hours, and warns that "data processing can take 24-48 hours" (Analytics Help). So yesterday's numbers can still change. Ask your agent to leave out the last two days when it compares periods.
What to ask your agent
These prompts suit a small site that wants more traffic from search:
- "Which landing pages got the most sessions from organic search in the last 28 days, and how did that change from the 28 days before?"
- "How many sessions came from ChatGPT, Perplexity, Gemini or Claude last month, and which pages did they land on?"
- "Which blog posts get the most users but the fewest key events? Suggest one change to each."
- "Show the funnel from landing page to pricing page to sign-up for the last 30 days. Where do most people drop off?"
- "How many people are on the site right now, and on which pages?"
Then let the agent act in your site's code: add a clearer next step to the posts that get readers but no sign-ups, or rework the page people leave from.
Pair it with Search Console
Google Analytics shows what visitors did after they arrived. Search Console shows what they searched before they clicked, and the searches where you showed up but nobody clicked. An agent with both can connect a drop in sign-ups to the query that stopped sending visitors. Our Google Search Console MCP guide covers the Search Console side.
Where Rillow fits, and where it doesn't
Rillow is an SEO MCP server for Claude Code, claude.ai, Codex, Cursor and Gemini CLI. You connect Google Analytics and Search Console once in Rillow's settings by signing in with Google. There is no Google Cloud project, and Rillow asks Google for read-only access.
What your agent gets from Google Analytics through Rillow:
- get_performance returns the site's Analytics sessions and users for the last 28 days against the 28 before, next to Search Console clicks, impressions and position.
- get_performance for one post returns its visitors by week next to its Search Console clicks and its Google position for its keyword, checked every day.
Both are free and use no credits. Rillow saves each published post's Analytics visitors every night.
What it doesn't do: custom reports, funnels, realtime data, events or key events. For those, run Google's server next to Rillow. Your agent can use both at once.
The rest of Rillow is keyword research, competitors, a content plan, live Google results and post briefs. It starts free with 30 credits. Solo is $19 a month for one site and Pro is $49 a month for five (pricing).
Frequently asked questions
Yes. Google publishes it under the googleanalytics organization on GitHub and links to it from its Analytics developer site. In October 2026 the README still labels it Experimental.
Yes. The server is open source under the Apache 2.0 license, and Google doesn't charge for the GA4 Data API within its quotas. You pay only for the AI agent you already use.
No. Google says it is available for read requests only, and it signs in with the analytics.readonly scope. It can't create events, change key events or edit your property.
Yes, with Claude Code and the Claude desktop app, which can run a server on your computer. claude.ai in the browser can't, so it needs a hosted option such as Windsor.ai or Rillow.
Not directly, since ChatGPT can't run a server on your computer. Codex, OpenAI's coding agent, can run it, and hosted services such as Windsor.ai connect GA4 to ChatGPT.
For Google's own server, yes: it needs a project with the Analytics Admin API and Data API enabled, and an OAuth client to sign in with. Hosted services don't, because they sign you in with Google themselves.
No. It uses the GA4 Admin and Data APIs, so it reads GA4 properties only.
Realtime data shows up within minutes, and full daily data within about 12 hours for a standard property. Google warns that processing can take 24 to 48 hours, so the last day or two can still change.
Do your SEO from your AI agent
Your agent gets keyword data, live Google results and your rankings for every page it writes.
Rillow connects Claude Code, Codex, Cursor and claude.ai to your site's SEO data. Free to start with 30 credits.