How to get started with Google Analytics MCP

Google Analytics MCP setup guide: connect GA4 to AI, run natural-language queries, and pull actionable insights to optimize campaigns fast.

How to get started with Google Analytics MCP
Free pipeline audit

Pipeline,
not promises.

Senior operators audit your funnel in 48 hours. Ship 3 specific moves in 30 days.

$60M+
Ad spend managed
4.9/5
on G2 · 300+ teams
  • Full-funnel audit · 4 velocity levers
  • 3 wins to ship in 30 days
  • $3K flat · month-to-month

30-min call · No commitment

★★★★★ Trusted by PriceLabs, Trackxi, Rocketlane & 300+ B2B teams
Last Updated:

How to Get Started With the Google Analytics MCP Server

There are two ways to connect GA4 to an AI assistant, and the right one depends entirely on whether you are comfortable with a terminal.

Google’s official Google Analytics MCP server is free, open source and runs on your own machine. It needs Python, pipx, a Google Cloud project and a few gcloud commands. If that sentence was fine, use it.

A managed connector does the same job through a browser sign-in and an API key, with no terminal at all. If that sentence was not fine, use one of those instead.

Both are read only. Google states this plainly: the MCP server “is available for read requests only. It can’t edit your Google Analytics configuration or settings.” Nothing you do here can break your analytics.

Quick answer

Official Google serverManaged connector
CostFree, open sourceFree tier available
Setup time20 to 40 minutes if the tooling is new to youAbout 5 minutes
Needs a terminalYesNo
Needs a Google Cloud projectYesNo
Runs whereYour machineHosted
Data accessRead onlyRead only
Other platformsGA4 onlyUsually bundles Google Ads, Search Console and others
Best forAnalysts, developers, anyone who wants full controlMarketers who want answers today

Key takeaways

  • The official server is at the googleanalytics/google-analytics-mcp repository and installs with pipx.
  • You must enable two APIs in Google Cloud: the Google Analytics Admin API and the Google Analytics Data API. Missing the Admin API is the most common setup failure.
  • Your credentials need the scope https://www.googleapis.com/auth/analytics.readonly.
  • The server exposes seven tools, covering account discovery, standard reports, funnel reports, real-time reports and custom dimensions.
  • It is read only by design, so it cannot change your GA4 configuration, your tags or your data.
  • The quality of what you get back depends almost entirely on how you ask. Vague questions produce vague answers.

Route A: the official Google Analytics MCP server

What you need first

  • Python 3.10 or newer
  • pipx installed
  • A Google Cloud project
  • Access to the GA4 property you want to query

Step 1: Enable the two APIs

In your Google Cloud project, enable both of these. One is not enough.

  1. Google Analytics Admin API, which handles account and property discovery
  2. Google Analytics Data API, which handles the actual reports

If you only enable the Data API, the assistant will connect but will not be able to find your properties, which looks like a broken install.

Step 2: Set up credentials

The server uses Application Default Credentials, and those credentials must carry the Analytics read-only scope. There are two supported approaches.

Using an OAuth client file, run: 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

Using service account impersonation, run: 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

Replace the placeholders with your own client JSON path or service account email. For most individual users the first option is simpler. Use the second if your organisation manages access through service accounts.

Step 3: Add the server to your AI client

For Claude Code, one command does it: claude mcp add analytics-mcp --scope user -e "GOOGLE_APPLICATION_CREDENTIALS=PATH_TO_CREDENTIALS_JSON" -e "GOOGLE_PROJECT_ID=YOUR_PROJECT_ID" -- pipx run analytics-mcp

For Gemini CLI, edit ~/.gemini/settings.json and add an entry under mcpServers. The fields are:

FieldValue
Server nameanalytics-mcp
commandpipx
args["run", "analytics-mcp"]
env → GOOGLE_APPLICATION_CREDENTIALSthe full path to your credentials JSON file
env → GOOGLE_PROJECT_IDyour Google Cloud project ID

As a single line, that entry is: {"mcpServers":{"analytics-mcp":{"command":"pipx","args":["run","analytics-mcp"],"env":{"GOOGLE_APPLICATION_CREDENTIALS":"PATH_TO_CREDENTIALS_JSON","GOOGLE_PROJECT_ID":"YOUR_PROJECT_ID"}}}}

