# Google Analytics 4 MCP

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.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI
- Author: scalably-io
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/scalably-io/ga4-mcp
- Updated: 2026-10-06
- HTML: https://affpapa.org/en/nevibecode/mcp/google-analytics-4-mcp

## What it 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.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `GOOGLE_APPLICATION_CREDENTIALS`, `GA4_LOG_LEVEL` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
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>

### Codex

**Platform CLI**
```bash
codex mcp add google-analytics-4-mcp --env GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS> --env GA4_LOG_LEVEL=<GA4_LOG_LEVEL> -- 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>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "google-analytics-4-mcp": {
            "command": "uvx",
            "args": [
                "scalably-ga4-mcp"
            ],
            "env": {
                "GOOGLE_APPLICATION_CREDENTIALS": "<GOOGLE_APPLICATION_CREDENTIALS>",
                "GA4_LOG_LEVEL": "<GA4_LOG_LEVEL>"
            }
        }
    }
}
```
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>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "google-analytics-4-mcp": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "scalably-ga4-mcp"
            ],
            "env": {
                "GOOGLE_APPLICATION_CREDENTIALS": "<GOOGLE_APPLICATION_CREDENTIALS>",
                "GA4_LOG_LEVEL": "<GA4_LOG_LEVEL>"
            }
        }
    }
}
```
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>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS> -e GA4_LOG_LEVEL=<GA4_LOG_LEVEL> 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>

## When to use it
- 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
- 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.

## Similar
- [World Monitor](https://affpapa.org/en/nevibecode/mcp/world-monitor.md) — MCP server · ★ 89609
- [Scrapling MCP Server](https://affpapa.org/en/nevibecode/mcp/scrapling-mcp-server.md) — MCP server · ★ 89899
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16730
- [PostHog MCP Server](https://affpapa.org/en/nevibecode/mcp/posthog-mcp-server.md) — MCP server · ★ 40459
- [dbx](https://affpapa.org/en/nevibecode/mcp/dbx.md) — MCP server · ★ 27844
- [Metabase](https://affpapa.org/en/nevibecode/mcp/metabase.md) — MCP server · ★ 49863

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
