MCP server for the Google Tag Manager API v2: containers, workspaces, tags, triggers, publishing.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
MCP server for the Google Tag Manager API v2: manage containers, workspaces, tags, triggers, variables and publishing from Claude, Cursor, Codex and other AI clients in natural language.
Ask the assistant to audit a container, wire up a new GA4 tag with its trigger, enable built-in variables, compile a version and push it live β the full GTM workflow without clicking through the web UI.
Get OAuth credentials for a Google Cloud project with the Tag Manager API enabled.
Add the server β for example in Claude Code (other clients):
Ask the assistant: "List my GTM containers and show which tags fire on page view."
| Tool | Description |
|---|---|
list_accounts | List all GTM accounts the user can access |
get_account | Get one account |
list_containers | List containers of an account (with GTM-XXXXXX public ids) |
get_container | Get one container |
create_container | Create a container (web, server, ...) |
list_workspaces | List workspaces of a container |
get_workspace | Get one workspace |
create_workspace | Create a workspace (draft) |
list_tags | List tags of a workspace |
list_triggers | List triggers of a workspace |
list_variables | List user-defined variables of a workspace |
get_resource | Get any resource by its API path (tag, trigger, variable, version, ...) |
create_entity | Create a tag, trigger or variable |
update_entity | Update a tag/trigger/variable (PUT full replace, fingerprint-guarded) |
delete_entity | Delete a tag/trigger/variable |
manage_built_in_variables | List / enable / disable built-in variables (full enum from the discovery doc) |
create_version | Compile a workspace into a container version (β οΈ deletes the workspace) |
publish_version | Publish a version, get one version, or fetch the live version |
raw_request | Escape hatch: call any Tag Manager API v2 path directly |
The Tag Manager API quota is unusually strict: 0.25 QPS per project (25 requests per 100-second sliding window) and 10,000 requests per day. The server handles this for you:
GOOGLE_TAGMANAGER_MIN_INTERVAL_MS);429 and quota-403 (rateLimitExceeded / userRateLimitExceeded / quotaExceeded)
responses are retried with exponential backoff honoring Retry-After;5xx and network errors are retried for reads only β a write that may have committed
is never replayed.Big fan-out requests ("list everything in every container") will therefore be slow by design β that is the quota, not the server.
claude_desktop_config.json β macOS ~/Library/Application Support/Claude/, Windows %APPDATA%\Claude\
~/.cursor/mcp.json (or .cursor/mcp.json in the project)
For a quick one-off session you can skip the trio and pass a short-lived token directly:
GOOGLE_TAGMANAGER_ACCESS_TOKEN=ya29.... (Google access tokens expire after about an
hour and are not refreshed automatically).
The Tag Manager API only supports OAuth 2.0 β there are no API keys for user data. One-time setup:
gear icon β check Use your own OAuth credentials β paste the client id/secret
(for a Web client also add https://developers.google.com/oauthplayground to its
authorized redirect URIs);
in Step 1 authorize these scopes (space-separated):
in Step 2 click Exchange authorization code for tokens and copy the refresh token.
β οΈ The credentials are stored as plain text in your client's MCP config. Scope the OAuth consent to the four Tag Manager scopes above and nothing else.
Note the scope split: reading needs
readonly, editing needsedit.containers,create_versionneedsedit.containerversions, and publishing needspublish. Authorize all four at once or re-consent mid-flow.
| Variable | Required | Default | Description |
|---|---|---|---|
GOOGLE_TAGMANAGER_CLIENT_ID | yes* | β | OAuth client id |
GOOGLE_TAGMANAGER_CLIENT_SECRET | yes* | β | OAuth client secret |
GOOGLE_TAGMANAGER_REFRESH_TOKEN | yes* | β | OAuth refresh token |
GOOGLE_TAGMANAGER_ACCESS_TOKEN | no | β | Ready-made access token; replaces the trio for quick sessions |
GOOGLE_TAGMANAGER_API_BASE | no | https://tagmanager.googleapis.com | API root override |
GOOGLE_TAGMANAGER_TIMEOUT_MS | no | 60000 | Per-request timeout |
GOOGLE_TAGMANAGER_MAX_RETRIES | no | 3 | Retries on transient errors |
GOOGLE_TAGMANAGER_MIN_INTERVAL_MS | no | 4200 | Minimum spacing between API requests (0.25 QPS quota) |
* the trio is required unless GOOGLE_TAGMANAGER_ACCESS_TOKEN is set.
create_version deletes the source workspace. The response's newWorkspacePath
points to the automatically created replacement β the server surfaces it and the tool
description warns the model, but keep it in mind when scripting.compilerError: true can arrive with HTTP 200 on create_version and publish.
The server converts it into a tool error so it is never mistaken for success.update_entity expects the complete
resource. Fetch with get_resource, edit, send back, and pass the fingerprint for
optimistic-concurrency safety.path field β echo it back
rather than assembling paths by hand.Questions and issues β GitHub Issues or Telegram @gistrec.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/google-tag-manager-mcp)<a href="https://allmcps.com/mcp/google-tag-manager-mcp"><img src="https://allmcps.com/api/badge/google-tag-manager-mcp?style=directory" alt="Google Tag Manager MCP on AllMCPs" /></a>