Google Analytics MCP Server: Setup, Limits and Safe Use

Google Analytics MCP Server: Setup, Limits and Safe Use

analyticsNovember 29, 2026
By Antonio Fernandez

TL;DR

  • Google's open-source analytics-mcp package wraps two APIs: the GA4 Admin API for configuration and the Data API for reports, including realtime.
  • Google's developer guide documents it as read-only with the analytics.readonly scope; optional write tools need an explicit --allow-write flag plus the analytics.edit scope.
  • Setup needs Python 3.10+, both APIs enabled in a Google Cloud project, Application Default Credentials and at least the Viewer role on each GA4 property.
  • Data API limits still apply: 200,000 core tokens per property per day on standard GA4 (2 million on 360) and at most 250,000 rows per report request.

The Google Analytics MCP server is an open-source server published by Google that lets an AI assistant query your GA4 accounts and properties through the Model Context Protocol. It calls the Google Analytics Admin API and the Google Analytics Data API on your behalf, and in its standard setup it can only read data, so the assistant can run reports and inspect configuration but cannot change your property.

This guide explains what the google analytics mcp server does, which tools it exposes, how to set it up with a Google Cloud project and Application Default Credentials, which questions it answers well, where its limits are, and how to keep client data safe when an AI agent has access to GA4.

What is the Google Analytics MCP server and what can it do?

The Model Context Protocol (MCP) is an open protocol for connecting AI applications to outside tools and data. An MCP server exposes a set of named tools; an MCP client, such as an AI coding assistant or a desktop chat app, discovers those tools and calls them when a prompt needs them. The model decides which tool to call and with which arguments, the server runs the API request, and the result goes back to the model as text it can reason over.

Google's Google Analytics MCP server applies that pattern to GA4. It is distributed as a Python package (named analytics-mcp in Google's repository) and runs either locally on your machine or as a hosted HTTP service. Google's developer guide describes its purpose as connecting Google Analytics data to large language models and AI agents, so you can query reports in natural language, inspect property configuration and build custom analytics agents.

The tools listed in Google's repository fall into three groups:

  • Account and property information: get_account_summaries lists the accounts and properties the signed-in user can see, get_property_details returns details about one property, list_google_ads_links shows which Google Ads accounts are linked, and list_key_events returns the key events defined on a property.
  • Core reports: run_report runs a standard Data API report, with related tools for funnel and conversions reports, and get_custom_dimensions_and_metrics returns the custom definitions a property has, so the model can use the right field names.
  • Realtime reports: run_realtime_report queries activity from the last 30 minutes (up to 60 minutes on Analytics 360 properties) through the Data API's realtime method.

The tool list changes as Google updates the repository, so check the README before you depend on a specific tool. What stays the same is the shape: every tool is a thin wrapper around a documented Admin API or Data API call.

Is it read-only, and which GA4 APIs does it use?

Yes, in its default configuration. Google's developer guide states that the MCP server is available for read requests only and cannot create, modify or delete your Google Analytics configuration or settings. Setup asks for the read-only OAuth scope analytics.readonly.

Google's repository has since added a small number of optional write tools, such as creating a property annotation or a custom dimension. These stay switched off unless you start the server with an explicit --allow-write flag and grant the broader analytics.edit scope. For most marketing teams the sensible default is to leave that flag off and keep the read-only scope.

Under the hood there are two APIs:

  • The Google Analytics Admin API handles configuration: accounts, properties, links, key events and custom definitions.
  • The Google Analytics Data API handles reporting: dimensions, metrics, date ranges, filters and realtime queries.

Because the server only wraps these public APIs, it can see what those APIs can see and nothing more. It does not reach Explorations you saved in the GA4 interface, raw event-level data (that lives in the BigQuery export) or data in properties your credentials cannot access.

How do you set it up with a Google Cloud project, credentials and an AI client?

The setup in Google's documentation has four parts. Each one is quick; most setup failures come from skipping one.

  1. Install Python and a runner. The server needs Python 3.10 or later and a package runner such as pipx or uv, which downloads and runs the package without a manual install.
  2. Enable the two APIs in a Google Cloud project. In the Google Cloud console, enable the Google Analytics Admin API and the Google Analytics Data API for the project you will use. API usage is attributed to this project.
  3. Configure Application Default Credentials (ADC). ADC is Google Cloud's standard way for local tools to find credentials. Using the gcloud auth application-default login command, you sign in either with your own user account (optionally through an OAuth client you create) or by impersonating a service account, and request the analytics.readonly scope together with the cloud-platform scope. The command prints the path of a credentials JSON file; you will need that path in the next step.
  4. Register the server in your AI client. Google's guide covers several MCP clients, including Claude Code, Claude Desktop and Cursor. You add an entry that runs the package and passes two environment variables: GOOGLE_APPLICATION_CREDENTIALS (the path to the credentials file) and GOOGLE_CLOUD_PROJECT (your project ID).

Two details from Google's guide save time. First, use absolute file paths in JSON configuration files rather than ~ or $HOME, because desktop apps do not always expand them. Second, the identity behind the credentials needs access in GA4 itself: Google recommends at least the Viewer role on each property you want to query. A service account is added in GA4 Admin like any other user, using its email address.

For teams that want one shared server instead of a copy on every laptop, the repository also documents a hosted HTTP mode where each person signs in with their own Google account through OAuth. That is more work to run, but it keeps credentials off individual machines.

What questions can you safely ask it about GA4 data?

The server works best on questions that map cleanly to one or two Data API reports. Good examples:

  • "Which properties can I access, and which ones are linked to Google Ads?"
  • "Sessions and key events by default channel group for the last 28 days, compared with the previous 28 days."
  • "Top 20 landing pages by engaged sessions last month, with engagement rate."
  • "Which custom dimensions exist on this property, and what scope does each have?"
  • "How many active users are on the site right now, by country?"

Questions to treat with care are the ones where the model has to choose definitions for you. "Why did revenue drop?" invites the model to pick dimensions, date ranges and comparisons on its own, and then write an explanation that sounds more certain than the data allows. A better pattern is to ask for the specific report first, read the numbers yourself, then ask follow-up questions.

It also helps to name the property ID, the date range and the exact metric in the prompt. GA4 has several similar metrics (users, active users, new users, total users), and an assistant that guesses wrong will still return a clean-looking table. When a number matters, check it against the same report in the GA4 interface.

What are the limits: quotas, sampling, thresholds and permissions?

Everything that limits the Data API also limits the MCP server, because the server is a wrapper around it. The main ones:

  • Quotas. The Data API meters requests in tokens per property, per day and per hour. Google documents 200,000 core tokens per property per day for standard properties and 2,000,000 for Analytics 360 properties. An agent that loops through many large reports can use up a standard property's daily quota and block other tools that share it.
  • Row limits. A single Data API report request returns at most 250,000 rows. Very granular requests (for example, page path by day by source) may need to be split.
  • Data thresholds. GA4 can withhold rows from reports to protect user privacy, for example when a report includes demographic data or search query information and a row covers too few users. The API marks such a response as subject to thresholding and returns only the rows that meet the thresholds, so the model sees fewer rows rather than an error.
  • Data freshness. Recent data is still processing; Google notes that data can change for 24 to 48 hours. Reports on "yesterday" may shift.
  • Permissions. The server can only see properties the credential's identity can see in GA4. If a property is missing from get_account_summaries, it is almost always an access problem, not a server bug.
  • Model behaviour. The model can misread a field, mislabel a chart or summarise selectively. The API result is correct; the interpretation layer is where errors creep in.
What are the limits: quotas, sampling, thresholds and permissions?
TaskHandled by the MCP server (default setup)?Where it is done instead
Run standard and realtime GA4 reportsYes, through the Data APINot needed
List accounts, properties, Google Ads links and key eventsYes, through the Admin APINot needed
Change settings or delete dataNo; with --allow-write it can only create annotations, custom dimensions and key eventsGA4 Admin interface
Query raw event-level dataNoGA4 BigQuery export
Open saved ExplorationsNoGA4 Explore interface

How do you keep client data secure when connecting AI agents to GA4?

