Google Analytics 4

v2.1.2
com.getmcpads/google-analytics Checked 7 hours ago Published 23 days ago

Google Analytics 4 MCP server: 27 read tools, no write tools.

Values you need

VariableWhat it is
GA4_CLIENT_IDrequired OAuth client ID.
GA4_CLIENT_SECRETrequired secret OAuth client secret.
GA4_REFRESH_TOKENrequired secret OAuth refresh token, analytics.readonly scope.
GA4_PROPERTY_IDoptional Default GA4 property ID.
GA4_PROPERTY_IDSoptional Comma-separated property IDs every tool is limited to. Optional in 2.x, required in 3.0.0.

npm (npx) discovery passed

Requires Node.js 18+

Run in a terminal
claude mcp add google-analytics -e 'GA4_CLIENT_ID=<GA4_CLIENT_ID>' -e 'GA4_CLIENT_SECRET=<GA4_CLIENT_SECRET>' -e 'GA4_REFRESH_TOKEN=<GA4_REFRESH_TOKEN>' -- npx -y --package=@getmcpads/google-analytics-mcp-server@2.1.2 google-analytics-mcp
Add to claude_desktop_config.json
{
  "mcpServers": {
    "google-analytics": {
      "args": [
        "-y",
        "--package=@getmcpads/google-analytics-mcp-server@2.1.2",
        "google-analytics-mcp"
      ],
      "command": "npx",
      "env": {
        "GA4_CLIENT_ID": "<GA4_CLIENT_ID>",
        "GA4_CLIENT_SECRET": "<GA4_CLIENT_SECRET>",
        "GA4_REFRESH_TOKEN": "<GA4_REFRESH_TOKEN>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "google-analytics": {
      "args": [
        "-y",
        "--package=@getmcpads/google-analytics-mcp-server@2.1.2",
        "google-analytics-mcp"
      ],
      "command": "npx",
      "env": {
        "GA4_CLIENT_ID": "<GA4_CLIENT_ID>",
        "GA4_CLIENT_SECRET": "<GA4_CLIENT_SECRET>",
        "GA4_REFRESH_TOKEN": "<GA4_REFRESH_TOKEN>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "GA4_CLIENT_ID",
      "id": "ga4-client-id",
      "password": true,
      "type": "promptString"
    },
    {
      "description": "GA4_CLIENT_SECRET",
      "id": "ga4-client-secret",
      "password": true,
      "type": "promptString"
    },
    {
      "description": "GA4_REFRESH_TOKEN",
      "id": "ga4-refresh-token",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "google-analytics": {
      "args": [
        "-y",
        "--package=@getmcpads/google-analytics-mcp-server@2.1.2",
        "google-analytics-mcp"
      ],
      "command": "npx",
      "env": {
        "GA4_CLIENT_ID": "${input:ga4-client-id}",
        "GA4_CLIENT_SECRET": "${input:ga4-client-secret}",
        "GA4_REFRESH_TOKEN": "${input:ga4-refresh-token}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.google-analytics]
command = "npx"
args = ["-y", "--package=@getmcpads/google-analytics-mcp-server@2.1.2", "google-analytics-mcp"]
env = { "GA4_CLIENT_ID" = "<GA4_CLIENT_ID>", "GA4_CLIENT_SECRET" = "<GA4_CLIENT_SECRET>", "GA4_REFRESH_TOKEN" = "<GA4_REFRESH_TOKEN>" }

For AI agents

  1. Ask the user for: GA4_CLIENT_ID, GA4_CLIENT_SECRET, GA4_REFRESH_TOKEN. 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. Verify: the server should expose these tools: ga4_health_check, ga4_list_properties, ga4_run_report, ga4_run_realtime_report, ga4_get_metadata, ga4_get_custom_definitions, ga4_get_key_events, ga4_get_ecommerce_diagnostics, ….
  5. 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