ga4-mcp-worker
Provides read-only tools for querying Google Analytics 4, including historical reports, realtime reports, funnel analysis, conversions, custom dimensions and metrics, account summaries, property details, annotations, and Google Ads links.
Click on "Install 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-mcp-workerHow many users did our website get in the last 7 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-worker
A read-only Google Analytics 4 MCP server that runs on Cloudflare Workers, so teammates can query GA4 from Claude with nothing installed locally — no Python, no gcloud, no ADC file, and as of this version, no shared password either. Adding it means clicking "Connect," signing in with your own Google account, and answering GA4 questions as yourself.
It mirrors the tool surface of the official
googleanalytics/google-analytics-mcp
stdio server, but calls the Google Analytics REST APIs directly, because Google's client libraries do
not run on the Workers runtime.
Read this first: docs/IMPLEMENTATION-NOTES.md § What has and has not been tested. Live end-to-end verification is in, but a few surfaces (the v1alpha endpoints, pagination) remain fixture-only.
Auth mode: per-user OAuth
Each teammate signs in with their own Google account. There is no shared secret and no single Google
credential that everyone relies on — see PRODUCTION.md § 1
and docs/PRODUCTION-PART2.md § 8 for
the full design and how it differs from the retired shared-secret mode. Sign-in is restricted to
@zuddl.com Google accounts (ALLOWED_EMAIL_DOMAIN in wrangler.toml).
GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET are still required — Google requires every app that
requests user data to be registered, and those two values are the registration, set once at deploy.
What is gone is the hand-minted refresh token and the password teammates used to type in.
Documentation
File | What it is |
SETUP-GUIDE.md (+ part 2) | First deploy, explained from scratch — assumes no prior OAuth knowledge. Creating the Google app, deploying, testing, connecting Claude. Start here. |
PRODUCTION.md (+ part 2) | The identity model, monitoring, GA4 quotas, secret rotation, local dev, runbook, security checklist, OAuth internals. Read before a wide rollout. |
Gotchas this implementation gets right, what has and hasn't been tested, and running costs. | |
| The MCP server: tools, fetch helpers, normaliser, router. Heavily commented. |
| The "sign in with Google" handler — |
| Worker config. Note |
| Template for local dev. Copy to |
Related MCP server: GA4 MCP Server
Our GA4 properties
Property ID | Name | Measurement ID | Status |
| New zuddl website GA4 property |
| Canonical — use this one unless told otherwise. |
| legacy | — | Legacy. Historical only; do not use for current reporting. |
| legacy | — | Legacy. Historical only; do not use for current reporting. |
The server is property-agnostic: every tool takes property_id, and accepts either 314138239
or "properties/314138239". If omitted, it falls back to DEFAULT_PROPERTY_ID in wrangler.toml,
which is set to the canonical property so teammates do not have to memorise a number. Call
get_account_summaries to list everything the credentials can actually see.
Tools (9)
Tool | Method + endpoint | What it is for |
| POST | The workhorse. Historical reporting. Full parameter set. |
| POST | Last ~30 minutes. Separate, smaller schema. |
| POST | Ordered step sequences and drop-off. |
| POST | Conversions, ad spend, ROAS, attribution modelling. Restricted field list. |
| GET | Custom fields with the queryable |
| GET | Everything these credentials can read. No arguments. |
| GET | Timezone, currency, service level. Timezone explains date mismatches. |
| GET | Dated notes explaining spikes and dips. |
| GET | Linked Ads accounts. Confirms whether ad-cost metrics can have data. |
run_report accepts the full official parameter set: property_id, date_ranges (a list, so
period-over-period works in one request), dimensions, metrics, dimension_filter,
metric_filter, order_bys, limit, offset, currency_code, return_property_quota.
run_realtime_report takes the same shape minus date_ranges and currency_code.
Tool descriptions are long on purpose — they carry worked examples for every filter shape, and they are the only place the model learns the request format. Treat edits to them as behaviour changes.
Endpoints
Endpoint | Auth | Purpose |
| OAuth bearer token | The MCP connection (Streamable HTTP). There is no |
| — | OAuth endpoints, implemented by |
| — | Google redirects here after sign-in. Not for humans to open directly. |
| none | Status check. |
| none | Plain-text status banner, names the current auth mode. |
Anything else returns 404.
/healthproves less in OAuth mode. There is no single shared credential to exercise, so a200only confirms the app registration is configured and the grant store (OAUTH_KV) is reachable — not that any particular person's sign-in is still valid. An individual user's grant can be expired or revoked while/healthis green. This is inherent to per-user auth, not a defect.
The Worker logs one JSON line per MCP request, per rejected auth attempt, per tool error, and per
health failure, plus OAuth-specific events (oauth_authorize_redirect, oauth_authorized,
oauth_domain_rejected, etc.). No token material is ever logged. All Google API calls send a custom
User-Agent (ga4-mcp-worker/1.0.0 (+cloudflare-workers)) so quota use is attributable.
Read-only enforcement
Three independent layers, all present:
OAuth scope — every token, whether the old shared one or a teammate's own, is requested with
https://www.googleapis.com/auth/analytics.readonlyand nothing else (plusopenid/emailfor identity in OAuth mode — seesrc/google-oauth.ts, which grant no data access). Google rejects writes server-side. This is the real guarantee. SETUP-GUIDE.md walks through verifying it withtokeninfo.Endpoint allowlist — anchored regexes checked inside the two fetch helpers before any network call. A future edit that introduces a write endpoint throws instead of dialling out.
No mutating verbs — no
PATCH,PUTorDELETEanywhere in the codebase. There are exactly threefetchcall sites: the token mint (POST),gaGet(GET), andgaPost(POST).
:runReport, :runRealtimeReport and :runFunnelReport are HTTP POST but are queries — the body
carries the report definition because it is too large for a query string. Nothing in GA4 is created
or mutated.
Quick commands
npm installnpm run typecheck && npm run dry-runnpm run deploynpm run tailcurl -s https://ga4-mcp-worker.YOUR-SUBDOMAIN.workers.dev/healthSet the two secrets both auth modes need (paste interactively — piping mangles values):
npx wrangler secret put GOOGLE_CLIENT_IDnpx wrangler secret put GOOGLE_CLIENT_SECRETConnect from Claude Code — no header, since sign-in happens through the browser:
claude mcp add --transport http --scope user ga4 https://ga4-mcp-worker.YOUR-SUBDOMAIN.workers.dev/mcpThen in an interactive claude session, run /mcp, pick ga4, and sign in with Google.
More
Gotchas, test coverage, and running costs: docs/IMPLEMENTATION-NOTES.md
First deploy walkthrough: SETUP-GUIDE.md → part 2
Hardening, monitoring, and the OAuth runbook: PRODUCTION.md → part 2
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityBmaintenanceConnects Google Analytics 4 data to Claude, Cursor and other MCP clients, enabling natural language queries of website traffic, user behavior, and analytics data with access to 200+ GA4 dimensions and metrics.10235MIT
- 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.7MIT
- 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
- FlicenseNot gradedqualityCmaintenanceEnables MCP clients to read Google Analytics 4 data, deployed as a Cloudflare Worker with service account authentication.1
Related MCP Connectors
WHOOP recovery, strain, sleep and workouts in Claude via official WHOOP OAuth. Free, open source.
GA4 conversion analyst inside Claude — funnel drops, traffic anomalies, device gaps, with numbers.
Garmin data in Claude & ChatGPT via the Garmin Health API. OAuth sign-in, no password sharing.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/prashantdasari-tech/ga4-mcp-worker'
If you have feedback or need assistance with the MCP directory API, please join our Discord server