gtm-mcp
Provides tools for managing Google Tag Manager containers, including tags, triggers, variables, and versions via the GTM API.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gtm-mcpShow me the pending changes in my GTM Default Workspace"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gtm-mcp
MCP server for full Google Tag Manager management via the GTM API v2: tags, triggers, variables and versions.
Tools (22)
Hierarchy: Account → Container → Workspace → (Tags / Triggers / Variables)
Tool | What it does |
| List accessible GTM accounts — entry point |
| Containers in an account |
| Workspaces in a container (usually "Default Workspace") |
| Pending changes vs. the published version |
| List or detail tags |
| Tag CRUD |
| List or detail triggers |
| Trigger CRUD |
| List variables |
| Variable CRUD |
| History of published versions |
| Snapshot the current workspace (restore point) |
| Publish a version to production |
Related MCP server: Google Tag Manager MCP Server
Typical flow
1. get_accounts() → account_id
2. get_containers(account_id) → container_id
3. get_workspaces(account_id, container_id) → workspace_id
4. get_workspace_status(...) → review pending changes
5. [create/edit tags, triggers, variables]
6. create_version(account_id, container_id, workspace_id, name="v1")
7. publish_version(account_id, container_id, version_id)Setup
Create a Google Cloud project (or reuse one) and enable the Tag Manager API.
Create an OAuth 2.0 Client ID of type "Desktop app" and download it as
client_secret.json.If the app is in "Testing" mode, add your Google account as a test user.
Install dependencies:
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txtRun the OAuth flow once:
CLIENT_SECRET_PATH=~/.config/gtm-mcp/client_secret.json python3 setup_auth.pyThis opens a browser — log in and grant access. Credentials are saved to
~/.config/gtm-mcp/credentials.json.
⚠️ Only enable this MCP when you're actually working on GTM — leaving it always-on in a client that doesn't cache the OAuth session can trigger the auth flow on every startup.
MCP client configuration
{
"mcpServers": {
"gtm": {
"command": "/path/to/.venv/bin/python3",
"args": ["/path/to/gtm-mcp/server.py"]
}
}
}Env var | Default | Purpose |
|
| Path to the credentials file generated by |
Confirmation required for critical operations
These tools require confirmed=True. Called without it, they return a JSON
with requires_confirmation: true that the calling agent MUST show to the
user and wait for a response before repeating the call with confirmed=True.
Tool | What it does |
| Delete a tag from the workspace |
| Discard workspace changes on a tag, reverting to the published version |
| Delete a trigger from the workspace |
| Delete a variable from the workspace |
| Publish a version to production — changes what's live on a client's website |
# 1. First call — no confirmed
publish_version(account_id="123456789", container_id="7654321", version_id="12")
# → returns requires_confirmation: true → show it to the user
# 2. Second call — after the user confirms
publish_version(account_id="123456789", container_id="7654321", version_id="12", confirmed=True)Response size
List/get tools strip fields the GTM API always includes but no workflow ever uses (path, fingerprint, monitoringMetadata, tagManagerUrl, features), and parent IDs already known from the call's own parameters. Measured against real data: 39-81% smaller responses depending on the tool. create_version/publish_version return a summary instead of the full nested container snapshot (every tag/trigger/variable embedded) that the underlying API sends back.
Security
Every tool carries MCP Tool Annotations (
readOnlyHint,destructiveHint,idempotentHint,openWorldHint) describing its effect up front.Execution errors propagate as real MCP protocol errors (
isError=true), never as a JSON payload that looks successful with anerrorkey buried inside it.
Notes
All changes (create/edit/delete) stay in the workspace until published with
create_version+publish_version.update_tag/update_trigger/update_variabledo a GET before the PUT to preserve unspecified fields — you won't lose parameters by omission. Verified live with a full create → edit → delete round trip on each.⚠️
revert_tagon a tag that was never published deletes it rather than restoring a prior state — "revert" means "go back to the last published version," and if the tag never existed in a published version, that version is "doesn't exist." Verified live; this is documented API behavior, not a bug in this server.Common
tag_typevalues:googtag(GA4/Google Tag),html(custom HTML),gclidw(Ads conversion),ua(legacy Universal Analytics).Common
trigger_typevalues:pageview,customEvent,linkClick,formSubmission,domReady.Common
variable_typevalues:v(Data Layer),k(Cookie),u(URL),jsm(Custom JS).parametersis a list of{type, key, value}wheretypeis one oftemplate,boolean,integer,listormap.
License
MIT — see LICENSE.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseBqualityCmaintenanceEnables comprehensive management of Google Tag Manager accounts, containers, workspaces, tags, triggers, and variables through OAuth2 authentication, allowing users to create, update, and publish GTM configurations via natural language.26
- AlicenseNot gradedqualityAmaintenanceEnables interaction with Google Tag Manager through its API with built-in Google OAuth authentication. Allows managing GTM containers, tags, triggers, and variables through natural language.448207Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to manage Google Tag Manager accounts, containers, workspaces, tags, triggers, variables, and versions via the Tag Manager API v2.2Apache 2.0
- AlicenseNot gradedqualityBmaintenanceMCP server for Google Tag Manager API v2, enabling programmatic management of accounts, containers, workspaces, tags, triggers, variables, and version workflows.3214MIT
Related MCP Connectors
Manage Gmail messages, threads, labels, drafts, and settings from your workflows. Send and organiz…
Manage SRG+ hubs, channels, content, assets, users, and workspaces from any MCP-aware AI agent.
Google Ads, Meta Ads & GA4 MCP server - 250+ tools for campaigns, creatives, audiences & reports.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/YerayRodri/gtm-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server