# SEO Tools: Google Analytics 4 MCP server

> Run read-only Google Analytics 4 reports on traffic sources, landing pages, events and realtime data.

- Listing: https://mcp.tc/i/seo-tools-google-analytics-4
- Connect: this is a local (stdio) server; install it on your machine (see Install). The listing link is a page, not an MCP endpoint.
- Type: local (stdio)
- Auth: API key
- Category: [Data & Analytics](https://mcp.tc/c/analytics)
- Vendor: antohins
- Repository: <https://github.com/antohins/seo-tools-mcp>
- Package: npm `seo-tools-mcp-ga4`

## About

Connects to the Google Analytics 4 Data and Admin APIs and returns strict JSON. Documented tools cover listing properties, property metadata, custom reports, time series, traffic sources, geography, devices, top pages, events, funnels, annotations and realtime data. All tools are read-only.

It runs locally over stdio from the npm package seo-tools-mcp-ga4 with npx. Authentication uses a Google OAuth client (refresh token obtained through ga4\_oauth\_start and ga4\_oauth\_finish) or a service-account JSON key. A default GA4 property ID can be set through an environment variable. It is one of eight servers in the seo-tools-mcp project.

## What it can do

- List GA4 properties and view property details
- Build custom reports with chosen metrics and dimensions
- Break down traffic sources, geography and devices
- See top pages and landing pages
- Query events and funnels
- Read realtime data
- Check metric and dimension compatibility

## Example prompts

- "List my GA4 properties and show sessions for the last 28 days."
- "Which traffic sources brought the most users to property 123456789 this month?"
- "Show the top 20 landing pages by sessions for last week."
- "What is happening on my site right now in realtime?"

## Install

### Claude Code

1. Run this in a terminal, in your project folder:

```bash
claude mcp add --transport stdio seo-tools-google-analytics-4 --env "GOOGLE_CLIENT_SECRET=<YOUR_GOOGLE_CLIENT_SECRET>" --env "GA4_REFRESH_TOKEN=<YOUR_GA4_REFRESH_TOKEN>" -- npx -y seo-tools-mcp-ga4
```

2. Start Claude Code and type `/mcp`. **seo-tools-google-analytics-4** should show as connected.

Add `--scope user` to make it available in every project. Replace the placeholders with your own values.

### Claude Desktop

1. Open **Settings → Developer → Edit Config**. It opens `claude_desktop_config.json`. Add:

`claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "seo-tools-google-analytics-4": {
      "command": "npx",
      "args": [
        "-y",
        "seo-tools-mcp-ga4"
      ],
      "env": {
        "GOOGLE_CLIENT_SECRET": "<YOUR_GOOGLE_CLIENT_SECRET>",
        "GA4_REFRESH_TOKEN": "<YOUR_GA4_REFRESH_TOKEN>"
      }
    }
  }
}
```

2. Save the file and restart Claude Desktop. Replace the placeholders with your own values.

Needs Node.js on your computer. The file lives in `~/Library/Application Support/Claude/` on macOS and `%APPDATA%\Claude\` on Windows.

### Cursor

[Add to Cursor](<https://cursor.com/install-mcp?name=seo-tools-google-analytics-4&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInNlby10b29scy1tY3AtZ2E0Il0sImVudiI6eyJHT09HTEVfQ0xJRU5UX1NFQ1JFVCI6IjxZT1VSX0dPT0dMRV9DTElFTlRfU0VDUkVUPiIsIkdBNF9SRUZSRVNIX1RPS0VOIjoiPFlPVVJfR0E0X1JFRlJFU0hfVE9LRU4%2BIn19>) (opens Cursor)

Or add it by hand to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (this project):

`mcp.json`:

```json
{
  "mcpServers": {
    "seo-tools-google-analytics-4": {
      "command": "npx",
      "args": [
        "-y",
        "seo-tools-mcp-ga4"
      ],
      "env": {
        "GOOGLE_CLIENT_SECRET": "<YOUR_GOOGLE_CLIENT_SECRET>",
        "GA4_REFRESH_TOKEN": "<YOUR_GA4_REFRESH_TOKEN>"
      }
    }
  }
}
```

Needs Node.js on your computer. Replace the placeholders with your own values.

### VS Code

Add it to `.vscode/mcp.json`. VS Code asks for the secret the first time and stores it securely:

`.vscode/mcp.json`:

```json
{
  "servers": {
    "seo-tools-google-analytics-4": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "seo-tools-mcp-ga4"
      ],
      "env": {
        "GOOGLE_CLIENT_SECRET": "${input:google-client-secret}",
        "GA4_REFRESH_TOKEN": "${input:ga4-refresh-token}"
      }
    }
  },
  "inputs": [
    {
      "type": "promptString",
      "id": "google-client-secret",
      "description": "GOOGLE_CLIENT_SECRET",
      "password": true
    },
    {
      "type": "promptString",
      "id": "ga4-refresh-token",
      "description": "GA4_REFRESH_TOKEN",
      "password": true
    }
  ]
}
```

Needs Node.js on your computer.

### Devin Desktop

1. Add it to `~/.config/devin/mcp_config.json` (macOS and Linux) or `%APPDATA%\devin\mcp_config.json` (Windows):

`mcp_config.json`:

```json
{
  "mcpServers": {
    "seo-tools-google-analytics-4": {
      "command": "npx",
      "args": [
        "-y",
        "seo-tools-mcp-ga4"
      ],
      "env": {
        "GOOGLE_CLIENT_SECRET": "<YOUR_GOOGLE_CLIENT_SECRET>",
        "GA4_REFRESH_TOKEN": "<YOUR_GA4_REFRESH_TOKEN>"
      }
    }
  }
}
```

2. Refresh the MCP server list in Cascade. Replace the placeholders with your own values.

Devin Desktop is the new name for Windsurf.

### Codex

```bash
codex mcp add seo-tools-google-analytics-4 --env "GOOGLE_CLIENT_SECRET=<YOUR_GOOGLE_CLIENT_SECRET>" --env "GA4_REFRESH_TOKEN=<YOUR_GA4_REFRESH_TOKEN>" -- npx -y seo-tools-mcp-ga4
```

Or edit `~/.codex/config.toml` directly:

`config.toml`:

```toml
[mcp_servers.seo-tools-google-analytics-4]
command = "npx"
args = ["-y", "seo-tools-mcp-ga4"]
env = { GOOGLE_CLIENT_SECRET = "<YOUR_GOOGLE_CLIENT_SECRET>", GA4_REFRESH_TOKEN = "<YOUR_GA4_REFRESH_TOKEN>" }
```

Needs Node.js on your computer. Replace the placeholders with your own values.

### Gemini CLI

```bash
gemini mcp add -e "GOOGLE_CLIENT_SECRET=<YOUR_GOOGLE_CLIENT_SECRET>" -e "GA4_REFRESH_TOKEN=<YOUR_GA4_REFRESH_TOKEN>" seo-tools-google-analytics-4 npx -- -y seo-tools-mcp-ga4
```

This adds it to the current project. Add `-s user` to use it everywhere.

### Any client

Most clients that start local servers accept this shape:

```json
{
  "mcpServers": {
    "seo-tools-google-analytics-4": {
      "command": "npx",
      "args": [
        "-y",
        "seo-tools-mcp-ga4"
      ],
      "env": {
        "GOOGLE_CLIENT_SECRET": "<YOUR_GOOGLE_CLIENT_SECRET>",
        "GA4_REFRESH_TOKEN": "<YOUR_GA4_REFRESH_TOKEN>"
      }
    }
  }
}
```

Zed puts servers under `context_servers` in its settings, with the same `command`, `args` and `env` fields.

Needs Node.js on your computer. Replace the placeholders with your own values.

## Recent changes

- 2026-10-06 21:21 UTC: Tracking started: version 1.8.0. Source: automatic check.

More on the History tab, with descriptions before and after for the newest entries: https://mcp.tc/i/seo-tools-google-analytics-4#history (Atom feed: https://mcp.tc/i/seo-tools-google-analytics-4/history.xml). It records what mcp.tc's anonymous checks saw, every 3 hours where the tool list can be read without sign-in; it is not a security review.

## Details

- Server version: 1.8.0
- Last checked: 2026-10-05
- Listed: 2026-10-05
- Updated: 2026-10-05

---
Source: https://mcp.tc/i/seo-tools-google-analytics-4 (mcp.tc is an independent directory, not affiliated with this server's publisher). Corrections: https://mcp.tc/report
