What Google's analytics-mcp server is
analytics-mcp is Google's open source MCP server for Google Analytics 4. It lives on GitHub at googleanalytics/google-analytics-mcp and on PyPI as analytics-mcp (version 1.1.0, Python 3.10 or newer, on 17 November 2026). It is popular: about 36,845 downloads in the week to 17 November 2026, by PyPI's own count.
It uses the Google Analytics Admin API and Data API. Its read tools cover account summaries, property details, Google Ads links, annotations, key events, custom dimensions and metrics, and standard, funnel, conversions and realtime reports. Three write tools (create an annotation, a custom dimension or a key event) only work if you turn them on.
What you need before you start
A Google account that can see your GA4 property. A Google Cloud project you can enable APIs in. The gcloud command line tool. Python 3.10 or newer and pipx. An MCP client: Google's README covers Gemini CLI, Gemini Code Assist and Claude Code.
Step 1: Install pipx
The server runs through pipx, which runs a Python app in its own space without touching the rest of your Python. Follow the pipx install guide for your system. You do not install analytics-mcp yourself: the client runs pipx run analytics-mcp, which downloads it the first time.
Step 2: Enable two APIs in Google Cloud
In your Google Cloud project, enable both APIs. Each link opens the API's page in the Cloud console, where you pick the project and click Enable.
Note the project ID while you are there. You need it in step 4.
Step 3: Create Application Default Credentials
The server signs in to Google with Application Default Credentials (ADC). They must belong to a Google account that can see your Analytics properties, and they must include the read only scope https://www.googleapis.com/auth/analytics.readonly.
The usual way is your own Google account through an OAuth client. Create a desktop or web OAuth client in your project (how to create one), download its JSON file, then run this with your file name in place of YOUR_CLIENT_JSON_FILE:
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_FILEOr, if you use a service account, impersonate it:
gcloud auth application-default login \
--impersonate-service-account=SERVICE_ACCOUNT_EMAIL \
--scopes=https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platformA browser window opens for the Google sign in. When it finishes, gcloud prints Credentials saved to file: followed by a path. Copy that path. It is your PATH_TO_CREDENTIALS_JSON for the next step.
Step 4: Add the server to Claude Code or Gemini
For Claude Code, run this in your terminal with your own credentials path and project ID. --scope user makes the server available in all your projects on this machine.
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 Gemini CLI or Gemini Code Assist, add the server to the mcpServers list in ~/.gemini/settings.json:
{
"mcpServers": {
"analytics-mcp": {
"command": "pipx",
"args": ["run", "analytics-mcp"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
"GOOGLE_CLOUD_PROJECT": "YOUR_PROJECT_ID"
}
}
}
}Claude Desktop, claude.ai and ChatGPT
Google's README does not give a setup for the Claude Desktop app. claude.ai and ChatGPT need a remote server with a sign in, which the README describes as a multi tenant HTTP mode you host yourself, for example on Docker or Google Cloud Run.
Step 5: Check that it works
In Gemini, type /mcp and look for analytics-mcp in the list. In Claude Code, run claude mcp list in your terminal, or type /mcp inside Claude Code: the server should show as connected.
Then try the prompts Google suggests in its README:
- what can the analytics-mcp server do?
- Give me details about my Google Analytics property with 'xyz' in the name
- what are the most popular events in my Google Analytics property in the last 180 days?
- what are the custom dimensions and custom metrics in my property?
Write tools, and the edit scope
By default the server is read only. To let it create annotations, custom dimensions or key events, you need both the --allow-write flag and the scope https://www.googleapis.com/auth/analytics.edit added to the --scopes value of your gcloud login, which you then run again. Creating a custom dimension also needs the Editor role on the property, and creating a key event needs Marketer or Editor.
For Gemini, Google's README adds the flag to the args list: ["run", "analytics-mcp", "--allow-write"]. Leave write access off unless you need it.
If it does not connect
Google's troubleshooting guide lists one known issue on macOS: calls fail with an error like Failed to resolve analyticsadmin.googleapis.com, often on a VPN or split DNS. The fix is to make gRPC use the system DNS resolver. In Claude Code, add one more -e line:
claude mcp add analytics-mcp \
--scope user \
-e "GOOGLE_APPLICATION_CREDENTIALS=PATH_TO_CREDENTIALS_JSON" \
-e "GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID" \
-e "GRPC_DNS_RESOLVER=native" \
-- pipx run analytics-mcpIn Gemini, add "GRPC_DNS_RESOLVER": "native" to the env object. Google says to leave it unset unless you hit this exact error.
Most other problems come from the credentials: the wrong Google account in step 3, a missing analytics.readonly scope, or APIs enabled in a different project from the one in GOOGLE_CLOUD_PROJECT. Run the gcloud login again with the right account and check the project ID.
Or skip the setup
If you would rather not run a Google Cloud project, gcloud and pipx, Site Insights by KKV Labs is a hosted connector we built for this: paste one link into Claude or ChatGPT, sign in with Google, and ask. It reads Search Console as well as GA4 and is built for many sites. It is read only and free for one site.
How it compares with Google's server is answered in one place, the product page FAQ: How is this different from Google's own GA4 MCP server?. To connect it, follow how to connect Google Analytics to Claude.
Method. Every step, command and limit here was read on 17 November 2026 from Google's analytics-mcp README (last changed 5 November 2026) and troubleshooting guide on GitHub, and from PyPI (version 1.1.0). Claude Code details are from Anthropic's Claude Code MCP documentation, read the same day. If Google changes the README, its version wins.