MCP Server for Google Tag Manager
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
An interface to the Google Tag Manager API over MCP, in two flavours: a hosted server with Google OAuth built in, and a local CLI that runs on your own credentials.
Table of Contents
- MCP Server for Google Tag Manager
- Table of Contents
- Repository layout
- Installation
- Claude Desktop
- Claude Code
- VS Code
- GitHub Copilot
- Copilot CLI
- Cursor
- Antigravity
- ChatGPT
- Other MCP clients
- Troubleshooting
- Test your changes locally
- Changes to packages/core or packages/cli
- Changes to apps/worker
- 1. Set up a Google Cloud OAuth client
- 2. Configure local environment variables
- 3. Start the server
- 4. Point your MCP client at the local server
- Releasing
- Development
- Useful resources
- Open Source
Repository layout
npm workspace with one app and two published packages:
| Path | Package | What it is |
| --- | --- | --- |
| apps/worker | *(private)* | The hosted Cloudflare Worker at gtm-mcp.stape.io: Google OAuth, the approval flow, the public pages, session removal. |
| packages/cli | google-tag-manager-mcp-server | The npm package: a local MCP server over stdio, authenticating with credentials you supply. |
| packages/core | google-tag-manager-mcp-core | Every GTM tool and schema, independent of how credentials are obtained. |
Tools reach Google through a GtmAuthProvider (getAccessToken(): Promise ) rather than through any particular session, which is what lets the same tool set back both servers — and a private one with your own auth. See the core package README.
Installation
This server comes in two flavours: Hosted server and Local CLI. Both give you the same 20 GTM tools; the difference is who handles Google auth.
| | Hosted server | Local CLI |
| --- | --- | --- |
| Auth | Google OAuth in your browser, handled for you | You supply a service account key, refresh token, or access token |
| Data | Passes through gtm-mcp.stape.io | Only ever leaves your machine |
| Setup | None | Set one environment variable |
If you're a contributor testing an unreleased change rather than just using the tools, skip everything below and see Test your changes locally instead.
Pick your client below. The hosted server is a remote, HTTP-based MCP endpoint at https://gtm-mcp.stape.io/mcp. Clients that complete the Google OAuth flow themselves (Claude Desktop, Claude Code, VS Code, Copilot CLI, Cursor, ChatGPT) connect straight to that URL and sign you in with Google the first time they connect; the rest (Antigravity, stdio-only clients) reach it through mcp-remote, a small bridge to remote HTTP MCP servers. Restart the client after changing its config.
Claude Desktop
⬇️ Click to expand ⬇️
**Hosted server, custom connector (recommended).**
1. Go to **Customize → Connectors → Add custom connector**. On Team and Enterprise plans, an Owner adds it under **Organization settings → Connectors → Add → Custom** instead, and each member then selects **Connect** on it under **Customize → Connectors** and signs in with their own Google account.
2. Set a name (e.g. gtm-mcp-server) and the URL to https://gtm-mcp.stape.io/mcp. If the dialog asks how to authenticate, choose **Sign in now**; if it asks for an OAuth client, choose **Register automatically** (the server doesn't support **Use Claude's published identity**).
3. Select **Add**, then **Connect**, and sign in with Google.
The connector also works on claude.ai.
**Hosted server, mcp-remote.** To configure it through claude_desktop_config.json (Settings → Developer → Edit Config) instead:
**Local CLI** — no OAuth flow, no data through anyone else's server, you supply a service account key or a refresh token. Open Settings → Developer → Edit Config and add:
See the CLI README for every credential option.
Claude Code
⬇️ Click to expand ⬇️
Claude Code speaks HTTP directly, including the OAuth handshake, so the hosted server needs no bridge.
**Hosted server**: