GA4 Analytics MCP

GA4 MCP server: Google Analytics 4 reports, realtime data, property admin and Search Console.

Dokumentasi

GA4 Analytics MCP is a free Google Analytics MCP server that gives your AI agent 16 tools for Google Analytics 4 and Google Search Console. You can ask for a report in plain language, check what is happening on the site right now, or create a key event, without opening the Analytics interface. It runs on your machine as a VS Code extension and talks to your own Google account.

There is no Python to install and no config file to edit. You install the extension, sign in to Google once, and the tools appear in every agent it finds: VS Code Copilot, Claude Code, Cursor, OpenAI Codex, Google Gemini, Windsurf, Continue.dev, and Cline.

What you can ask

  • “Show me my top 10 pages by views for the last 7 days”
  • “Where did last month’s sign-ups come from?”
  • “How many people are on the site right now?”
  • “Compare this month’s sessions with last month’s, by channel”
  • “Which custom dimensions does this property have?”
  • “Create a key event for form_submit”

The Google Analytics MCP tools

ToolWhat it does
get_account_summariesList every Analytics account and property your sign-in can open
get_property_detailsShow a property’s name, time zone, currency, and industry
run_reportRun a GA4 report with any dimensions, metrics, date ranges, filters, and ordering
run_realtime_reportRun a realtime report for the last 30 minutes
get_custom_dimensions_and_metricsList the property’s custom dimensions and metrics
list_google_ads_linksShow which Google Ads accounts are linked to the property
ga4_adminRead and change the property’s setup (see below)

run_report is a direct line to the GA4 Data API. It takes more than one date range, so a single call can compare two periods. The agent chooses the dimensions and metrics from your question, and you can name them yourself when you want something exact, such as sessionDefaultChannelGroup with keyEvents.

The GA4 admin tool

Property setup goes through one admin tool with named actions. Google’s own Analytics MCP server is read only, so it has no equivalent of this tool.

KindActions
ReadList data streams, key events, audiences, and Firebase links. Read a Measurement Protocol secret
WriteCreate or update a property. Create or rename a data stream. Create a key event. Create a Measurement Protocol secret
DestructiveDelete a property, a data stream, or a key event (each needs confirmation)

The three delete actions only run with confirm: true. The agent is told this up front, so it has to ask you before it removes anything.

Search Console tools in the same extension

The extension also carries six Google Search Console tools, for search performance, URL inspection, and sitemaps, plus two for the Indexing API. Having both in one place lets the agent answer questions that need both, such as “which pages get impressions in search but lose visitors on arrival?”. They have their own page: Google Search Console MCP.

Three things people use it for

A weekly report without the interface

Ask for sessions, engaged sessions, and key events by channel for the last seven days against the seven before. The agent runs one report with two date ranges and gives you the table and the changes.

Checking tracking after a deploy

Ship a change, then ask for a realtime report of events by name. If the new event appears, tracking works. You stay in the editor where the tracking code is.

Setting up a new property

Ask the agent to create a property, add a web data stream for your domain, and mark your conversion event as a key event. That is three admin actions and no clicking through the Admin screens.

Set it up

A setup wizard opens the first time you launch the extension. There are three ways to sign in.

MethodBest forWhat you need
Application Default CredentialsDevelopers who use the gcloud CLIOne terminal command
Service account keyTeams and shared machinesA JSON key file, and the Viewer role on the property
OAuthEveryone elseA Google Cloud project with a Desktop app OAuth client

Whichever you pick, enable the Google Analytics Data API in your Google Cloud project. Enable the Google Analytics Admin API as well if you want the admin tool, and the Google Search Console API for the search tools. Reports need read access to the property. The admin write actions need the Editor role.

Finding your GA4 property ID

The wizard asks for a property ID. In Google Analytics, open Admin, then Property details. The ID is the number at the top. You can also skip it: ask the agent to list your properties, or name a property ID in the request.

Using Google Analytics MCP with Claude Code, Cursor and other agents

You do not add a server entry by hand. The extension writes the registration for each agent it finds: ~/.claude.json for Claude Code, ~/.cursor/mcp.json for Cursor, ~/.codex/config.toml for OpenAI Codex, ~/.gemini/settings.json for Gemini, and the matching files for Windsurf, Continue.dev, and Cline. VS Code Copilot picks it up through the VS Code API.

Open a new session in any of them and the tools are in the tool list. To limit which agents get them, switch the others off in VS Code settings under ga4Mcp.agents. The command “GA4 MCP: Remove from All Agents” takes every registration back out.

How it compares with Google’s official Google Analytics MCP server

Google publishes its own Google Analytics MCP server. It is a good choice if you want Google’s own reading tools and you are comfortable in Python. The two differ in what they change and how they install.

GA4 Analytics MCP (this extension)Google’s Analytics MCP server
Reports and realtimeYesYes
Change property setupYes, through ga4_adminNo, read only
Search ConsoleYes, six toolsNo
InstallA VS Code extensionPython 3.10 or later with pipx or uv
Sign-inApplication Default Credentials, service account, or OAuthApplication Default Credentials
Agent setupAutomatic for eight agentsYou configure each MCP client

Google’s side of this table was read from its developer documentation on November 12, 2026.

Limits

  • It reads GA4 properties. Universal Analytics data is not available through these APIs.
  • Reports are subject to GA4’s own API quotas. Ask for the quota in a report if you run many.
  • It does not edit audiences or custom dimensions. It lists them.

Common questions

Is this Google Analytics MCP server free?

Yes. The extension is free and MIT licensed, and Google does not charge for the Analytics APIs it uses.

Does it work with Claude Code and Cursor?

Yes. Both are registered automatically, along with Copilot and five other agents.

Is GA4 MCP the same thing as Google Analytics MCP?

Yes. GA4 is Google Analytics 4, the current version of Google Analytics. The extension is named GA4 Analytics MCP.

Can the agent change my Analytics settings by accident?

Reports cannot change anything. Changes go through the admin tool, your agent’s permission settings decide whether it asks before a tool call, and deletes need an explicit confirmation on top.

Where does my analytics data go?

Nowhere except Google. The MCP server runs on your own machine and calls Google’s APIs with your credentials. There is no telemetry, and the sign-in token is kept in VS Code’s encrypted secret storage.

Use it without VS Code

GA4 Analytics MCP is also on npm, for Claude Code, Cursor, or any other MCP client. It needs Node.js 22 or newer.

npx -y @renzo.johnson/ga4-mcp

In Claude Code, one command adds it:

claude mcp add ga4-mcp -- npx -y @renzo.johnson/ga4-mcp

Outside VS Code there is no setup wizard, so the server takes your Google sign-in from the environment. It uses the first one it finds: an OAuth client ID, secret, and refresh token in GOOGLE_OAUTH_CLIENT_ID, GOOGLE_OAUTH_CLIENT_SECRET, and GOOGLE_OAUTH_REFRESH_TOKEN; a key file named in GOOGLE_APPLICATION_CREDENTIALS; or the gcloud CLI’s Application Default Credentials. The npm package page has the config block for Claude Code and Cursor.

Install it

GA4 Analytics MCP is free and MIT licensed.

Listed in the official MCP Registry as com.renzojohnson/ga4-mcp.

Related