MCP GA4 B2 TECH

Model Context Protocol · GA4 Admin API + Data API v1

Run Analytics
straight from Claude.

An MCP server that connects Claude to your GA4 properties — audit key events and retention, run core and realtime reports, mark conversions, register custom dimensions and link Google Ads without opening the Analytics UI. Embedded Google login. Status: LIVE.

36 tools · Admin + Data API · Google login · multi-tenant

Admin API + Data API v1 Reports in one sentence Realtime: last 30 minutes preview=true by default confirm=true on irreversible tools Closes the measurement loop Multi-tenant on Vercel Admin API + Data API v1 Reports in one sentence Realtime: last 30 minutes preview=true by default confirm=true on irreversible tools Closes the measurement loop Multi-tenant on Vercel
What it is

Your GA4, operated in natural language

MCP GA4 B2 TECH is a Model Context Protocol server that gives Claude real access to your properties — not a chatbot that guesses, but typed calls against both official Google Analytics 4 APIs.

Real connection

Claude talks to your property

Audit the account → property → stream hierarchy, key events, custom definitions and retention through the Admin API; run core and realtime reports through the Data API. "Who's on the site right now?" becomes a call, not a guess.

The full loop

Closes the fleet's measurement loop

The sibling MCPs (Meta Ads, Google Ads, GTM, Cloudflare, Instagram) create the campaign, the tag and the tracking; GA4 audits the property, creates what's missing, links Google Ads and reads the result. All in one conversation.

Status

LIVE in production

Multi-tenant deploy at mcp-ga4-one.vercel.app — embedded OAuth 2.1 Authorization Server with Google-native login, tokens encrypted in a dedicated Supabase, cache in Upstash. Same stack as the sibling MCPs.

What it already does

The full tool catalog

36 tools grouped by function — from property audits to realtime reports, from key events to the Google Ads link. Everything below is implemented and live.

Auth & onboarding

6 tools
  • ga4_loginStarts the Google login (browser consent).
  • ga4_submit_callbackFinishes the login by submitting the callback URL.
  • ga4_token_statusReports whether the credential is valid, its scopes and expiry.
  • ga4_refresh_tokenMints a fresh access token from the stored refresh token.
  • connect_hotmartLinks your student purchase: emails a 6-digit code to the purchase address.
  • confirm_hotmartConfirms the code and unlocks access.

Audit — accounts & streams

6 tools
  • list_accountsEvery GA4 account the credential can see.
  • list_propertiesProperties under an account.
  • get_propertyOne property's settings (timezone, currency, service level).
  • list_data_streamsWeb/iOS/Android streams; web carries the G- measurement id.
  • get_data_streamDetails of a specific stream.
  • get_tracking_snippetBuilds the gtag.js snippet from the web stream — deterministic, no quota spent.

Audit — measurement

5 tools
  • list_key_eventsEvents marked as conversions.
  • list_custom_dimensionsRegistered custom dimensions.
  • list_custom_metricsRegistered custom metrics.
  • list_google_ads_linksGoogle Ads accounts linked to the property.
  • get_data_retentionEvent-data retention settings (2 or 14 months).

Reports — Data API

4 · highlight
  • run_reportCore report: metrics × dimensions × date range (presets like last_28d), with filtering, ordering and limits. Rows come back flat and coerced.
  • run_realtime_reportActivity from the last 30 minutes — who's on the site right now.
  • get_metadataEvery valid dimension/metric for the property, including custom ones.
  • check_compatibilityWhether a dimension/metric combo can run together — without burning report quota.

Writes — preview by default

6 tools
  • create_propertyCreates a new property.
  • update_propertyChanges mutable settings (partial update).
  • create_data_streamCreates a web stream and returns the G- id.
  • create_key_eventMarks an event as a conversion (once_per_event / once_per_session).
  • create_custom_dimensionRegisters a custom dimension — immutable once created.
  • create_custom_metricRegisters a custom metric — immutable once created.

Irreversible

4 · confirm=true
  • delete_key_eventStops counting an event as a conversion (affects Ads imports).
  • archive_custom_dimensionRetires a custom dimension — irreversible.
  • archive_custom_metricRetires a custom metric — irreversible.
  • update_data_retentionSets retention (2m/14m) — shrinking the window permanently deletes older data.

Integrations

5 tools
  • create_google_ads_linkLinks a Google Ads account — GA4 conversions and audiences become available in Ads.
  • delete_google_ads_linkUnlinks the account (destructive, requires confirm) — conversion import stops.
  • list_measurement_protocol_secretsLists a stream's Measurement Protocol secrets.
  • create_measurement_protocol_secretCreates an MP secret for server-side ingestion.
  • delete_measurement_protocol_secretDeletes an MP secret (destructive, confirm) — also the rotation path.

From X-ray to results in one conversation: audit the property → create what's missing → create_google_ads_linkrun_report.

Write safety model

Claude doesn't delete your data on its own

Retention, conversions and custom definitions touch data that doesn't come back — so every write goes through explicit barriers, carried over from the sibling MCPs.

preview=true by default

Every write returns the exact payload it would send without calling the API. It only executes when you pass preview=false.

Irreversible tools require confirm=true

delete_key_event, the archive_* tools and update_data_retention — which warns that shrinking the window deletes older data. Without confirm, they return a warning and execute nothing.

Local validation before any call

Ids must be numeric resource names (path-injection defense); enums accept friendly aliases (web, 2m) and reject anything else with the allowed list; GA4 naming rules are enforced with clear messages.

Tenant is never an argument

The tenant is derived from your Google account and resolved per request. No tool accepts "which client" — operating the wrong property is impossible.

Encrypted tokens, clean logs

Refresh tokens AES-256-GCM-encrypted in a dedicated Supabase, default-deny RLS on every table; JSON logs carry no PII (email only as SHA-256) and errors are sanitized — raw Google payloads never leak.

Least-privilege scopes

Only analytics.readonly and analytics.edit (+ openid/email/profile). User-management scopes are not requested — the MCP cannot touch who has access to your account.

How to connect

Up and running in minutes

Hosted, multi-tenant, zero setup: add the connector, log in with your Google account and Claude is operating your properties. Then just ask.

Zero setup

Hosted — mcp-ga4-one.vercel.app

Add the MCP server as a connector in Claude and log in to Google. Nothing to install; one login does everything.

  1. Add the connector. In Claude.ai → Settings → Connectors → Add custom connector, paste https://mcp-ga4-one.vercel.app/api/mcp. In Claude Code, use the command below.
    # Claude Code
    claude mcp add --transport http \
      ga4 https://mcp-ga4-one.vercel.app/api/mcp
  2. Log in to Google. The OAuth handshake opens the Google consent screen automatically; in Claude Code, complete it via /mcp. B2Tech student with the same email as your purchase? Access links automatically — otherwise run connect_hotmart.
  3. Confirm. Run ga4_token_status to validate the credential and list_accounts to see your GA4 accounts. Ready to operate.
First steps

What to ask Claude

Real requests the server handles end to end — writes always preview first.

  1. Audit.
    # you, in the chat:
    "Audit property 123: which key events
     exist and what's the data retention?"
    # → full X-ray via the Admin API
  2. Report.
    "Sessions and active users by day for
     the last 28 days" · "Who's on the site now?"
    # → run_report + run_realtime_report
  3. Configure.
    "Mark generate_lead as a conversion and
     link Google Ads account 123-456-7890"
    # → preview first; runs with preview=false

Frequently asked questions

Still unsure about something? Write to bruno@b2tech.io.

How much does it cost?
The MCP GA4 server is a B2Tech student benefit: access to the hosted server is unlocked by an active Hotmart purchase. If your Google login email matches the purchase email, the link is automatic; otherwise connect_hotmart emails a 6-digit code to the purchase address and confirm_hotmart completes the link.
Is it safe? Can Claude delete my data?
Writes are born with preview=true — the tool returns the exact payload without calling the API and only executes with preview=false. Irreversible tools (delete_key_event, archiving custom dimensions/metrics, update_data_retention) require confirm=true and carry destructiveHint; shrinking the retention window explicitly warns that older data is permanently deleted.
Do I need to install anything?
No. The server is hosted and multi-tenant (mcp-ga4-one.vercel.app) and the source code is private — there is no version to run on your own machine. You just add the connector in Claude and log in with your Google account; we handle the rest.
Where do my tokens live?
Google refresh tokens are AES-256-GCM-encrypted in a dedicated Supabase project with default-deny RLS on every table. The tenant is derived from your Google account and resolved per request — no tool accepts a token or tenant as an argument. Structured logs carry no PII: email appears only as SHA-256.
Which scopes does the login request?
Least privilege: analytics.readonly, analytics.edit, openid, email and profile. User-management scopes (analytics.manage.users) are not requested — the MCP cannot touch who has access to your account.
What reports can I run?
run_report crosses metrics × dimensions over a date range (presets like last_28d or explicit dates), with filtering, ordering and limits; run_realtime_report shows the last 30 minutes. get_metadata lists every valid dimension/metric for the property (including custom ones) and check_compatibility tells you whether a combination works — without burning report quota.
What if I exhaust the Data API quota?
GA4 meters quota tokens per property. When it runs out, the MCP returns an actionable rate-limit message and never retries on its own. Large reports come back size-capped with an informational _truncated row — not an error, just the tail trimmed to fit the context.
Start now

Stop clicking through the GA4 UI.
Ask Claude — it audits, configures and reports.

Properties, streams, key events, custom definitions, the Google Ads link and core + realtime reports — from X-ray to results in one conversation, with writes in preview and irreversible tools locked behind confirm=true.

36 tools · Google login · multi-tenant on Vercel