Skip to main content
MCP server CX Codex

Google Analytics 4 MCP — Claude Code MCP server: setup

This read-only server lets an agent query GA4 reports and inspect account configuration. Use it to explore metrics, validate report fields, or examine a funnel.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add --env GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS> --env GA4_LOG_LEVEL=<GA4_LOG_LEVEL> --transport stdio google-analytics-4-mcp -- uvx scalably-ga4-mcp
Open on GitHub

What Google Analytics 4 MCP does

The server exposes 17 tools for GA4 standard, batch, pivot, realtime, and funnel reports. An agent can also inspect the dimensions and metrics catalog, check whether fields work together, and list properties, streams, audiences, key events, and other administrative details.

Set up a Google Cloud project with the Google Analytics Data API and Google Analytics Admin API enabled. You’ll also need a service-account JSON key and Viewer access to each GA4 property you want to query; set the key path in GOOGLE_APPLICATION_CREDENTIALS. Queries fail for properties that have not granted that access. The server is read-only. Realtime reports cover the last 30 minutes, while standard report data can lag by 24 to 48 hours.

What it helps with

  • run a GA4 report for a chosen property
  • submit several reports in one batch call
  • check whether a dimension works with a metric
  • inspect funnel steps and their drop-offs
  • find the properties visible to a service account

Example prompts for the agent

  • Use Google Analytics 4 MCP to list the GA4 properties this service account can access.
  • Build a GA4 report for country and device category on the selected property.
  • Check whether this dimension and metric are compatible, then report on the funnel.

How to install Google Analytics 4 MCP

Platform CLI

claude mcp add --env GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS> --env GA4_LOG_LEVEL=<GA4_LOG_LEVEL> --transport stdio google-analytics-4-mcp -- uvx scalably-ga4-mcp

Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from scalably-ga4-mcp <command>

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about Google Analytics 4 MCP

How do I install Google Analytics 4 MCP in Claude Code?

Replace the placeholder with the service-account JSON key path, then run claude mcp add ga4-mcp -e GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS> -- uvx scalably-ga4-mcp.

What does Google Analytics 4 MCP do?

It gives an agent read access to GA4 reports and administrative information. Its tools cover standard, batch, realtime, pivot, and funnel reports.

What access does the server need for a GA4 property?

Enable the Google Analytics Data API and Google Analytics Admin API in Google Cloud, create a service account, then grant its email Viewer access to each property.

Similar MCP servers

All MCP servers for Data and databases →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor