Google Analytics MCP · 8 min read

Google Analytics MCP setup: how to install Google's analytics-mcp server

The five steps from Google's own README, with every command to copy: pipx, two Google Cloud APIs, gcloud credentials, then Claude Code or Gemini.

We get your business recommended by AI in 90 days, or your money back.
Book a free AI strategy call
We help you create your AI strategy plan, free.

Updated November 17, 2026 · By KKV Labs LLC

Short answer

Google Analytics MCP setup takes five steps from Google's README: install pipx, enable the Google Analytics Admin API and Data API in a Google Cloud project, create Application Default Credentials with gcloud and the analytics.readonly scope, then add the server to Claude Code with claude mcp add or to Gemini in settings.json. By default it runs on your own computer, and it reads Google Analytics only.

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:

Your own Google account
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_FILE

Or, if you use a service account, impersonate it:

Service account
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-platform

A 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 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-mcp

For Gemini CLI or Gemini Code Assist, add the server to the mcpServers list in ~/.gemini/settings.json:

~/.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 Code, macOS DNS fix
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-mcp

In 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.

Get your business recommended by AI in 90 days.

Book a free AI strategy call

Do this first

What to do this week.

Seven steps, all from Google's README. Write access stays off unless you add it.

  1. 01Install pipx
  2. 02Enable the Admin API and the Data API
  3. 03Create an OAuth client and download its JSON
  4. 04Run gcloud with the analytics.readonly scope
  5. 05Copy the credentials path and project ID
  6. 06Add the server to Claude Code or Gemini
  7. 07Check /mcp and ask a first question

Questions

The questions owners ask us about this.

Is Google's analytics-mcp server free?
Yes. analytics-mcp is open source and free. You do need a Google Cloud project to enable the two Google Analytics APIs it calls, and Google's API quotas apply.
Does analytics-mcp read Google Search Console?
No. Its README lists the Google Analytics Admin API and Data API only. For Search Console you need a separate server or a connector that reads both.
Can I use analytics-mcp with Claude?
Yes, in Claude Code, with the claude mcp add command in Google's README. The README does not cover the Claude Desktop app or claude.ai, which need a remote server with a sign in.
Can I use uv instead of pipx?
Google's README only documents pipx, with the command pipx run analytics-mcp. Using another runner is outside what Google documents.
Which Google scope does it need?
https://www.googleapis.com/auth/analytics.readonly for reading. Write tools also need https://www.googleapis.com/auth/analytics.edit and the --allow-write flag. Google's sample gcloud commands also include the cloud-platform scope.
Where is the code?
On GitHub at googleanalytics/google-analytics-mcp, and on PyPI as analytics-mcp.

Next step

Get your business recommended by AI in 90 days.

We run the questions your customers ask ChatGPT and Google AI Mode in your city and show you who gets recommended today. Then we fix the pages, listings and answers that decide it.

$999 a month, 3-month minimum, then month to month. If AI is not recommending you for 3 of your 5 questions by day 90, you get every dollar back.

Book a free AI strategy call

One business per industry per city. Founder led. Dated proof every 2 weeks.