GA4 MCP Server Audits Need More Than Read-Only Access
GA4 MCP server connects AI agents to Analytics reports; I'd start with a read-only landing-page audit and verify the query before trusting its recommendations.
- Topic
- AI
- Reading time
- 7 min
- Length
- 1,637 words
- Published
- Nov 11, 2026
09:04 pm IST
In this article
The GA4 MCP server lets an AI agent query Google Analytics reports and inspect property settings through natural-language requests. Access is read-only by default. That makes it useful for auditing organic landing pages, but it cannot tell me which search query lost rankings. For that, I still need Search Console.
The analytics-mcp package reached version 1.1.0 after leaving experimental status on 3 November 2026. I am less interested in chatting with a dashboard than in making a recurring investigation inspectable. I want the same property, explicit reporting periods, and evidence I can check behind every recommendation. The conversation itself is not the part I need to preserve.
What the Analytics connection actually provides
The server connects an MCP-capable client to the Analytics Admin API and Data API. The split matters: the Admin side handles account discovery and property configuration, while the Data side handles reports. The server runs locally by default, communicating with the agent over standard input and output. Supported clients include Claude Code, Cursor and Antigravity.
Those are tools, not analytical judgement. The agent can discover properties with get_account_summaries, inspect settings with get_property_details, and retrieve reporting data with run_report. Other tools cover realtime activity, funnels, conversions and custom fields. I would treat every generated interpretation as a claim I need to verify. It is not another field returned by Analytics, even when it appears beside the reporting data.
The documentation does not quite agree with itself here. Trickyworld's description of version 1.1.0 includes ten read-only tools and optional write tools behind --allow-write; Google's developer guide contains nine tools and describes the server as read-only. The experimental label is still present at AIRankLab, while the departure date in Trickyworld's account is 3 November. I would check the installed package's help and the tools it actually exposes. I would not assume these descriptions are interchangeable.
Connecting an agent to a read-only property
The requirements in the Google Analytics MCP setup guide are Python 3.10 or higher, pipx or uv, a Google Cloud project, and at least the Viewer role on the target Analytics property. Both APIs need to be enabled: Analytics Admin API and Analytics Data API. Having access to the property is only one part of the setup.
I would start with a property whose reports I already understand. Authentication is one check; analytical validation is another. Trying to solve both against unfamiliar data would leave me debugging the connection and questioning the figures at the same time, which seems unnecessarily ambiguous.
gcloud services enable analyticsadmin.googleapis.com analyticsdata.googleapis.com --project=YOUR_PROJECT_ID
gcloud auth application-default login \
--scopes="https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform"
These commands enable the APIs and create Application Default Credentials. I would copy the credentials path printed by the login command and use that absolute path in the client configuration. This is worth doing explicitly: many MCP hosts do not expand ~ or $HOME inside JSON.
For Claude Code, I would register the server with this command:
claude mcp add analytics-mcp \
--scope user \
-e GOOGLE_APPLICATION_CREDENTIALS="PATH_TO_CREDENTIALS_JSON" \
-e GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID" \
-- pipx run analytics-mcp
The placeholders need replacing before running it. In Claude Code, /mcp checks the connection. After that, I would ask for account summaries and confirm that the intended property is present. I would also record its property ID explicitly. I do not want each investigation to rediscover which property it is supposed to use.
In a shared environment, I would prefer a service account with Viewer access only to the relevant property. Google supports both service-account credentials and impersonation. I would leave --allow-write out of the configuration and keep client confirmations enabled during initial testing. Read-only is the access I want for this work.
Diagnosing setup failures without widening access
A 403 PERMISSION_DENIED can mean that an API is disabled or that property permissions are insufficient. I would check both APIs in the configured Cloud project first, then check the authenticated identity's Viewer access. An insufficient-scopes error is a reason to correct authentication. It is not a reason to grant an editing role.
For 401 UNAUTHENTICATED, I would check the absolute credentials path and whether the user credentials need refreshing. A missing quota project means checking GOOGLE_CLOUD_PROJECT. If the process cannot find pipx or uvx, the desktop application may not have inherited the shell's PATH. In that case, I would use the absolute executable path returned by which pipx or which uvx rather than widen access elsewhere.
Building a repeatable organic landing-page audit
I would begin with a question I have already answered manually: which organic landing pages lost sessions, and did their engagement or key events change too? For a newsroom publishing platform, that is the comparison I would validate before asking an agent to prioritize editorial work. A confident explanation would not persuade me to change a page on its own. I would want the comparison behind it.
This run_report payload compares the last 28 completed days with the preceding 28. There are two naming conventions to keep straight: request fields use snake_case, while Analytics dimension and metric names retain their own spelling.
{
"property_id": "123456789",
"date_ranges": [
{"start_date": "28daysAgo", "end_date": "yesterday", "name": "last_28"},
{"start_date": "56daysAgo", "end_date": "29daysAgo", "name": "previous_28"}
],
"dimensions": ["landingPage"],
"metrics": ["sessions", "engagementRate", "keyEvents"],
"dimension_filter": {
"filter": {
"field_name": "sessionDefaultChannelGroup",
"string_filter": {"match_type": 1, "value": "Organic Search"}
}
},
"order_bys": [{"metric": {"metric_name": "sessions"}, "desc": true}],
"limit": 50,
"return_property_quota": true
}
The property ID here is a placeholder, not a property to query. The channel filter uses an exact match, and return_property_quota requests quota information. Engagement rate comes back as a fraction. It is not an already-formatted percentage, and I would check that distinction in the returned interpretation too.
Those relative periods are useful for a rolling check. For a decision I need to reproduce later, though, I would save the resolved absolute dates and the property timezone alongside the request. Relative-date ambiguity, small denominators and inconsistent conversion-event selection are all covered in AIRankLab's GA4 analysis pitfalls. They are exactly the kinds of details I would want the saved investigation to make explicit.
I would put these requirements into the saved audit instructions, rather than leave them implicit:
- Show raw counts beside rates. Identify the property and reporting periods, and state the dimensions and metrics behind each finding so I can check the comparison.
- Rank session declines separately from key-event declines. For any event-specific recommendation, name the key event used rather than silently choosing one for the analysis.
- Break the largest declines down by device before proposing page changes. Keep observations separate from possible explanations; I want to be able to inspect each on its own.
- Write “not available” where figures are missing. Disclose thresholding, retention or consent limitations instead of filling those gaps with estimates that look like returned figures.
Before scheduling anything, I would compare a returned row with the GA4 interface. Then I would ask the same question again and inspect whether the query changed. I do not need identical prose on both runs. I do need stable evidence; that would be my acceptance criterion.
For unattended execution, Claude Code supports a tool allowlist with --allowedTools and a dontAsk permission mode that denies calls which would otherwise require approval. I would allow only the report readers needed by the saved audit. This is where my broader approach to designing around the request path becomes concrete: I would define the permitted work first, then decide how much autonomy to give it. Not the other way round.
Can it explain lost search rankings?
Not from GA4 alone. There is no search-query dimension in GA4. An active Search Console link makes some search metrics available, including clicks, impressions and average position, but the combinations are restricted. That linked data also arrives after 48 hours and covers at most 16 months. I would keep those limits visible during the investigation.
I would use Analytics to find the affected landing pages, then move to Search Console reports to investigate queries and search visibility. Clicks and sessions are different measurements. Search Console counts search-result clicks; GA4 counts sessions after a page loads. I would reject an explanation that treats the difference between those figures as proof of broken tracking. The difference alone does not establish that.
Read-only access does not guarantee a correct audit
My biggest worry is a plausible answer built from the wrong denominator. Mixing user-scoped and session-scoped measurements can do that. So can overlooking (other) or (not set), or treating tiny counts as meaningful rate changes. The output can still sound convincing. Thresholding can withhold rows, and consent configuration can leave behaviour modelled or absent; I would want those limitations visible, not buried beneath the explanation.
Read-only does not settle data handling either. Depending on configuration, Analytics results may contain personal data, so I would establish where the agent provider processes and stores them. I would treat page paths and campaign values as untrusted data, never as instructions to the agent. Keeping Analytics writes disabled is one boundary. It does not define the permissions of every other connected tool.
Quota is another boundary I would make explicit. A standard property has 200,000 core tokens per day and 10 concurrent core requests. I would bound the reporting periods and returned rows, inspect quota consumption, and avoid an open-ended instruction to investigate every page. Those limits do not establish an agent subscription price or a universal per-audit cost. Model charges and hosted-product charges are separate, and I would keep them separate from the Analytics quota discussion.
I would use this for bounded investigations, not to replace a standing dashboard with generated commentary. If a fixed report already answers the question, I would keep the report. What interests me is an agent that can investigate a change while showing its work, with evidence that remains available even when I disagree with its recommendation. Before trusting the next audit, I would reproduce the figures and identify what is missing.
Sources
This is the source this article is based on. Many articles on this blog are drafted with AI and checked against their source automatically; the editorial policy explains how, and how to report a mistake.
Frequently asked
Can the GA4 MCP server change Analytics settings?
Access is read-only by default. Trickyworld reports optional write tools behind --allow-write that also require the analytics.edit scope, while Google's developer guide describes a read-only server. I'd verify the installed tools and leave write access disabled for audits.
Does the GA4 MCP server replace Search Console?
No. GA4 has no search-query dimension. Linked Search Console metrics provide some search-performance data, but query-level investigation still needs Search Console.
Should I replace Looker Studio with an Analytics agent?
I wouldn't replace a stable recurring dashboard. I'd keep the dashboard for consistent monitoring and use the agent to investigate changes, with explicit metrics, reporting periods and saved requests.
What does a GA4 MCP audit cost?
There is no universal audit price established here. Analytics API quota, model usage and any hosted-product charges are separate considerations. I'd constrain report size and investigation scope before estimating the cost of a recurring run.
Weekly newsletter
Liked this? Get the next one by email
One short email a week with new articles on React, Node.js, TypeScript and AI engineering. No spam. Unsubscribe in one click.
Further reading
Related tutorials from ByteMuni, my developer publication.
- AI AgentsAnatomy of an AI Agent Harness: Exploring Microsoft’s Agent FrameworkAgent design determines how models use tools, retain work and seek approval; this guide explains Microsoft defaults and safer Python file access.
- AI & Machine Learning40 AI Terms Every Student Should Know in 2026 (Explained Simply)AI jargon changes every few months. This beginner-friendly glossary explains 40 essential AI terms for 2026, from tokens and context windows to RAG, MCP, AI agents and prompt injection. Each term gets a plain-English definition, an everyday comparison and a real example, grouped into six levels. It ends with six terms to watch in 2027.
- AI AgentsMeta Muse blocks expose the limits of agent permissionsMeta Muse access restrictions put platform consent ahead of customer authorization; Walmart's planned profiles show how agent identity and purchase controls could work.