gtm-ga4

v1.3.2
io.github.mharnett/gtm-ga4 Checked 3 hours ago Published 6 days ago

GTM + GA4 MCP: tag management, consent auditing, workspace versioning, reports.

Values you need

VariableWhat it is
GOOGLE_APPLICATION_CREDENTIALSrequired Path to service account JSON credentials file
GTM_ACCOUNT_IDrequired GTM account ID
GTM_CONTAINER_IDrequired GTM container ID
GA4_PROPERTY_IDoptional GA4 property ID (numeric)

npm (npx)

Requires Node.js 18+

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

For AI agents

  1. Ask the user for: GOOGLE_APPLICATION_CREDENTIALS, GTM_ACCOUNT_ID, GTM_CONTAINER_ID. 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