Ga4 logo

Ga4

Queries GA4 reports and realtime data, manages property metadata, and supports service-account or OAuth authentication.

Install Ga4

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "ga4": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-ga4"
      ],
      "env": {
        "GA4_PROPERTY_ID": "YOUR_VALUE_HERE",
        "GOOGLE_APPLICATION_CREDENTIALS": "YOUR_VALUE_HERE",
        "GA4_CLIENT_ID": "YOUR_VALUE_HERE",
        "GA4_CLIENT_SECRET": "YOUR_VALUE_HERE",
        "GA4_REFRESH_TOKEN": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Claude Code command
claude mcp add --env GA4_PROPERTY_ID=YOUR_VALUE_HERE --env GOOGLE_APPLICATION_CREDENTIALS=YOUR_VALUE_HERE --env GA4_CLIENT_ID=YOUR_VALUE_HERE --env GA4_CLIENT_SECRET=YOUR_VALUE_HERE --env GA4_REFRESH_TOKEN=YOUR_VALUE_HERE --transport stdio ga4 -- npx -y mcp-ga4

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

We hit an unexpected error while testing this listing automatically.

npx -y mcp-ga4

Rate limit exceeded, please try again later - you have reached the maximum number of concurrent E2B sandboxes (20). If you need more, please visit 'https://e2b.dev/docs/billing'

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

The ga4 MCP server connects AI clients to Google Analytics 4 for standard reports, realtime queries, property metadata, and feedback tools. It uses the GA4 Data and Admin APIs, with single-property environment variables or directory-based multi-client configuration. Reach for it when an agent needs to inspect traffic, events, campaigns, data streams, or custom dimensions without manually querying Google Analytics.

Use cases

  • Run GA4 traffic and campaign reports
  • Inspect realtime activity from the last 30 minutes
  • List web and app data streams
  • Create and review custom dimensions
  • Map multiple GA4 properties to project directories

Key features

  • Standard GA4 reports with filters
  • Realtime reporting
  • Custom dimension management
  • Custom metric and data stream listing
  • Single-property and multi-client configuration
  • Service-account and OAuth authentication

Tools9

What Ga4 lets your agent do. Expand a tool for its parameters.

Self-reported~160 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

15/15 checks healthy over the last 77d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 5d ago via OSV.dev · mcp-ga4 (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
npm downloads1.6kPackage downloads in the last 30 days.
Last commit10d agoMost recent push to the default branch.
Install checkInconclusiveWe hit an unexpected error running the automated check.
Tools exposed9Callable tools this server registers over MCP.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How Ga4 works

What the ga4 MCP server does

The ga4 MCP server exposes Google Analytics 4 reporting and property-management operations through MCP. It can run reports with selected dimensions, metrics, date ranges, and filters; query realtime activity from the previous 30 minutes; and return the active property ID and client name.

Property administration tools cover custom dimensions, custom metrics, and data streams. The server can list custom dimensions, create a new custom dimension, list custom metrics, and list web or app data streams with their measurement IDs. Two additional tools let users submit feedback about a query result or suggest a query pattern or improvement.

Typical report inputs can use absolute dates in YYYY-MM-DD format or supported relative values such as today, yesterday, 7daysAgo, 30daysAgo, and 90daysAgo. Common analysis patterns include page views by page path, traffic sources, daily sessions, campaign performance, and device breakdowns.

How it works

The ga4 MCP server uses Google’s Analytics Data API for reports and the Analytics Admin API for property-management operations. It is distributed as an npm package and can run through the mcp-ga4 command or from a locally built repository. The project also uses resilience behavior based on the cockatiel package.

There are two configuration models. Single-property mode uses environment variables to select one GA4 property. Multi-client mode uses a config.json file to associate several property IDs with project directories; the active property is selected from the caller’s working directory. A configuration file can also provide a service-account credential path.

Standard reports may lag by 24–48 hours, while realtime queries cover only the latest 30 minutes. Creating custom dimensions changes the GA4 property and therefore requires an OAuth scope that permits editing when OAuth authentication is used.

Setup and configuration

Install the npm package with npm install mcp-ga4, or clone the repository, install dependencies, and run its build command. The included setup utility can register the server with Claude Desktop and Claude Code. After changing the Claude Desktop configuration, fully quit and reopen the application; Claude Code sessions should be restarted.

Authentication supports either a service-account keyfile or user OAuth credentials. Service-account use requires granting the account access to the GA4 property, with at least Viewer access. OAuth use requires a Google desktop OAuth client, the Google Analytics Data API, and the relevant environment variables. If both credential families are configured, the keyfile takes precedence.

Keep .mcp.json and credential files private. The setup supports a GA4_PROPERTY_ID for single-property mode, while multi-client deployments can store property mappings in config.json.

Tools and capabilities

  • Identify the active GA4 property and configured client.
  • Run filtered reports using dimensions, metrics, and date ranges.
  • Query realtime GA4 activity.
  • List or create custom dimensions.
  • List custom metrics.
  • List web and app data streams with measurement IDs.
  • Submit query feedback and suggest improvements.

Limitations and notes

The server requires valid Google credentials and access to the target GA4 property. Service-account authentication and OAuth are selected once at startup; a later API permission error is returned rather than triggering silent credential failover. Read-only OAuth scopes are sufficient for reporting, but creating custom dimensions requires the Analytics Admin API and an editing scope.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Ga4

ga4 is an MCP server that connects AI clients to Google Analytics 4 through the Data and Admin APIs. Its main tools run standard and realtime reports, identify the active property, list or create custom dimensions, list custom metrics and data streams, and submit query feedback or improvement suggestions.

Install it with `npm install mcp-ga4`, or clone the repository and run `npm install` followed by `npm run build`. The `mcp-ga4-setup` command can register the server with detected Claude Desktop and Claude Code installations.

Use either a Google service-account keyfile or user OAuth credentials. Set `GOOGLE_APPLICATION_CREDENTIALS` for a keyfile, or provide `GA4_CLIENT_ID`, `GA4_CLIENT_SECRET`, and `GA4_REFRESH_TOKEN` for OAuth. If both methods are configured, the keyfile is selected.

Yes, the setup utility can register ga4 with Claude Desktop and Claude Code. It detects those clients, preserves other Claude Desktop settings, and supports flags to target either client individually.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewGa4 AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/ga4?style=directory)](https://allmcps.com/mcp/ga4)
HTML Embed
<a href="https://allmcps.com/mcp/ga4"><img src="https://allmcps.com/api/badge/ga4?style=directory" alt="Ga4 on AllMCPs" /></a>