ga4-mcp
Provides read-only access to Google Analytics 4 properties, including account and property details, custom dimensions and metrics, standard and realtime reports, funnel analysis, and conversion reporting.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ga4-mcpHow did organic traffic change over the last 28 days?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ga4-mcp
A Google Analytics 4 MCP server with a one-command setup. It is a TypeScript rewrite of Google's google-analytics-mcp. You don't need gcloud, Python, OAuth clients or env vars: give it a service account key and pick your agents.
npx @saeedsakib/ga4-mcp setupSetup does four things:
Asks for the path to your service account JSON key and stores a copy in
~/.config/ga4-mcp/(owner-only permissions).Checks access live. If an API isn't enabled or the service account can't see any property, it tells you exactly what to fix and waits while you do.
Adds the MCP server to Claude Code, Cursor and/or Codex, and installs the bundled
ga4-mcpskill so the agent knows how to query GA4 well.Prints a config snippet for any other MCP client or custom harness.
Restart your agent and ask something like "How did organic traffic change over the last 28 days?"
Before you start: get a service account key
In Google Cloud Console, pick or create a project and enable the Google Analytics Admin API and the Google Analytics Data API.
Go to IAM & Admin → Service Accounts → Create service account. It needs no Cloud roles.
Open the service account, go to Keys → Add key → Create new key → JSON, and download it.
In Google Analytics, go to Admin → Property access management → + → Add users. Paste the service account email (
…@….iam.gserviceaccount.com), choose Viewer and save. Repeat for each property you want the agent to see.
Setup checks each of these steps and tells you which one is missing.
Related MCP server: GA4 MCP Server
Commands
Command | What it does |
| Store a key, verify access, configure agents |
| Show the stored key and configured agents, then re-check access |
| Remove the server and skill from agents, and optionally delete the key |
| Start the stdio MCP server (this is what agents run) |
Custom harnesses
Any MCP client that can spawn a stdio server works. Run setup once to store the key, then point your client at:
{
"mcpServers": {
"ga4": { "command": "npx", "args": ["-y", "@saeedsakib/ga4-mcp"] }
}
}Give your agent skills/ga4-mcp/SKILL.md as instructions if it supports skills or system prompts.
Tools
All tools are read-only and match upstream's tool names and arguments.
Tool | Description |
| Accounts and properties the service account can see |
| Property settings (time zone, currency, …) |
| Google Ads accounts linked to a property |
| Notes left on dates (releases, campaigns) |
| A property's custom definitions |
| Core Data API report |
| Last 30 minutes of activity |
| Funnel steps with drop-off, breakdowns and next actions |
| Ad cost, ROAS and attributed conversions |
Where things are written
Path | |
Key |
|
Claude Code |
|
Cursor |
|
Codex |
|
Setup only changes its own ga4 entry and leaves the rest of each config file as it was.
Development
bun install
bun test
bun run typecheck
bun run buildThe published package runs on Node 20.11 or later.
License
Apache-2.0. See NOTICE for attribution to the original Google project.
Related MCP Connectors
Read and edit GA4, Search Console and Google Tag Manager from any MCP client. 29 tools.
Hosted MCP server for GA4, Google Ads and Search Console. Google OAuth, nothing to install.
Connect Google Analytics to ChatGPT. Query GA4 data in plain English and get instant insights.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables LLM applications to query Google Analytics 4 data through standard MCP interfaces, supporting real-time data, custom reports, and metadata discovery.563 npm1MIT
- AlicenseAqualityBmaintenanceConnects MCP clients like Claude Desktop to Google Analytics 4 Data API, enabling natural language queries for reports, top pages, traffic sources, conversions, realtime users, and period comparisons.731 PyPIMIT
- AlicenseNot gradedqualityDmaintenanceEnables querying Google Analytics 4 data using natural language through MCP clients like Claude and Cursor, supporting 200+ dimensions and metrics for traffic, user behavior, and e-commerce analysis.MIT
- AlicenseAqualityDmaintenanceEnables querying Google Analytics 4 properties using natural language through MCP clients. Supports customizable reports with any dimensions and metrics, listing properties, and real-time data.4MIT