A plain-text version of this site for AI assistants is at https://contengi.com/llms.txt, with the full product documentation in one file at https://contengi.com/llms-full.txt. Every page is also available as markdown by adding .md to its URL.

Stefan Maritz··7 min read

Google Analytics MCP: what Google's official GA4 server does, how to set it up, and what to ask it

GA4 is a well-stocked kitchen with every drawer labelled in Latin, and the Google Analytics MCP lets you ask for the whisk by name.

A plain-text version of this site for AI assistants is at https://contengi.com/llms.txt, with the full product documentation in one file at https://contengi.com/llms-full.txt. Every page is also available as markdown by adding .md to its URL.

TL;DR

  • The Google Analytics MCP server is Google's own open-source connector that lets an AI assistant such as Claude, Gemini, or Cursor run GA4 reports and read property settings in plain English.
  • It's read-only by default and uses the Google Analytics Admin API and Data API, with optional write tools for annotations, custom dimensions, and key events behind an --allow-write flag.
  • Setup needs Python 3.10 or higher, pipx or uv, both Analytics APIs switched on in a Google Cloud project, and at least Viewer access on the GA4 property.
  • The errors you'll hit are predictable: a missing quota project, relative credential paths, and desktop apps that can't find pipx on their PATH.
  • Pair it with a Search Console MCP and you can follow a query from the search result to the sign-up in one conversation.

GA4 is a well-stocked kitchen with every drawer labelled in Latin. The ingredients are all there, and finding the whisk takes 20 minutes. The Google Analytics MCP server lets you ask for the whisk by name, so "which blog posts brought in sign-ups last month?" gets an answer instead of an exploration report.

This post covers what Google's official server does, how to set it up with Claude, the mistakes that stop it working, and the questions worth asking once it runs. For the wider set of servers, see the guide to SEO MCP servers in 2026.

What is the Google Analytics MCP server?

The Google Analytics MCP server is an open-source MCP server from Google Analytics, licensed under Apache 2.0, that connects GA4 data to AI assistants through the Model Context Protocol. It wraps the Admin API for account and property details and the Data API for reports, so the AI can query your data instead of guessing at it.

By default, the MCP server handles read-only requests and can't modify your Google Analytics settings unless you turn on the write tools yourself. Google Analytics sits on Google's official list of MCP servers and Search Console doesn't, which is why the two need different setups. If MCP is new to you, here's what MCP is and how it works.

What can the Google Analytics MCP do?

It exposes a small, sensible set of tools, grouped below by the job they do.

ToolWhat it doesAsk it something like
get_account_summaries, get_property_detailsLists your accounts and properties and returns their settings"Which GA4 properties can I access?"
run_reportRuns a standard GA4 report through the Data API"Sessions and key events by landing page, last 28 days"
run_realtime_reportShows what is happening on the site right now"How many people are on the site after this morning's newsletter?"
run_funnel_reportRuns a funnel exploration"Where do visitors drop between the pricing page and checkout?"
run_conversions_reportReports ad costs, conversions, ROAS, and attribution"Which channel drove the most trial sign-ups?"
get_custom_dimensions_and_metrics, list_google_ads_links, list_property_annotationsReads how the property is configured"What custom dimensions do we track?"

The write tools are create_property_annotation, create_custom_dimension, and create_key_event. Each of them need the --allow-write flag and the analytics.edit scope, and the last two also need Editor or Marketer access on the property.

How do you set up the Google Analytics MCP with Claude?

Plan for 30 to 60 minutes the first time. Most of it is Google Cloud admin, and the MCP part is a few lines of config.

  1. Install Python 3.10 or higher and pipx or uv. The server runs from PyPI as analytics-mcp, so you never clone anything.
  2. Enable two APIs in a Google Cloud project. Switch on the Google Analytics Admin API and the Google Analytics Data API in the same project.
  3. Grant property access. Give your Google user or service account at least the Viewer role on the GA4 property.
  4. Create credentials. Run gcloud auth application-default login with the analytics.readonly and cloud-platform scopes, then copy the credentials path it prints.
  5. Add the server to Claude. In Claude Desktop, add analytics-mcp to claude_desktop_config.json with your credentials path and project ID. In Claude Code, one claude mcp add command does the same job.
  6. Restart and test. Ask "what can the analytics-mcp server do?" and check the tool list comes back.

If the terminal isn't your natural habitat, start with Claude Code for marketers before the claude mcp add step.

Why isn't my Google Analytics MCP working?

These are the three errors to expect, and each has a one-line fix.

  • 403 ACCESS_NOT_CONFIGURED or a missing quota project: user credentials need a quota project with the Analytics APIs enabled, so set GOOGLE_CLOUD_PROJECT in the server's env block.
  • 401 or credentials file not found: use an absolute path for GOOGLE_APPLICATION_CREDENTIALS, because many MCP hosts don't expand ~ or $HOME inside JSON config files.
  • spawn pipx ENOENT or "command not found": desktop apps such as Claude Desktop and Cursor often don't inherit your shell PATH, so replace "pipx" with the full path from which pipx.

A 403 PERMISSION_DENIED usually means the account has no Viewer role on the property, or one of the two APIs is still switched off.

What should you ask a Google Analytics MCP?

The best GA4 questions are about outcomes, because Search Console already tells you about clicks. Start with these.

  1. Content that converts. "Which blog posts were the landing page for sessions that ended in a key event last month?"
  2. Traffic that bounces. "Which landing pages have high sessions and low engagement time?" Those pages earn the click and lose the reader.
  3. Channel mix. "Compare organic search, referral, and email sessions and key events, this month against last."
  4. Launch checks. "Run a realtime report for the new pricing page." It's the fastest way to confirm a launch is live and tracked.
  5. Configuration audit. "List our key events and custom dimensions and flag anything that looks unused."

The bigger payoff comes from joining GA4 with search data. Connect a Google Search Console MCP alongside it and one question covers the whole path: which queries bring people to a page, and whether those people sign up. Contengi's marketing assistant reads Search Console and GA4 together for this reason, and it's the quickest route to measuring content marketing ROI without a spreadsheet marathon.

Checklist: GA4 in your AI this week

  1. Use a dedicated Google Cloud project. Keep the Analytics APIs and the quota project in one place so troubleshooting stays simple.
  2. Stay read-only for the first month. Add --allow-write only when you have a specific annotation or key event you want the AI to create.
  3. Check one number against the GA4 interface. Ask for last month's sessions and compare before you trust the trend lines.
  4. Save three outcome questions. Content that converts, pages that bounce, and channel mix cover most weekly reporting.
  5. Connect Search Console next. GA4 tells you what happened after the click, Search Console tells you what happened before it.

Frequently asked questions

Does Google Analytics have an official MCP server?

Yes. Google Analytics publishes an official, open-source MCP server on GitHub that connects GA4 to AI assistants through the Admin API and Data API. It's read-only unless you enable the write tools.

Can the Google Analytics MCP change my GA4 settings?

Not by default. Write tools for annotations, custom dimensions, and key events only switch on with the --allow-write flag and the analytics.edit scope.

Does the Google Analytics MCP work with Claude?

Yes. It runs in Claude Desktop and Claude Code, as well as Cursor and Google's own Gemini and Antigravity tools.

Is the Google Analytics MCP free?

Yes. The server is open source under Apache 2.0, and it runs on the Google Analytics APIs in your own Google Cloud project.

Can I host the Google Analytics MCP for a team?

Yes. The server can run as a multi-tenant HTTP service where each person signs in with their own Google account, and the repository includes a Dockerfile for Google Cloud Run.

Content like this, in your own voice

The workflows behind this blog run inside Contengi. A strategist sets up your knowledge base, and the agents write to your rules.