How to connect Google Analytics to Claude with MCP

ReplaStats guide card: Connect Google Analytics to Claude. Google's MCP server set up step by step, and the route without a Cloud project.

Google publishes an official Google Analytics MCP server, and it lets Claude read your GA4 data. It runs on your own computer, it is read-only, and Google still labels it experimental. To set it up you need a Google Cloud project with two Analytics APIs switched on, read-only credentials from gcloud, and pipx to run it. Plan on fifteen to thirty minutes the first time.

Below: what the server can do, the setup in order, the traps that catch people, the community alternatives, and a shorter route if your sites run on ReplaStats. Everything here is from Google’s repository and developer docs, checked on 2 October 2026.

What Google’s server can do

The package is analytics-mcp (version 0.7.0, July 2026), Apache-2.0 licensed, from the googleanalytics/google-analytics-mcp repository. The README lists seven tools; the code has nine:

ToolWhat it returns
get_account_summariesYour Analytics accounts and the properties in each
get_property_detailsSettings for one property
list_google_ads_linksGoogle Ads accounts linked to a property
list_property_annotationsAnnotations on a property (not in the README)
get_custom_dimensions_and_metricsThe custom dimensions and metrics a property defines
run_reportA standard report through the Data API
run_realtime_reportActivity from the last 30 minutes
run_funnel_reportA funnel report (alpha API)
run_conversions_reportA conversions report (alpha API, not in the README)
From the repository’s source code, 2 October 2026. All of them read; none of them change anything.

Before you start

  • Python 3.10 or newer, and pipx.
  • The Google Cloud CLI (gcloud).
  • A Google Cloud project you can switch APIs on in.
  • A Google account that can see the GA4 property, or a service account you add to it.
  • An MCP client that runs local servers: Claude Code or Gemini CLI are the ones Google documents.

Setting it up, step by step

  1. Install pipx, if you don’t have it.
  2. Switch on two APIs in your Cloud project: the Google Analytics Admin API and the Google Analytics Data API.
  3. Make credentials. Either create an OAuth client for a desktop app and download its JSON file, or create a service account and add its email to your GA4 property as a Viewer.
  4. Log in with read-only scopes through Application Default Credentials. With an OAuth client:
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

With a service account, swap --client-id-file for --impersonate-service-account=SERVICE_ACCOUNT_EMAIL. Either way, gcloud prints the path of the credentials file it saved. Copy it.

  1. Add the server to Claude Code with your credentials path and project ID:
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
  1. Check it is there: type /mcp in Claude Code, then ask something like “how many users did my site have last week?”

For Gemini CLI, Google documents the same server as an mcpServers entry in ~/.gemini/settings.json, with pipx as the command and ["run", "analytics-mcp"] as the arguments. Google does not document Claude Desktop; the same JSON should work in its config file, but desktop apps often can’t find pipx on their PATH, so give the full path to it.

The traps

  • The package name. Run pipx run analytics-mcp. A different, community-made package on PyPI is called google-analytics-mcp, so the obvious guess runs someone else’s code.
  • The project variable. The README’s examples set GOOGLE_PROJECT_ID. Google’s client libraries read GOOGLE_CLOUD_PROJECT, and a pull request (#207) to correct the README is open, so set that one.
  • Weekly logins. If your OAuth app is still in Google’s “Testing” status, its refresh tokens expire after seven days and you log in again. Publishing the app, or using a service account, avoids it.
  • Quotas. A standard GA4 property gets 200,000 Core tokens a day and 40,000 an hour, 14,000 per Cloud project per hour, and 10 requests at once. Long chats with many reports can reach them.
  • Local only. It runs on your machine, so it doesn’t work in Claude on the web or on your phone.

Community servers

ServerCredentialsRead-only?Note
kLOsk/adloopYour own OAuth client or a service accountNoCan make changes in Google Ads and GA4
surendranb/google-analytics-mcpService account JSONYesSends usage telemetry unless you turn it off
ruchernchong/mcp-server-google-analyticsService accountYesArchived
From each repository on GitHub, 2 October 2026.

The shorter route, if your sites run on ReplaStats

ReplaStats has its own MCP server. It is a single file with no dependencies: you run it with Node 18 or newer and give it your ReplaStats address and API key. There’s no Cloud project, no APIs to switch on and no OAuth. It answers across every site on your account at once, whatever each one is built on. It reads ReplaStats’ own numbers, not Google Analytics.

Google’s serverReplaStats’ server
What it readsGA4, through Google’s Admin and Data APIsYour ReplaStats sites
What you needA Cloud project, two APIs, an OAuth client or service account, pipxNode 18 and your ReplaStats API key
ToolsNine, including realtime and funnelsSix: list_sites, get_stats, compare_sites, get_timeseries, get_active_visitors, get_breakdown
Read-onlyYesYes
ClientsClaude Code and Gemini CLI documentedClaude Desktop and Claude Code
CostFree software, limited by Google’s quotasIncluded with ReplaStats Pro ($19 a month) and Agency ($49)

Ask Claude about every site you run. ReplaStats counts visitors on WordPress, Shopify, Webflow or your own code with one line, no cookies and no consent banner, and puts every site side by side on one board. Pro and Agency come with the Claude connection.

Questions people ask

Is there an official Google Analytics MCP server?

Yes. Google publishes one on GitHub at googleanalytics/google-analytics-mcp, installed as the analytics-mcp package. Google marks it experimental.

Can Claude change my Google Analytics settings through it?

No. It asks for the analytics.readonly scope and only calls read methods, so it can report on your data but cannot change anything.

Does it work with Claude Desktop?

Google documents Claude Code and Gemini CLI. The same configuration should work in Claude Desktop’s config file, with the full path to pipx. It does not work in Claude on the web or on a phone, because the server runs on your own computer.

How much data can Claude pull from Google Analytics?

As much as Google’s quotas allow: for a standard property, 200,000 Core tokens a day and 40,000 an hour, with 10 requests at once. Analytics 360 properties get ten times as much.

What is the difference between Google’s server and ReplaStats’ MCP?

Google’s reads GA4 through Google’s APIs and needs a Cloud project and credentials. ReplaStats’ reads your ReplaStats sites with one API key and comes with the Pro and Agency plans. It does not read Google Analytics.

Sources: the googleanalytics/google-analytics-mcp repository and its PyPI page, Google’s Analytics Data API quota documentation, and each community repository, all checked on 2 October 2026. See also: a Google Analytics alternative without the cookie banner and installing ReplaStats on any website.