# Google Analytics 4

This MCP server lets an AI agent inspect GA4 properties and schemas, then run reports. Use it to explore analytics data from your coding environment.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 13
- Author: mindstone
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/mindstone/mcp-servers/tree/HEAD/connectors/google-analytics
- Updated: 2026-10-22
- HTML: https://affpapa.org/en/nevibecode/mcp/google-analytics-4

## What it does

The server can list GA4 accounts and properties, inspect available dimensions and metrics, check whether they work together, and run reports. Large exports can run as asynchronous tasks, with results retrieved in pages. Standard reports include safeguards for high row volumes.

You need Node.js 20+, npm, and Google credentials with the `analytics.readonly` scope, or a service-account JSON file that has access to the GA4 property. Set `GOOGLE_APPLICATION_CREDENTIALS` to an absolute file path; Node.js will not expand `~` or `%APPDATA%`. That path requirement matters: an unresolved shortcut prevents the server from reading the credentials. `GA4_PROPERTY_ID` can provide a default property.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `GOOGLE_APPLICATION_CREDENTIALS`, `GA4_PROPERTY_ID` — 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_PROPERTY_ID=<GA4_PROPERTY_ID> --transport stdio google-analytics -- npx -y @mindstone/mcp-server-google-analytics
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add google-analytics --env GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS> --env GA4_PROPERTY_ID=<GA4_PROPERTY_ID> -- npx -y @mindstone/mcp-server-google-analytics
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "google-analytics": {
            "command": "npx",
            "args": [
                "-y",
                "@mindstone/mcp-server-google-analytics"
            ],
            "env": {
                "GOOGLE_APPLICATION_CREDENTIALS": "<GOOGLE_APPLICATION_CREDENTIALS>",
                "GA4_PROPERTY_ID": "<GA4_PROPERTY_ID>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "google-analytics": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@mindstone/mcp-server-google-analytics"
            ],
            "env": {
                "GOOGLE_APPLICATION_CREDENTIALS": "<GOOGLE_APPLICATION_CREDENTIALS>",
                "GA4_PROPERTY_ID": "<GA4_PROPERTY_ID>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS> -e GA4_PROPERTY_ID=<GA4_PROPERTY_ID> google-analytics npx -y @mindstone/mcp-server-google-analytics
```
Replace <…> with your own values

## When to use it
- list available GA4 accounts and properties
- inspect a property's dimensions and metrics
- check dimension and metric compatibility before reporting
- run a report against GA4 data
- retrieve a large report through an asynchronous export

## Example prompts
- List the GA4 accounts and properties I can access.
- Check whether these dimensions and metrics can be used together in a report.
- Run a report for this GA4 property and retrieve the large export in pages.

## 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

## Other versions with the same name
- [Google Analytics 4 · get-mcp-ads](https://affpapa.org/en/nevibecode/mcp/get-mcp-ads-google-analytics-4.md)

From the same set: [mindstone/mcp-servers](https://affpapa.org/en/nevibecode/by/mindstone/mcp-servers.md) — 40 cards

---
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
