# What is a Google Analytics MCP server?

> What a Google Analytics MCP server does, how Google's own GA4 server compares with a hosted one, how to connect it, and how to read the answers.

A Google Analytics MCP server lets an AI assistant such as Claude, ChatGPT or Gemini read your Google Analytics 4 property through the Model Context Protocol (MCP). You ask a question in plain words, the assistant picks the dimensions and metrics, the server runs the report, and you get an answer built from your live data instead of an exported spreadsheet.

This guide explains what such a server can read, how Google's own server compares with a hosted one, how to connect either, and how to avoid the mistakes that make a fluent answer wrong. The facts about Google's server were checked on the date above against [Google's documentation](https://developers.google.com/analytics/devguides/MCP) and its [GitHub repository](https://github.com/googleanalytics/google-analytics-mcp).

## In short

- A GA4 MCP server turns the Analytics Data API into tools an assistant can call, such as "run a report" or "list my properties".
- Google's server is free and open source, and you install, host and secure it yourself.
- A hosted server needs no installation and works in chat apps, but you trust the company that runs it.
- Read-only access is enough for analysis. The Viewer role and the read-only scope are the safe starting point.
- The assistant can be wrong about meaning, not only numbers. Check date ranges, scopes and notes about sampling and thresholds.

## What does a Google Analytics MCP server do?

A Google Analytics MCP server sits between your assistant and Google's Analytics APIs. It receives a tool call, signs in with the access you granted, runs the request against one property, and returns rows the assistant can read.

GA4 is flexible but awkward to query. A report needs exact API names such as `sessionDefaultChannelGroup` or `keyEvents`, and not every dimension works with every metric. The server exposes that machinery as tools with descriptions, and the model fills in the details from your question.

Take "Which channels brought engaged visitors last month?" Behind that sentence, the assistant:

1. Lists the properties your login can read and picks the right one.
2. Chooses a dimension (the session default channel group) and metrics (sessions, engaged sessions, key events).
3. Sets the date range and runs the report.
4. Reads the rows and explains them, usually with a small table.

If MCP itself is new to you, [What is a Google Ads MCP server?](/guides/what-is-a-google-ads-mcp-server) explains hosts, clients, servers and tools from the beginning.

## What can you ask once GA4 is connected?

The best questions are the ones that would otherwise take several explorations or an export.

**Traffic and quality**

- "Compare sessions and engagement rate by channel, this month against last month."
- "Which landing pages get paid traffic but almost no engaged sessions?"
- "Did mobile engagement drop after the 12th?"

**Key events and revenue**

- "Which campaigns produced key events last week, and how many sessions did each need?"
- "Show revenue by source and medium for the last 90 days."
- "Which key events fired yesterday, and which went quiet?"

**Checks and troubleshooting**

- "Is anyone on the site right now, and on which pages?"
- "How much of my traffic is Direct or Unassigned, and has that share grown?"
- "Which of my `utm_campaign` values look like typos of each other?"

That last group is underrated. Spotting near-duplicate campaign names or a key event that stopped on a Tuesday is tedious for a person and easy for a model with the rows in front of it.

## What does Google's own Analytics MCP server offer?

Google's server is an open-source Python package named `analytics-mcp`, released under the Apache 2.0 license. It uses the Analytics Admin API for account and property details and the Data API for reports.

Google's documentation lists these tools:

| Tool | What it returns |
| --- | --- |
| `get_account_summaries` | The accounts and properties you can access |
| `get_property_details` | The configuration of one property |
| `list_google_ads_links` | The Google Ads accounts linked to a property |
| `list_property_annotations` | Notes saved on the property's timeline |
| `get_custom_dimensions_and_metrics` | Your custom dimensions and metrics |
| `run_report` | A standard report |
| `run_realtime_report` | A realtime report |
| `run_funnel_report` | A funnel report |
| `run_conversions_report` | A conversions report |

To run it you need Python 3.10 or later with `pipx` or `uv`, a Google Cloud project with both Analytics APIs enabled, and credentials for a user or service account that has at least the Viewer role on the property. The credentials are Application Default Credentials, created with the `gcloud` command line tool, using the `analytics.readonly` scope.

### Is Google's server read only?

By default, yes. The documentation says the server is available for read requests only and can't create, modify or delete your Analytics configuration. The repository has moved further: its README also describes tools that create an annotation, a custom dimension or a key event. They stay off unless you start the server with `--allow-write` and grant the `analytics.edit` scope. If you want read-only behavior, leave both alone.

### Can Google's server run remotely?

The README describes two ways: serving over HTTP, for example on Cloud Run, and a built-in OAuth mode for several users. Either way it is your deployment. You create the OAuth client, protect the endpoint and keep it updated. We found no Analytics endpoint that Google hosts for you in [Google's list of MCP servers](https://github.com/google/mcp) or its Analytics changelogs when we checked.

## Should you run Google's server or use a hosted one?

Choose by where you work and who maintains it. A developer who lives in a terminal loses little by running Google's server. A marketer who works in a chat app, or an agency with several people and clients, usually wants a remote server with a normal sign-in.

| | Google's server, run by you | A hosted server |
| --- | --- | --- |
| Setup | Python, Google Cloud project, APIs, credentials | Add an address and sign in |
| Works in | Coding tools and desktop apps; chat apps only if you deploy it | Chat apps, desktop and coding tools |
| Updates | You install them | The provider deploys them |
| Where access is kept | On your computer or cloud project | With the provider |
| Cost | Free, plus any cloud hosting | Usually part of a paid plan |
| Other data | Analytics only | Depends on the provider, often ads too |

Whichever you choose, ask four questions. Which scope does it request? Which properties can it see, all of them or only those you pick? Can you revoke access from your Google account? And does it store your reports, or read them live?

## How do you connect Google Analytics to Claude or ChatGPT?

The steps depend on the route.

**With a hosted server:**

1. Create an account with the provider and connect Google Analytics there, signing in with a Google login that can read the property. Viewer is enough.
2. Pick only the properties the assistant should see.
3. Add the provider's MCP address to your assistant. In Claude this is a custom connector, in ChatGPT a custom MCP server. [How to connect Claude to Google Ads](/guides/how-to-connect-claude-to-google-ads) and [Connect ChatGPT, Codex, Cursor or Gemini](/guides/connect-chatgpt-codex-cursor-gemini-to-ad-accounts) show each screen.
4. Sign in and approve the connection.
5. Ask "Which Google Analytics properties can you see?" and check the list.

**With Google's server:**

1. Enable the Analytics Admin API and the Analytics Data API in a Google Cloud project.
2. Create Application Default Credentials with the read-only Analytics scope.
3. Add the server to your client's MCP configuration. Google documents Claude Code, Claude Desktop, Cursor and others.
4. Restart the client and ask for your account summaries.

If Google's server answers with a permission error, the usual causes are an API that is not enabled in the project or a credential without a role on that property.

## Why do GA4 and your ad platforms disagree?

Google Analytics and ad platforms answer different questions, so their numbers are not meant to match. An ad platform asks "which conversions followed my ads?" Google Analytics asks "which channels share the credit for this key event?"

Common reasons for a gap:

- **Attribution.** [GA4's attribution settings](https://support.google.com/analytics/answer/10597962) decide how credit is shared and how far back it looks. The default lookback for most key events is 90 days, and each ad platform has its own windows.
- **Clicks are not sessions.** A click that never loads the page is paid for and never becomes a session. One person clicking twice quickly may be one session.
- **Key events are not conversions.** In [Google's terms](https://support.google.com/analytics/answer/13965727), a key event marks an action that matters to your business, and a conversion is an action used to measure ads and guide bidding.
- **Time zones and currency.** The property and the ad account can each have their own.
- **Missing UTM tags.** Google Ads clicks are recognized through account linking. Microsoft, Meta and ChatGPT ads depend on the UTM parameters in their links. Without them, paid visits look like referral or direct traffic.
- **Broken tags.** A site update removes one tag and leaves the other.

The useful signal is the pattern, not the difference. A gap that stays about the same from week to week is normal. A platform that counted 40 conversions a week and now counts none, while GA4 still records the key events, points to a broken tag. [Conversion tracking tags on every ad platform](/guides/conversion-tracking-tags-every-ad-platform) covers what each tag should do.

## How do you read an assistant's GA4 answer critically?

A model writes a wrong total as smoothly as a right one. These checks catch most problems.

1. **Ask for the dates, property and metrics it used.** "Last month" and "the last 30 days" are different reports.
2. **Watch the scope.** User, session and event dimensions answer different questions. The first channel that brought a user is not the channel of this session.
3. **Don't add up users.** A person who visits on two days is one user over the week, so daily users never sum to weekly users.
4. **Look for data notes.** GA4 can withhold small rows for privacy (thresholding), estimate from a sample, or group rare values into "(other)". A good server passes these notes on.
5. **Leave recent days out.** Yesterday's data is still settling, and key event credit can move for days afterward.
6. **Compare one number by hand.** Open the same report in GA4 once. If it matches, you can trust the next ten more.
7. **Separate "after" from "because".** Sessions rose after the budget change. Whether they rose because of it needs a baseline, such as what organic and direct traffic did on the same days.

## Is it safe to give an AI assistant access to Google Analytics?

Reading analytics is among the lower-risk uses of MCP, because nothing can be spent or deleted with read-only access. A few precautions still matter.

- **Grant Viewer, not Editor.** The role limits what any tool can do, whatever the server offers.
- **Pick properties.** An agency login may see dozens of clients. Connect only the ones this assistant needs.
- **Treat site text as data.** Page titles, paths and campaign names come from websites and visitors. A line that reads like an instruction should never be followed, especially when the same assistant can also change ads.
- **Know where data goes.** Report rows are sent to your AI provider as part of the conversation, so use an account whose data settings fit your policy.

When the assistant can also edit campaigns, the care shifts to the write side. [Is it safe to give AI access to Google Ads?](/guides/is-it-safe-to-give-ai-access-to-google-ads) has the full checklist.

## Doing this with Roasby

[Roasby](/google-ads) is a hosted MCP server that puts Google Analytics next to your ad accounts. You connect your GA4 properties once, read only, choose which ones it reads, and link each to the ad accounts that send people to that website. Then Claude, ChatGPT, Gemini or any MCP app can read standard, pivot and realtime reports live, and see sessions, engaged share, key events and revenue beside each campaign's spend.

Roasby also watches for the pattern described above: an alert opens when an ad platform and Google Analytics disagree on a campaign's conversions in a way that suggests a broken tag, and the weekly report adds what each property counted from your ads. Roasby never changes anything in Google Analytics.

See what that looks like in [Google Analytics for your ads](/use-cases/google-analytics-for-ads), or follow the [setup steps](/docs/google-analytics).

## Questions, answered

### Is there an official Google Analytics MCP server?

Yes. Google publishes an open-source server as the analytics-mcp package. You run it yourself, on your computer or on your own cloud project, with a Google Cloud project and credentials that can read your GA4 properties.

### Can I connect Google Analytics to Claude or ChatGPT on the web?

Only through a remote server, because a chat app in the browser cannot start a program on your computer. Use a hosted server that you sign in to, or deploy Google's open-source server to your own cloud and secure it.

### Can a Google Analytics MCP server change my property?

It depends on the server and the access you grant. Google's documentation describes its server as read only, while the repository also offers a few write tools that are off until you turn them on. With the read-only scope, no tool can change anything.

### Why does GA4 show fewer conversions than Google Ads?

They count differently. Google Analytics shares credit among all channels, while an ad platform credits its own clicks and views. Attribution settings, time zones, consent and tags that fail to load also move the numbers, so expect the two to be close in direction, not equal.

### Does an MCP server work with Universal Analytics?

No. These servers use the Google Analytics Data API and Admin API, which work with Google Analytics 4 properties.
