MCP.Market

Ga4 MCP server

by mharnett·io.github.mharnett/ga4·v2.0.1

Google Analytics 4 MCP: reports, realtime data, custom dimensions, data streams.

A92/100grade A
What users say
No reviews yet
Be the first
Safety scan
A92/100

full report

Adoption
Growing

0 stars145 downloads/wk

Reviews

Write one

Nobody has reviewed Ga4 yet.

If you have run it, two minutes of your experience saves the next person an afternoon.

Ga4 tools (9, 3 write)

write = sends, deletes, buys or posts

Read from the package source without running it. The installed server may list more.

  • ga4_create_custom_dimensionwrite action

    Register a new custom dimension in a GA4 property.

  • ga4_get_client_context

    Get the current GA4 client context based on working directory. Call this first to confirm which GA4 property you're working with.

  • ga4_list_custom_dimensions

    List all registered custom dimensions for a GA4 property.

  • ga4_list_custom_metrics

    List all registered custom metrics for a GA4 property.

  • ga4_list_data_streams

    List all data streams for a GA4 property.

  • ga4_realtime_report

    Query GA4 Realtime Report (last 30 minutes).

  • ga4_run_reportwrite action

    Query GA4 historical report. Common patterns: top pages (dimensions="pagePath", metrics="screenPageViews"), traffic sources (dimensions="sessionSource,sessionMedium", metrics="sessions,totalUsers"), daily trend (dimensions="date", metrics="sessions").

  • ga4_send_feedbackwrite action

    Send feedback about the GA4 MCP tools. Use when a query didn't work as expected.

  • ga4_suggest_improvement

    Log a GA4 query pattern that didn't work well, so it can be improved.

Public scan report

scanner v0.1.9 · 2026-09-27 · same rubric, same numbers if you re-run it

no findings
  • Code scan11 source files scanned25/25
  • –Live reliabilityno gateway calls yet and no remote to proben/a
  • –Tool poisoningtools not inspected (local package is not executed); not countedn/a
  • Auth qualitylocal package, no credentials required12/15
  • Maintenancelast push 19 days ago15/15
  • Maintainer identityregistry namespace matches repository owner; GitHub account older than a year8/10
Overall 92/100. Components that don't apply are left out of the denominator. Any critical finding is an F.RubricAppeal a findingJSON

How Ga4 compares

Against every graded MCP server, from our own scans and uptime checks. Updated after each scan run.

Safety score
92/100
higher than 95% of 48,255 servers
Tools
9
the typical server has 7
Tools that change things
33%
typical: 0%. Fewer write tools means less an agent can break
Downloads a week
145
more than 70% of 12,191 servers with a package

What its tools let an agent do: 6 read · 3 change

Install Ga4 in Claude Code, Cursor or VS Code

Runs npx -y mcp-ga4 on your machine. Read the scan report first; the gateway never runs local packages.

claude mcp add ga4 -- npx -y mcp-ga4
Add to Cursor

What the publisher says

From the Ga4 repository's README, as published. We do not edit it. Read it on GitHub

mcp-ga4

MCP server for Google Analytics 4 -- run reports, realtime data, custom dimensions, and property management via Claude.

Features

  • 9 tools covering reporting, realtime data, custom dimensions/metrics, data streams, and feedback
  • Two configuration modes: single-property (env vars) and multi-client (config.json)
  • Supports both service account and OAuth credentials
  • Relative date support (today, yesterday, 7daysAgo, 30daysAgo, 90daysAgo)
  • Built on official Google SDKs with resilience patterns

Installation

npm install mcp-ga4

Or clone the repository:

git clone https://github.com/mharnett/mcp-ga4.git
cd mcp-ga4
npm install
npm run build

Authentication

mcp-ga4 supports two credential families. Selection is deterministic and happens once, at startup: an explicit keyfile / service account wins, then user OAuth, and if neither is configured the server exits with a loud onboarding error naming both options. There is no machine-local credentials path baked into the code and no silent runtime failover -- the only credential inputs are environment variables and (optionally) your own per-user config.json. (A later 403 therefore surfaces as the API error, not as a silent switch to the other credential family.)

Precedence: when both families are configured, the **keyfile /

service account takes precedence** over user OAuth.

Option A: Service account (recommended for unattended / server use)

Use this for any always-on or server deployment. Point GOOGLEAPPLICATIONCREDENTIALS (or config.json credentialsfile) at a JSON keyfile. The service account must be granted access on the GA4 property** (Admin → Property Access Management → add the service-account email with at least Viewer). No refresh token is involved -- the server hands the keyfile to the GA4 SDKs directly:

GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json

The keyfile may be a real service-account key or an authorized_user OAuth token dump -- both are accepted via the keyFile option.

Option B: User OAuth (personal / interactive use)

Use this if you want the server to act as a Google user (your own GA4 login). You bring your own Google OAuth client and mint a refresh token once.

create an OAuth 2.0 Client ID of type Desktop app. Enable the Google Analytics Data API (and the Admin API if you use the custom-dimension tools).

  1. In Google Cloud Console,

browser, prints the token to stdout):

  1. Export your client credentials and run the token helper (uses PKCE, opens a
export GA4_CLIENT_ID=...            # from the Desktop-app client
   export GA4_CLIENT_SECRET=...
   node get-refresh-token.cjs          # or: npm run auth

Do not redirect this command's stdout to a shared log -- the refresh

token is printed there by design.

server reads these three env vars:

  1. Copy the printed GA4REFRESHTOKEN=... into your environment. At runtime the
GA4_CLIENT_ID=...
   GA4_CLIENT_SECRET=...
   GA4_REFRESH_TOKEN=...

The scope requested is read from config.json oauth.scope (see below), so the helper and the running server never disagree on what you granted.

Scopes (minimum grant)

Scopes live in config.json under oauth.scope. The committed default is:

https://www.googleapis.com/auth/analytics.readonly
https://www.googleapis.com/auth/analytics.edit

analytics.edit is required because ga4createcustom_dimension mutates the property via the Admin API. If you only need read access, override oauth.scope in your own config.json to analytics.readonly alone and re-run the helper.

Configuration

Security: Never share your .mcp.json file or commit it to git -- it may contain API credentials. Add .mcp.json to your .gitignore.

Mode 1: Single Property (env vars)

Shortened. The full README is on GitHub.

Nothing above is checked by us. What we check is on the safety report.

Ga4: common questions

Is Ga4 MCP server safe?
Yes, by our scan: it is graded A (92/100). Read the Ga4 safety report
How do I install Ga4?
It runs on your machine. Copy the Claude Code, Cursor, VS Code or Claude Desktop config from the install section.
Does Ga4 need an API key?
No secret keys are declared. It reads 2 settings from the environment.
Is Ga4 maintained?
The last commit was 56 days ago (2026-09-09). The latest release is v2.0.1.
What can I use instead of Ga4?
Servers from other publishers that do the same job: AdLoop MCP server.
How does Ga4 compare with other MCP servers?
safety score 92/100 (higher than 95% of 48,255 servers); tools 9 (the typical server has 7); tools that change things 33% (typical: 0%. Fewer write tools means less an agent can break). Full comparison.

Alternatives to Ga4

Same job from other publishers: the closest match first, then the best rated.

  • AdLoop
    Google Ads, Reddit Ads, GA4 and Tag Manager in your AI client, with a preview before every change.
    A

More from mharnett →