Read-only access lowers the risk of an agent breaking a property, but it does not remove the risk of data going where it should not. A few controls cover most of it:

  • Least privilege in GA4. Give the credential the Viewer role, and only on the properties that need it. For agency work, a dedicated service account per client keeps one client's data out of another client's prompts.
  • Keep the read-only scope. Request analytics.readonly and do not pass --allow-write unless there is a specific, reviewed need.
  • Know where prompts and results go. Report results are sent to whichever model provider your MCP client uses. Check that provider's data-handling terms and your client contract before connecting a client property. GA4 reports are aggregated, but page paths, campaign names and custom dimensions can still contain sensitive details.
  • Protect the credentials file. The ADC JSON file grants access to everything the identity can read. Keep it out of shared folders and code repositories, and revoke it when a laptop or a staff member leaves.
  • Watch for prompt injection. Any text the agent reads, including page titles or campaign names stored in GA4, could contain instructions. Avoid giving the same agent read access to GA4 and write access to other systems without review steps in between.
  • Log usage. API calls are attributed to the Google Cloud project, so you can review Data API usage in the console and spot unexpected volume.

Teams with formal compliance needs should treat the AI client as a new data processor and review it the same way they would any analytics vendor. If you are mapping GA4 data flows for PDPA or GDPR purposes, the data security and compliance service is the relevant starting point.

What this means for businesses in Thailand

Thai marketing teams often run several GA4 properties at once: a Thai-language site, an English site, an app, and sometimes separate properties per brand. The MCP server is useful here because one assistant can list all of them through get_account_summaries and pull the same report from each, which saves a lot of switching between properties in the GA4 interface.

Two local points need attention. First, Thailand's Personal Data Protection Act (PDPA) applies to personal data, and while standard GA4 reports are aggregated, custom dimensions sometimes hold user IDs or form values that should not be there. Audit custom definitions before connecting an AI client. Second, Thai page titles and campaign names come back from the API as UTF-8 text, and the model will read them correctly, but percent-encoded Thai URLs in page path reports are hard for people to read; asking the assistant to decode them in its summary makes reports easier to share with Thai stakeholders.

The server is also a good fit for teams that already consolidate GA4, Google Ads and CRM data. It does not replace a data pipeline, but it makes the GA4 part of a reporting routine quicker to check. If your GA4 set-up itself is still messy (duplicate properties, missing key events, inconsistent UTM tagging), fix that first, because the assistant will report a messy set-up faithfully.

Frequently asked questions

Is the Google Analytics MCP server free?

The server itself is free and open source, published by Google on GitHub. You still use Google Cloud for the API project and pay whatever your AI client or model provider charges, and the Data API has usage quotas per property.

Can the Google Analytics MCP server change my GA4 settings?

Not in its default setup, because Google documents it as available for read requests only. Optional write tools exist in the repository, but they only work if you start the server with the --allow-write flag and grant the analytics.edit scope.

Does it work with Universal Analytics?

No, it works with GA4 properties through the Admin API and Data API. Universal Analytics stopped processing data and its properties are no longer available.

Do I need a service account?

No, a service account is optional. You can use your own Google user account through Application Default Credentials, or impersonate a service account if you want a separate identity with its own GA4 permissions.

Can it query BigQuery export data?

No, it only calls the Admin API and Data API, so it sees aggregated report data. For raw event-level analysis, query the GA4 BigQuery export with a separate tool.

Getting GA4 ready for AI-assisted reporting

An AI assistant reading your analytics is only as reliable as the property it reads. Clean key events, consistent channel grouping and documented custom dimensions make every answer better. Relevant Audience's GA4 setup and migration service covers property configuration, and the data integration and consolidation service brings GA4 together with your other marketing data. If you want reporting routines that run on their own, see marketing process automation.

Antonio Fernandez

Antonio Fernandez

Founder and CEO of Relevant Audience. With over 15 years of experience in digital marketing strategy, he leads teams across southeast Asia in delivering exceptional results for clients through performance-focused digital solutions.

Share to:
Copy link:

Read us often? Add Relevant Audience as a preferred source so our articles surface more in your Google results.