Analytics and tracking
Connect Claude to GA4 with the Google Analytics MCP Server
Updated · 7 min read

The short answer
To connect Claude to GA4, run Google's open-source analytics-mcp server locally. Enable the Analytics Admin and Data APIs in a Google Cloud project, log in with Application Default Credentials using read-only scope, then add the server to Claude Desktop's config file. It only reads data, and it needs Python, pipx and the gcloud CLI.
The Google Analytics MCP server lets an AI assistant such as Claude query your GA4 (Google Analytics 4) data in plain language. Instead of building a report in the GA4 interface, you ask "which channels drove the most purchases last month?" and Claude fetches the numbers through Google's APIs.
This guide covers the established setup, what you need beforehand, what the server can and cannot do, and the alternatives. If MCP itself is new to you, start with What Is MCP? A Plain-English Guide for E-commerce Merchants.
What is the Google Analytics MCP server?
MCP (Model Context Protocol) is an open standard for connecting AI assistants to external tools and data. An MCP server exposes tools, and an MCP client (Claude, in this case) calls them.
Google publishes an open-source server called the Google Analytics MCP Server, still labelled "Experimental" in its repository. Key facts from Google's documentation and repository:
- It runs locally on your computer and talks to the Google Analytics Admin API and Data API.
- It is read-only. Google states it cannot edit your Analytics configuration or settings.
- It is free under the Apache-2.0 licence. Requests count against your GA Data API quotas.
- The package is called
analytics-mcpand is started withpipx run analytics-mcp.
One caveat: Google's own documentation focuses on Gemini CLI and Gemini Code Assist, and lists Claude Code as a supported client in some third-party summaries. Claude Desktop setups are described mostly in third-party guides. The method below works by the same MCP rules, but verify details against the current README.
What can Claude do with it?
The tool list has grown over time, and guides disagree on the count (seven to nine). Check the current README before relying on a number. The core tools are:
| Area | Tools (as listed in the README) |
|---|---|
| Account and property info | get_account_summaries, get_property_details, list_google_ads_links |
| Standard reports | run_report, get_custom_dimensions_and_metrics |
| Funnels | run_funnel_report |
| Realtime | run_realtime_report |
In practice, Claude can list the properties you have access to, pull sessions, users, transactions and revenue by dimension (channel, country, landing page, device), run funnel reports, and check which custom dimensions exist.
What do you need before you start?
Guides agree on this checklist:
- Python and pipx, a tool that runs Python programs in isolated environments.
- The gcloud CLI, Google Cloud's command-line tool, used to log in.
- A Google Cloud project with two APIs enabled: Google Analytics Admin API (
analyticsadmin.googleapis.com) and Google Analytics Data API (analyticsdata.googleapis.com). - An OAuth client of type "Desktop app", created in that project.
- Access to the GA4 property for the Google account you log in with. A service account also works if it has been granted Viewer access on the property.
If you are not comfortable with a terminal, ask a developer or your agency to do the setup. It is a one-time job of roughly half an hour for someone who has done it before.
How do you set it up step by step?
1. Enable the APIs
In the Google Cloud console, create or choose a project and enable the Analytics Admin API and the Analytics Data API. Note the project ID.
2. Create the OAuth client
In the same project, create an OAuth client ID of type Desktop app and download the client JSON file. You may need to configure the OAuth consent screen first.
3. Log in with Application Default Credentials
Application Default Credentials (ADC) is Google's standard way for local programs to find your login. Run gcloud auth application-default login with the read-only Analytics scope (analytics.readonly) and your OAuth client file. Copy the exact command and flags from the README, since they change more often than the concept. The login creates a credentials file. Note its full path.
4. Add the server to Claude Desktop
Open Claude Desktop, go to Settings > Developer > Edit Config. This opens claude_desktop_config.json (on Mac: ~/Library/Application Support/Claude/claude_desktop_config.json). Add an entry along these lines:
{
"mcpServers": {
"analytics-mcp": {
"command": "pipx",
"args": ["run", "analytics-mcp"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/full/path/to/credentials.json",
"GOOGLE_PROJECT_ID": "your-project-id"
}
}
}
}
Every client needs the same three things: the command, the full path to the credentials file, and the project ID. On Windows, double the backslashes in paths. If Claude cannot find pipx, use its full path as the command.
5. Restart and test
Restart Claude Desktop. Start a chat and ask: "List my Google Analytics accounts and properties." If the server is connected, Claude calls get_account_summaries and returns your properties.
Using Claude Code instead
Claude Code is configured with a claude mcp add command. Google's README contains the one-liner; copy it from there rather than from a blog post, because options change.
Which questions work well, and which do not?
Good first prompts for a store:
- "Compare sessions and purchases by channel for the last 28 days against the previous 28."
- "Which landing pages have the most sessions and the lowest purchase rate?"
- "Run a funnel report from view_item to add_to_cart to purchase."
- "What is happening on the site right now?" (realtime)
Treat the answers as a draft to check, not as a finished analysis. Claude can pick the wrong metric, mix up date ranges, or summarise sampled or thresholded data too confidently. For anything that drives spend, open the same report in GA4 and compare.
What are the limits and risks?
- Local only. A server set up in
claude_desktop_config.jsonruns on your machine. It is not available on claude.ai or in Cowork. Your computer needs to be on and logged in. - One identity. The server acts as whatever identity ADC resolves to on that machine. It does not do per-user OAuth, so it is a poor fit for sharing between several analysts.
- Read-only. That is a safety feature, but it means no creating events, audiences or conversions through this server.
- Experimental. Expect changes. Pin your expectations, not just the version, and re-check the README after updates.
- Data goes to the model. Whatever Claude retrieves is sent to Anthropic as part of your conversation. Check your company's data policy, especially if you export reports containing user-level or personal data.
- GA4 is not profit. GA4 reports revenue and conversions. It does not know your margins, returns or ad costs per product unless you import them. Closing that gap takes a separate layer: server-side tracking that sends profit to ad platforms, and product-level profit analytics.
Is there a hosted Google endpoint for GA4?
This part is unsettled. Google has a reference page for a remote Data API MCP endpoint at https://analyticsdata.googleapis.com/mcp/v1, listing four tools: run_report, get_metadata, run_realtime_report and check_compatibility. It requires enabling the MCP server and configuring authentication first.
However:
- A hosted-connector vendor, Windsor.ai, tested it on 30 September 2026. It answered the MCP handshake and refused calls without a Google OAuth token. They had not completed a connection from Claude.
- Other third-party write-ups say Google has no hosted Analytics endpoint, and that Analytics does not appear in Google's remote MCP server list.
- Claude's custom connectors need an OAuth flow, and this endpoint expects you to bring your own OAuth client. I found no confirmation that this works in Claude.
Treat it as unverified for Claude. Check Google's current English documentation before planning around it. It also covers reporting only, with no Admin API tools such as property listing.
What are the alternatives to Google's server?
Several third-party options exist. None are Google-official, so review who runs them and what access they request.
- Stape's hosted GA4 MCP (
https://mcp-google-analytics.stape.io/mcp) works as a Claude custom connector with Google sign-in. Its wording suggests it may be able to modify properties, which differs from Google's read-only server. Verify this with Stape. - Windsor.ai offers a hosted connector that works with Claude, ChatGPT and Gemini.
- Community packages, such as
ruchernchong/mcp-server-google-analytics, use a service-account key. - CData sells a local installer for Claude Desktop.
For remote servers, Claude connects from Anthropic's cloud, so the server must be publicly reachable. In current Claude versions you add one under Customize > Connectors > Add > Custom > Web. Older guides say Settings > Connectors, so the menu has moved. Anthropic warns that custom connectors reach services it has not verified, so connect only to organisations you trust and read the permissions on the Google consent screen.
Google Analytics also did not appear in Claude's connector directory according to mid-2026 third-party reports. Check the directory yourself, because that can change.
How does this fit with the rest of your stack?
GA4 is one data source. Ads data sits elsewhere. If you also want Claude to read campaign performance, see Connect Claude to Google Ads with the Google Ads MCP Server. Using both lets you ask questions across the two, though you must reconcile their differing attribution yourself.
Start with a test property or a low-stakes store, keep access read-only, and verify the first ten answers against the GA4 interface before trusting the setup.
Frequently asked questions
+Is the Google Analytics MCP server free?
Yes. Google's server is open source under the Apache-2.0 licence and costs nothing to run. Its requests count against your Google Analytics Data API quotas, and you need a Google Cloud project, though basic API use for reporting is generally not billed. Check current quota and pricing in Google's documentation. Hosted third-party connectors may charge.
+Can the Google Analytics MCP server change my GA4 settings?
No. Google states the server is read-only and cannot edit your Analytics configuration or settings. It reads reports and property details only. Third-party servers may differ, and Stape's wording suggests its hosted version might be able to modify properties, so check each vendor's permissions before connecting.
+Does the Google Analytics MCP server work on claude.ai?
Not the local version. Servers configured in claude_desktop_config.json run on your computer and are not available on claude.ai or in Cowork. For the web app you need a remote server added as a custom connector, which must be reachable over the public internet and support OAuth sign-in.
+Why does Claude say it cannot find my GA4 properties?
Usual causes are that the Admin API or Data API is not enabled in the Google Cloud project, the credentials path in the config is wrong, or the Google account you logged in with has no access to the property. Also confirm the project ID, restart Claude Desktop, and check Windows path backslashes.
+Can several people on my team share one setup?
Not well. The server acts as whichever identity Application Default Credentials resolves to on the machine running it and does not do per-user OAuth. Each analyst should run their own local setup with their own login, or you should evaluate a hosted connector with per-user sign-in.
+Can I trust the numbers Claude reports from GA4?
Use them as a starting point. Claude can choose the wrong metric, misread date ranges or overstate conclusions from sampled or thresholded data. For decisions involving budget, compare the answer with the same report in the GA4 interface, especially during the first weeks of using the connection.
Sources
- Try the Google Analytics MCP server (Google)
- google-analytics-mcp repository
- Model Context Protocol documentation
- Rybbit: Google Analytics MCP guide
- Scalekit: Google Analytics MCP vs API
- Windsor.ai: Google Analytics MCP
- Stape: MCP server for Google Analytics
- Claude Help: Get started with custom connectors using remote MCP
- Claude Help: Use connectors to extend Claude's capabilities
Keep reading

Advertising · 6 min read
Connect Claude to Google Ads with the Google Ads MCP Server. Step-by-step guide to the Google Ads MCP server with Claude: prerequisites, Desktop and Claude Code setup...

Analytics and tracking · 7 min read
MCP Marketing Analytics: Connect Ad, Store and Email Data. How to set up MCP marketing analytics: connect ad, store, GA4 and email data to an AI assistant, start...

Advertising · 7 min read