Other MCP clients that accept a JSON config use the same structure. The command is always pipx and the argument is always run analytics-mcp.

Step 4: Confirm it works

Restart your client, then ask it to list your Google Analytics accounts. If it comes back with your properties, you are connected. If it connects but finds nothing, go back to step 1 and check the Admin API.

The seven tools, and what each is for

Knowing these helps you ask better questions, because you are effectively asking the assistant to choose one.

ToolWhat it doesAsk it for
get_account_summariesLists the accounts and properties you can access”Which GA4 properties can you see?”
get_property_detailsReturns detail about one propertyTimezone, currency, industry settings
list_google_ads_linksLists linked Google Ads accountsChecking whether the Ads link is live
run_reportRuns a standard GA4 reportAlmost everything: traffic, conversions, landing pages
run_funnel_reportRuns a funnel reportStep-by-step drop-off through a defined journey
run_realtime_reportRuns a real-time reportWhat is happening right now
get_custom_dimensions_and_metricsLists your custom definitionsFinding out what custom data you actually have

All seven hit read-only Google Analytics APIs.

Route B: the managed connector

If the terminal steps above are not how you want to spend your afternoon, a hosted connector gets you to the same place faster. Ours works like this:

  1. Enter your work email to get login details
  2. Sign in with Google and authorise one GA4 property. Viewer access is enough
  3. Pick your client, which can be the Claude Desktop extension, a custom connector, a Claude Code command or a standard MCP config, and paste your API key
  4. Start asking questions

It is free to start, and the basic tier also covers Google Ads, Search Console, LinkedIn Ads, Microsoft Advertising and HubSpot, which matters if your real questions span more than one platform. Like the official server, it reads your data and recommends changes. You make the changes yourself in GA4 or Tag Manager.

The honest trade-off: the official server gives you full control and no third party in the chain. A managed connector saves setup time and usually bundles other data sources. Neither is better in the abstract.

What to actually ask it

This is where most people get disappointed, and it is almost always a prompting problem rather than a tooling problem. The assistant has to turn your question into a report request, so vague inputs produce vague reports.

Weak promptBetter prompt
”How is my traffic?""Compare sessions and conversions by default channel group for the last 28 days against the previous 28 days, and flag any channel that moved more than 20 percent"
"Why did conversions drop?""Conversions fell in the last two weeks. Break down conversions by channel, landing page and device for that period versus the prior two weeks, and tell me which segment accounts for most of the decline"
"Show me my best pages""List the top 20 landing pages by sessions for last month with their conversion rate, and highlight any with above-median sessions and below-median conversion rate"
"Is my tracking OK?""List my custom dimensions and metrics, then check whether any key events recorded zero conversions in the last 30 days”

Three rules that improve almost any prompt here:

  1. Always give a date range and a comparison period. Without one you get a number with no context.
  2. Name the dimension you want it broken down by. Channel, landing page, device, country. This is what turns a number into a diagnosis.
  3. Ask for the finding, not just the data. Ending with “and tell me which segment explains most of the change” is the difference between a table and an answer.

For B2B SaaS specifically, the highest value questions are usually about the gap between traffic and pipeline: which landing pages pull traffic but no conversions, which channels send sessions that never reach a key event, and where the funnel report shows the steepest drop.

Troubleshooting

SymptomLikely causeFix
Connects, but no properties foundOnly the Data API is enabledEnable the Google Analytics Admin API too
Permission or scope errorsCredentials missing the Analytics scopeRe-run the auth command including https://www.googleapis.com/auth/analytics.readonly
Server does not appear in the clientConfig in the wrong file or client not restartedCheck the path, then fully restart the client
pipx not foundpipx not installed or not on PATHInstall pipx, then open a new terminal
Works for one property, not anotherYour Google account lacks access to that propertyGrant at least Viewer on that property in GA4
Numbers differ slightly from the GA4 UISampling, date range or timezone differencesSpecify the property timezone and exact dates in your prompt

Limits worth knowing

  • Read only. It cannot change settings, create conversions or edit tags. That is a design decision by Google, not a gap.
  • It does not know your business. It can tell you organic traffic fell 18 percent. It cannot tell you that you deindexed a section last month. Give it that context in the prompt.
  • GA4 data limits still apply. Sampling, cardinality limits and the data retention window apply exactly as they do in the interface, because it is the same API underneath.
  • The official server is GA4 only. Cross-platform questions need either several MCP servers connected at once or a connector that bundles them.
  • It runs locally on route A. If your laptop is off, so is the server.

Frequently Asked Questions

Q1. What is the Google Analytics MCP server?

It is an official, open-source server from Google that lets an AI assistant query your GA4 data through the Model Context Protocol. You ask questions in plain language and it runs the corresponding Analytics API reports and returns the results.

Q2. Is the Google Analytics MCP server free?

Yes. The official server is free and open source, and you run it yourself. You need a Google Cloud project for credentials, but the Analytics APIs it uses are free at normal usage levels. Managed connectors generally offer a free tier as well.

Q3. Can it change anything in my GA4 account?

No. Google states that the server is for read requests only and cannot edit your Google Analytics configuration or settings. It can tell you what to change; you make the change yourself.

Q4. What do I need before I start?

Python 3.10 or newer, pipx, a Google Cloud project with the Google Analytics Admin API and Data API enabled, credentials carrying the analytics.readonly scope, and at least Viewer access to the GA4 property.

Q5. Which APIs do I have to enable?

Both the Google Analytics Admin API and the Google Analytics Data API. The Admin API handles finding your accounts and properties, the Data API runs the reports. Enabling only one is the most common reason a setup appears broken.

Q6. Does it work with Claude Desktop, or only Gemini?

It works with any MCP-compatible client. The repository documents a one-line install for Claude Code and a JSON entry for Gemini CLI, and other clients that accept a standard MCP config use the same structure, with pipx as the command and run analytics-mcp as the argument.

Q7. What can it actually tell me?

Anything the GA4 reporting APIs expose: traffic by channel, landing page performance, conversion and key event data, funnel drop-off, real-time activity, your custom dimensions and metrics, and which Google Ads accounts are linked. The useful part is that it can do several of those in one go and then reason across them.

Q8. Why are my numbers slightly different from the GA4 interface?

Usually a timezone, date range or sampling difference. The server queries the same APIs the interface uses, so large discrepancies normally mean the question was interpreted with a different date range than you assumed. State the exact dates and the property timezone in your prompt.

Q9. Can I connect more than one GA4 property?

The official server works with whichever properties your credentials can access, so you can ask about several, though you should name the property explicitly to avoid ambiguity. Managed connectors often authorise one property per key, so check before you assume.

Q10. Do I need to know GA4’s API to use it?

No, but knowing roughly which report your question implies makes a big difference. Asking for a specific dimension breakdown and a comparison period consistently produces better answers than open-ended questions.

Q11. Is it safe to connect my analytics data to an AI assistant?

The connection is read only and uses your own Google credentials with a read-only scope, so it cannot alter anything. The real consideration is that your analytics data passes through whichever AI assistant you use, so apply the same judgement you would when pasting data into that tool.

Q12. Should I use the official server or a managed connector?

Use the official server if you are comfortable with the terminal and want full control with nothing in between. Use a managed connector if you want it working in minutes, or if your questions span GA4 plus Google Ads, Search Console or your CRM, since a bundled connector answers those in one place.


Want this connected without the terminal?

Our Google Analytics MCP connects in about five minutes with a Google sign-in, and the same plan covers Google Ads, Search Console, LinkedIn Ads, Microsoft Advertising and HubSpot, so you can ask questions that cross platforms rather than one at a time.

Book a free demo →



Sources


About the author

Ishan Manchanda is Co-Founder at GrowthSpree, a B2B SaaS marketing agency and Google Partner and HubSpot Solutions Partner rated 4.9 on G2. GrowthSpree manages $60M+ in B2B SaaS ad spend across 300+ accounts.

Ishan Manchanda

Ishan Manchanda

Turning Clicks into Pipeline for B2B SaaS · Founder, GrowthSpree