ga4

v2.3.2
io.github.mharnett/ga4 Checked 13 hours ago Published 7 days ago

Google Analytics 4 MCP: reports, realtime data, custom dimensions, data streams.

Values you need

VariableWhat it is
GA4_PROPERTY_IDrequired GA4 property ID (numeric)
GOOGLE_APPLICATION_CREDENTIALSrequired Path to service account JSON credentials file

npm (npx)

Requires Node.js 18+

Run in a terminal
claude mcp add ga4 -e 'GA4_PROPERTY_ID=<GA4_PROPERTY_ID>' -e 'GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS>' -- npx -y mcp-ga4@2.3.2
Add to claude_desktop_config.json
{
  "mcpServers": {
    "ga4": {
      "args": [
        "-y",
        "mcp-ga4@2.3.2"
      ],
      "command": "npx",
      "env": {
        "GA4_PROPERTY_ID": "<GA4_PROPERTY_ID>",
        "GOOGLE_APPLICATION_CREDENTIALS": "<GOOGLE_APPLICATION_CREDENTIALS>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "ga4": {
      "args": [
        "-y",
        "mcp-ga4@2.3.2"
      ],
      "command": "npx",
      "env": {
        "GA4_PROPERTY_ID": "<GA4_PROPERTY_ID>",
        "GOOGLE_APPLICATION_CREDENTIALS": "<GOOGLE_APPLICATION_CREDENTIALS>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "GA4_PROPERTY_ID",
      "id": "ga4-property-id",
      "password": true,
      "type": "promptString"
    },
    {
      "description": "GOOGLE_APPLICATION_CREDENTIALS",
      "id": "google-application-credentials",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "ga4": {
      "args": [
        "-y",
        "mcp-ga4@2.3.2"
      ],
      "command": "npx",
      "env": {
        "GA4_PROPERTY_ID": "${input:ga4-property-id}",
        "GOOGLE_APPLICATION_CREDENTIALS": "${input:google-application-credentials}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.ga4]
command = "npx"
args = ["-y", "mcp-ga4@2.3.2"]
env = { "GA4_PROPERTY_ID" = "<GA4_PROPERTY_ID>", "GOOGLE_APPLICATION_CREDENTIALS" = "<GOOGLE_APPLICATION_CREDENTIALS>" }

For AI agents

  1. Ask the user for: GA4_PROPERTY_ID, GOOGLE_APPLICATION_CREDENTIALS. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
  3. Restart or reload the client so it starts the server.
  4. If it fails, check that the required runtime is installed (Node.js 18+) and that the values above are set.

Machine-readable: install.md · manifest.json