Google Tag Manager (GTM) MCP - works locally or remotely.
Google Tag Manager MCP
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
A Python Model Context Protocol (MCP) server for the Google Tag Manager API v2. Connect Claude (or any MCP-compatible AI client) directly to your GTM accounts to manage tags, triggers, variables, workspaces, versions, environments, and more — all in natural language.
The server is also an OAuth 2.1 authorization server, so it works as a remote connector anywhere Claude supports custom MCP servers — claude.ai (personal), Claude Desktop, and Claude Teams. For Teams, the org owner adds the URL once and each member authenticates individually on first use.
Tools (18 consolidated per-resource tools)
Each tool takes an action parameter that selects the operation, plus resource addressing (parent / path) and optional config, params, and confirm fields. Destructive actions require confirm=True.
| Tool | Actions |
| --- | --- |
| gtm_account | get, list, update |
| gtm_container | create, get, list, update, remove + combine, lookup, move_tag_id, snippet |
| gtm_workspace | create, get, list, update, remove + create_version, get_status, sync, quick_preview, resolve_conflict |
| gtm_tag | create, get, list, update, remove, revert |
| gtm_trigger | create, get, list, update, remove, revert |
| gtm_variable | create, get, list, update, remove, revert |
| gtm_built_in_variable | create, list, remove, revert |
| gtm_folder | create, get, list, update, remove + revert, entities, move_entities_to_folder |
| gtm_client | create, get, list, update, remove, revert |
| gtm_zone | create, get, list, update, remove, revert |
| gtm_template | create, get, list, update, remove + revert, import_from_gallery |
| gtm_transformation | create, get, list, update, remove, revert |
| gtm_gtag_config | create, get, list, update, remove |
| gtm_destination | get, list, link |
| gtm_environment | create, get, list, update, remove + reauthorize |
| gtm_version | get, live, publish, set_latest, undelete, update, remove |
| gtm_version_header | list, latest |
| gtm_user_permission | create, get, list, update, remove |
Consolidated tool design
Each tool takes a uniform set of parameters:
- action — the operation to perform (e.g. "list", "create", "publish")
- parent — resource path of the parent (e.g. "accounts/123/containers/456/workspaces/7") — used for create and list
- path — full resource path of the entity — used for get, update, remove, and other single-resource operations
- config — dict of fields for create / update body
- params — dict of extra query parameters
- confirm — boolean, required True for destructive actions
Example — list tags in a workspace:
Example — publish a version (destructive, requires confirmation):
Confirmation guardrail
The following actions are considered destructive and require confirm=True. Without it, the tool immediately returns a structured message asking you to re-call with confirm=True:
> publish, remove, revert, undelete, combine, move_tag_id, move_entities_to_folder, sync, create_version, resolve_conflict, reauthorize, link
This prevents accidental mutations from ambiguous prompts.
---
How auth works
There are **two** modes. Pick one.
Mode A — Local STDIO (one user, no server)
Use this if you only want it on your own machine. setup_local_auth.py runs the Google OAuth flow once and stores your token in ~/.config/gtm-mcp/token.json. Claude Desktop launches server.py as a subprocess. No Firestore, no Cloud Run, no public URL.
Mode B — Remote HTTP server (Claude Teams, claude.ai, multi-user)
The MCP server is also an OAuth 2.1 authorization server. When Claude connects:
1. Claude discovers our metadata at /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server.
2. Claude registers itself via Dynamic Client Registration (POST /oauth/register).
3. Claude redirects the user to /oauth/authorize. We delegate identification to Google OAuth.