# Google Analytics

> Query GA4 reports, funnels, and realtime data from an AI agent.

[Canonical HTML page](https://top-mcps.com/mcp/google-analytics) · [server.json](https://top-mcps.com/mcp/google-analytics.json) · [methodology](https://top-mcps.com/about/methodology)

## Install

### Claude Desktop — `claude_desktop_config.json`

Paste under mcpServers. Fully quit and reopen Claude after editing.

```json
{
  "mcpServers": {
    "google-analytics": {
      "command": "pipx",
      "args": [
        "run",
        "analytics-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "${GOOGLE_APPLICATION_CREDENTIALS}"
      }
    }
  }
}
```

### Claude Code — `CLI or .mcp.json`

Run from your repo. Commit .mcp.json to share with your team.

```shell
# export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json (or gcloud ADC)
claude mcp add google-analytics -- pipx run analytics-mcp
```

### Cursor — `.cursor/mcp.json`

Global path: ~/.cursor/mcp.json. Reload window after editing.

```json
{
  "mcpServers": {
    "google-analytics": {
      "command": "pipx",
      "args": [
        "run",
        "analytics-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "${GOOGLE_APPLICATION_CREDENTIALS}"
      }
    }
  }
}
```

### VS Code — `.vscode/mcp.json`

VS Code uses the "servers" key (not "mcpServers").

```jsonc
{
  "servers": {
    "google-analytics": {
      "command": "pipx",
      "args": [
        "run",
        "analytics-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "${GOOGLE_APPLICATION_CREDENTIALS}"
      }
    }
  }
}
```

### Windsurf — `~/.codeium/windsurf/mcp_config.json`

Open via Cascade → hammer icon → Configure.

```json
{
  "mcpServers": {
    "google-analytics": {
      "command": "pipx",
      "args": [
        "run",
        "analytics-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "${GOOGLE_APPLICATION_CREDENTIALS}"
      }
    }
  }
}
```

### Cline — `cline_mcp_settings.json`

Open via the Cline sidebar → MCP Servers → Edit.

```json
{
  "mcpServers": {
    "google-analytics": {
      "command": "pipx",
      "args": [
        "run",
        "analytics-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "${GOOGLE_APPLICATION_CREDENTIALS}"
      }
    }
  }
}
```

### Continue — `~/.continue/config.json`

Continue uses modelContextProtocolServers with a transport block.

```json
{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "pipx",
          "args": [
            "run",
            "analytics-mcp"
          ],
          "env": {
            "GOOGLE_APPLICATION_CREDENTIALS": "${GOOGLE_APPLICATION_CREDENTIALS}"
          }
        }
      }
    ]
  }
}
```

### Codex CLI — `~/.codex/config.toml`

Codex uses TOML. Each server is a [mcp_servers.<name>] subtable.

```shell
# ~/.codex/config.toml
[mcp_servers.google-analytics]
command = "pipx"
args = [
  "run",
  "analytics-mcp",
]
env = { GOOGLE_APPLICATION_CREDENTIALS = "${GOOGLE_APPLICATION_CREDENTIALS}" }
```

### Zed — `~/.config/zed/settings.json`

Zed calls them "context_servers". Settings live-reload on save.

```jsonc
{
  "context_servers": {
    "google-analytics": {
      "command": {
        "path": "pipx",
        "args": [
          "run",
          "analytics-mcp"
        ]
      },
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "${GOOGLE_APPLICATION_CREDENTIALS}"
      }
    }
  }
}
```

### ChatGPT — `ChatGPT → Apps directory`

Google Analytics doesn't ship a hosted HTTPS endpoint today. ChatGPT supports remote MCP servers only — to use this server in ChatGPT you'll need to deploy it to a public HTTPS URL first (e.g. via Cloudflare Workers or Vercel) or wait for an official remote build.

```none

```

## At a glance

- **Maintainer:** Google Analytics
- **Transport:** stdio
- **Auth model:** OAuth 2.1
- **Required secrets:** GOOGLE_APPLICATION_CREDENTIALS
- **Supported clients:** Claude, Cursor, VS Code, Windsurf, Any MCP-compatible client, GA4 property
- **License:** Apache-2.0
- **Language:** Python
- **Latest version:** latest
- **Last verified:** 2026-06-15
- **GitHub stars:** 2,392 (fetched 2026-06-17T07:09:46.834Z)
- **Score:** 86/100 (rubric 2026-04 — see https://top-mcps.com/about/methodology)
- **Source:** https://github.com/googleanalytics/google-analytics-mcp

## Tools & permissions

| Tool | Description | Args | Side effects |
|------|-------------|------|--------------|
| `get_account_summaries` | List the GA4 accounts and properties the credential can access. | `—` | read |
| `get_property_details` | Return metadata for a GA4 property. | `property: string` | read |
| `run_report` | Run an ad-hoc GA4 report with dimensions and metrics. | `—` | read |
| `run_funnel_report` | Run a funnel report across ordered steps. | `—` | read |
| `run_realtime_report` | Return realtime active-user metrics. | `—` | read |
| `get_custom_dimensions_and_metrics` | Enumerate custom dimensions and metrics defined on a property. | `property: string` | read |

## Security & scope

- **Access scope:** read-only
- **Sandbox:** Authenticates via Google ADC with the analytics.readonly scope. Every exposed tool is a report read against the GA4 Data or Admin API — no tool can mutate the property. Grant the service account read access only on the specific GA4 properties the agent should see.
- **Gotchas:**
  - Service-account keys in env persist in client config files. Prefer gcloud ADC + short-lived login over a long-lived key file.
  - Grant the credential on only the GA4 properties the agent needs — a single key with org-wide access over-exposes data.
  - Realtime and large date-range reports consume Data API tokens; very high-frequency agent loops can hit the quota.

## Quick answer

**What it does.** Connects to GA4 via the Analytics Data API and Admin API and exposes account/property summaries, run_report, run_funnel_report, run_realtime_report, and custom dimension/metric metadata as MCP tools. Read-only.

**Best for:**
- Ad-hoc GA4 reporting
- Funnel and conversion analysis
- Realtime traffic checks
- Channel and campaign attribution queries
- Auditing custom dimensions and metrics

**Not for:**
- Universal Analytics data
- Writing GA4 configuration
- Non-Google analytics platforms

## Description

The official Google Analytics MCP connects an AI agent to your GA4 properties through the Analytics Data and Admin APIs. It exposes account and property metadata, ad-hoc reports, funnel reports, realtime reports, and your custom dimensions and metrics. Authentication is Google Application Default Credentials scoped to analytics.readonly, so the agent can read reporting data but cannot change configuration.

## Why it matters

GA4 reporting is a multi-screen task — building a report in the explorer is slow and easy to get wrong. An MCP lets an agent answer "which channels drove signups last week" or "build a checkout funnel" directly against the Data API, with the read-only scope guaranteeing it cannot alter the property.

## Key features

- Official Google maintainership
- GA4 Data API + Admin API
- run_report and run_funnel_report tools
- Realtime report tool
- analytics.readonly scope (read-only)
- Service-account impersonation support

## FAQ

### Is it free?

Yes. The MCP is open-source (Apache-2.0) and the GA4 Data API has a generous free quota for standard properties. You only need a Google Cloud project to hold the credentials — there is no per-call charge for typical reporting volumes.

### How does authentication work?

Google Application Default Credentials scoped to https://www.googleapis.com/auth/analytics.readonly. Either run gcloud auth application-default login, or point GOOGLE_APPLICATION_CREDENTIALS at a service-account key with that scope granted on the GA4 property. Service-account impersonation is also supported.

### Can the agent change my GA4 settings?

No. The credentials carry the analytics.readonly scope, so every tool is a read. The agent can build and run reports but cannot create properties, edit data streams, or change configuration.

### Does it support Universal Analytics?

No. Universal Analytics was sunset and this MCP targets GA4 only via the Analytics Data API. There is no path to query historical UA views through it.

## Changelog

- **2026-06-15** — Refreshed install snippets and fact sheet; verified for 2026.
- **2025-07-01** — Initial directory listing.
