Google Analytics MCP: Query GA4 With an AI Assistant
A Google Analytics MCP server lets an AI assistant run GA4 reports from a plain-language question. What it can do, how it works, its limits and the guardrails to set.
02 / In this article
A Google Analytics MCP server is a small program that lets an AI assistant run GA4 reports for you, so you can ask "which pages brought the most new users last month?" and get a table back. Google publishes an official, experimental server that does this through the Google Analytics Data API and Admin API, with read-only access by default. This guide covers what it can do, how it works, the questions worth asking, and the limits and guardrails that keep the answers trustworthy.
Key Takeaways
- An MCP server is a bridge, not a new data source. The assistant calls the same Google Analytics APIs a dashboard would call. It sees what the API returns and nothing else.
- Google publishes an official server, marked experimental. As of October 2026 the
googleanalytics/google-analytics-mcprepository exposes nine tools and asks for the read-only scope by default. - The limits of GA4 still apply. Quotas, data thresholds and sampling shape the answers, and an assistant can describe a thresholded number as if it were complete.
- Least privilege comes first. Use read-only credentials from a person who has access to the property, keep personal data out of prompts, and have a human check any conclusion before it drives a decision.
- Good questions are specific. A date range, a metric, a dimension and a comparison produce a report you can check. A vague question produces a confident paragraph you cannot.
What is a Google Analytics MCP server?
A Google Analytics MCP server is a program that exposes Google Analytics reporting as a set of tools that an AI assistant can call through the Model Context Protocol. MCP is an open standard for connecting assistants to outside tools and data, and our explainer on what MCP is covers the protocol itself.
The idea is simple. Without a server, you paste exports or screenshots into the chat. With one, the assistant asks the server for a report, reads the rows and explains them. The server does the API work. The assistant does the reading.
Three parts are involved: the assistant (a chat or coding tool such as Claude, covered in our piece on using Claude with MCP), the local server that turns each tool call into an API request, and Google Analytics, which returns data for the properties your credentials can see.
Google Analytics is one of the tools we work with at Versai, which is why this topic sits next to our work on analytics and automation. It is a good first MCP project because the data is read-mostly.
Is there an official Google Analytics MCP server?
Yes. Google publishes one in the googleanalytics GitHub organization, and its README labels it "Experimental". We checked the repository README on 22 October 2026.
What the README says it is: a local MCP server that interacts with the Google Analytics APIs. It uses the Google Analytics Admin API and the Google Analytics Data API, needs Python 3.10 or newer, and is started with pipx. It points questions to a Discord channel and does not describe a formal support policy, which fits the "experimental" label.
The tools listed in the README on that date:
- Account and property information:
get_account_summaries,get_property_details,list_google_ads_links,list_property_annotationsandcreate_property_annotation. - Core reports:
run_report,run_funnel_reportandget_custom_dimensions_and_metrics. - Realtime reports:
run_realtime_report.
Of those nine, only create_property_annotation writes anything. According to the README it is available only if you add the --allow-write argument, and then the credentials must also carry the edit scope. Without that flag, the server runs in a reading mode.
Other GA4 servers exist under similar names. They are separate projects, not Google's, and each is judged by its own README, maintainer and code. Because the official one is experimental, check the README again before you install: tool names and options can change.
How does a Google Analytics MCP server work?
The server turns each tool call into a request to a Google Analytics API and returns the rows to the assistant. The path from your question to a report has four steps, shown below.
The third step is where Google's rules apply. The Data API is the programmatic way to read the same report data that the Google Analytics interface shows. Its runReport method returns a custom report, runRealtimeReport returns events from the last 30 minutes (60 minutes for Analytics 360 properties), and runFunnelReport is described in Google's documentation as an early-preview method. The server wraps these as run_report, run_realtime_report and run_funnel_report.
The fourth step is where most mistakes happen. The summary can be wrong even when the rows are right: a swapped metric, a missing filter, a pattern read into three data points. Treat the table as the evidence and the summary as a draft.
How do you connect it?
Follow the README for exact commands. The main points as of October 2026:
- Enable the Google Analytics Admin API and Data API in a Google Cloud project.
- Sign in with Application Default Credentials using the read-only scope
https://www.googleapis.com/auth/analytics.readonly. - Register the server with your client. For Claude Code, the README gives a
claude mcp add analytics-mcpcommand that runspipx run analytics-mcpand passes the path to your credentials file and your project ID as environment variables.
The access of the server equals the access of the account you sign in with. If that person can see ten properties, so can the server. That point matters for the guardrails below.
What can you ask a Google Analytics MCP server?
You can ask anything that a GA4 report can answer: acquisition, pages, events, conversions, audiences and funnels, for any date range, with filters. The server is a faster way to build the report, not a source of new metrics.
Four areas cover most needs:
- Acquisition. Which channels, sources and campaigns bring users and sessions, and how that changed against a previous period.
- Content. Which pages and landing pages get views and engagement, and which ones lead to an action.
- Events. How often a named event fires, such as a form submission, a checkout start or a button click.
- Key events. How many key events happen and from which source or page. Google's help now calls the events that measure important actions "key events", and uses "conversions" for the measurement of ad performance, so check which word your property and your team use.
The server also reads account structure, such as which properties exist and which custom dimensions and metrics are defined, so the assistant can look up your field names instead of guessing them.
Which tool fits which job?
Three tools produce reports, and they answer different kinds of question.
The time windows and the preview status come from Google's Data API documentation. Realtime data is useful to confirm that a new tag fires. It is a poor basis for any decision about performance, because 30 minutes of traffic is a small and noisy sample.
Which questions are worth asking?
Ask questions that name a metric, a dimension, a date range and a comparison, because each of those gives you something to check. Here are seven that a small team can use, each with the trap to watch for.
1. Which channels brought new users last month, compared with the month before?
Ask for new users by default channel group for two explicit date ranges.
Trap: Unassigned. Google's help says that when the automatically collected session_start event is missing, source and medium show as "(not set)", and the traffic lands in Unassigned because no channel rule matches. A large Unassigned slice is a tagging problem, not a channel.
2. Which landing pages drive the most key events?
Ask for key events by landing page, sorted from highest to lowest, with sessions beside them so you can compare rates.
Trap: raw counts favour busy pages. A page with 2,000 sessions and 40 key events is not "better" than a page with 100 sessions and 10. Always ask for the rate next to the count.
3. How many times did a specific event fire this week, and on which pages?
Name the event exactly. Let the assistant list your custom dimensions and metrics first, so that it uses the right names.
Trap: event names are case sensitive and similar names are common. If two events look alike, the assistant may pick the wrong one. Ask it to state the exact name it used.
4. Where do users drop out of the checkout or sign-up flow?
This calls for the funnel tool. Define the steps in order, for example "view product", "start checkout" and "purchase", and ask for the drop-off between them.
Trap: funnels depend on consistent tracking. If a step is only tracked on some pages or devices, the drop-off is partly a measurement artefact. Check the tracking first: our conversion tracking page describes a reliable setup.
5. Did traffic from a campaign change after we launched it?
Ask for sessions and key events for the campaign's source and medium, before and after the launch date.
Trap: correlation. A rise after a launch does not show the launch caused it. Seasonality, other campaigns and tracking changes move the same numbers, so ask the assistant for alternative explanations too.
6. Which pages have traffic but no engagement?
Ask for pages with high views and low engagement. The list is a starting point for a content review, alongside a website audit checklist.
Trap: engagement metrics reflect how the page is used, not whether it is good. A support page that solves a problem in ten seconds can look "weak".
7. Is the new tag working right now?
Use the realtime tool, visit the page yourself and ask whether the event appears.
Trap: your own traffic. If internal traffic is not filtered, your test visit counts as a real user. Do not read performance into it.
What should you never ask?
Do not ask for individual users. Google's policy requires that no data be passed to Google that it could recognise as personally identifiable information (PII). Do not paste emails, names or order details into a prompt "to match them with analytics". If a question needs a person's identity, it is a CRM question, not an analytics one.
Do you trust the numbers you are asking about?
An assistant can only report what your tracking collects. We review your setup and tell you what to fix first.
See analytics and trackingWhat limits does GA4 put on the answers?
GA4 limits what any API client can retrieve, and the assistant inherits those limits without announcing them. Three matter most: quotas, data thresholds and sampling.
Quotas
The Data API gives every property a token budget. For a standard property, Google's documentation lists 200,000 tokens per day, 40,000 per hour and 10 concurrent requests. Analytics 360 properties get ten times the daily and hourly budgets and 50 concurrent requests. Realtime and funnel reports use the same limits as core reports.
An assistant that runs report after report can use the hourly budget fast, especially in a loop. When it is gone, the API returns errors and the assistant may answer from memory instead. If a report fails, ask for the error text, not a summary of it.
Data thresholds
Data thresholds are limits that withhold data to protect individuals. Google explains that they apply to reports that include demographic data or audiences built on demographic data, and to reports with search query information when too few users are involved. You cannot turn them off, and Google states that the Data API can withhold data in the same way as the interface.
A thresholded row is simply missing, and the assistant may not mention it. Widen the date range, since narrow ranges with few users are more likely to be thresholded, and skip demographic breakdowns unless you need them.
Sampling
Sampling means that GA4 analyses part of the data and scales the result up. Google's help says it can occur in Explorations when a query goes over the event limit for the property, listed as 10 million events per query for standard properties, and that the results are then "directionally accurate". The interface shows how much data was used, but an assistant reading API rows does not see that indicator the same way. Check the numbers that matter in the GA4 interface before you quote them.
How do you keep a Google Analytics MCP server safe?
Give the server the least access that does the job, run it as a read-only login, and keep a person in charge of every decision. The MCP project's own security guidance points the same way, and Google's setup uses the same mechanisms.
Start with read-only. The official server asks for the analytics.readonly scope for reporting, and the edit scope only for write tools behind --allow-write. Leave the flag off. Property annotations are the only write the server offers today, but a future version could add more, so the habit is worth having.
Use the smallest account that works. The server acts as the account you sign in with. Use a login that has Viewer access to the properties you need, not an Administrator login that can see every property in the organisation. MCP's security best practices describe scope minimisation in the same terms: broad scopes enlarge the damage if a token leaks and make revoking harder.
Treat a local server as code you run. The MCP security guidance warns that local servers run with the privileges of the client. Read the command in your configuration before you approve it, and install the official package rather than a lookalike.
Keep personal data out of prompts. Google's policy forbids sending data that could be used as PII to Google Analytics, and examples include email addresses and exact locations. Page URLs and titles are a common leak, since they can carry names or email addresses in query strings. If a report shows such values, remove the tracking at the source rather than asking the assistant to ignore them.
Log and revoke. Know where the credentials file lives and who can read it. If someone leaves the team, remove their access in Google Analytics and the server loses it too.
Review before acting. An assistant can find a pattern and suggest a change, but a person decides whether to change a budget, a page or a tag. If the assistant's answer would justify spending money or changing tracking, check the figures in the interface first.
For the same approach applied to search data, see our guide to the Google Search Console MCP, and for the advertising side, the Google Ads MCP article.
What does a safe first session look like?
Connect the server with a Viewer login and no write flag. Ask the assistant to list your properties and confirm it sees only the ones you expect. Then run one acquisition report for a fixed month and compare the totals with the same report in the interface. They should match, apart from thresholds and sampling. If they do not, stop: the assistant used a different date range, metric or filter than you intended, and you want to know why before you trust anything else.
When is a Google Analytics MCP server the wrong tool?
It is the wrong tool when you need a fixed report that many people read, when the question depends on data GA4 does not hold, or when the stakes are too high for an unreviewed answer.
- A recurring report. If the same ten numbers go to the same people each week, a scheduled report or dashboard is steadier than a chat. Building those is the focus of our analytics and tracking work.
- Data outside GA4. Revenue in a shop backend, leads in a CRM and ad spend each have their own source and need their own connection.
- Decisions on bad tracking. If events are missing or duplicated, a faster way to query them gives you wrong answers faster. Fix the tracking first.
- Regular, rules-based jobs. If a task is the same every time, such as a weekly summary posted to a channel, a defined AI workflow with fixed steps and checks is better than an open chat.
An assistant can show where users drop out, but deciding what to change on the page is a design and testing question, the territory of conversion optimization.
Turn analytics questions into a repeatable workflow
If you ask the same questions every week, we can build a defined workflow with the checks built in.
Explore AI workflowsFrequently Asked Questions
What is a Google Analytics MCP server?
A Google Analytics MCP server is a program that exposes Google Analytics reporting as tools an AI assistant can call through the Model Context Protocol. The assistant sends a request, the server queries the Google Analytics APIs and the rows come back for the assistant to read.
Does Google offer an official Google Analytics MCP server?
Yes. Google publishes google-analytics-mcp in the googleanalytics GitHub organization, and its README labels it experimental. As of 22 October 2026 it lists nine tools built on the Admin API and the Data API. Check the README for current details.
Is the Google Analytics MCP server read-only?
Mostly. Reporting needs only the analytics.readonly scope. One tool, create_property_annotation, can write, and the README says it needs the --allow-write argument and the edit scope. Without that argument the server is used for reading.
Can an assistant see personal data in GA4?
GA4 reports on groups of users and Google's policy forbids sending personally identifiable information to it. Some PII can still leak through page URLs, titles or custom dimensions. If you find it in a report, remove it at the source and keep it out of prompts.
Why do the assistant's numbers differ from the GA4 interface?
The usual causes are a different date range, a different metric, a filter the assistant added, data thresholds or sampling. Ask the assistant for the exact request it made and compare it with the report you built by hand.
Are there limits on how many reports I can run?
Yes. Google lists token quotas per property, 200,000 per day and 40,000 per hour for a standard property, plus 10 concurrent requests. Analytics 360 properties have higher limits. Plan for a few well-defined reports instead of many exploratory ones.
Can I trust the conclusions an assistant draws from GA4 data?
Trust the rows after you have checked them, and treat the conclusions as a draft. The assistant can mix up metrics, miss a filter or claim a cause the data does not show. A person should confirm any conclusion that would change spending, content or tracking.
Next steps
Start small: connect the official server with a Viewer login, run one report you can check against the interface, and keep the write flag off. Before you rely on any answer, make sure your tracking is sound. Our conversion tracking work covers that groundwork, and our analytics and tracking service covers the wider setup. If you would like help planning which questions to automate, see conversion optimization and AI workflows, or get in touch with what you sell and which numbers you rely on.
Sources
- googleanalytics/google-analytics-mcp, "Google Analytics MCP Server (Experimental)", README (checked 22 October 2026): https://github.com/googleanalytics/google-analytics-mcp
- Google for Developers, "Google Analytics Data API overview": https://developers.google.com/analytics/devguides/reporting/data/v1
- Google for Developers, "Data API quotas": https://developers.google.com/analytics/devguides/reporting/data/v1/quotas
- Google Analytics Help, "About data thresholds": https://support.google.com/analytics/answer/9383630
- Google Analytics Help, "Data sampling in Explorations": https://support.google.com/analytics/answer/13331292
- Google Analytics Help, "(not set)" source / medium and Unassigned traffic: https://support.google.com/analytics/answer/13504892
- Google Analytics Help, "Key events and conversions": https://support.google.com/analytics/answer/13965727
- Google Analytics Help, "Best practices to avoid sending PII": https://support.google.com/analytics/answer/6366371
- Model Context Protocol, "Security Best Practices": https://modelcontextprotocol.io/specification/2025-06-18/basic/security_best_practices
Newsletter
One short email when we publish
Notes on AI, image, video and brand work, from the people who do it. No spam.