tagmanager-mcp
The tagmanager-mcp server provides an MCP interface to Google Tag Manager, enabling AI agents to fully manage GTM accounts, containers, workspaces, tags, triggers, variables, and versions.
Account & Container Navigation
List GTM accounts (optionally including Google Tag accounts), containers within an account, and workspaces within a container
Check workspace status for unpublished changes and merge conflicts
Tags, Triggers & Variables
List (slim skeleton view), get full configuration, create, update (via merge patches), and delete tags, triggers, and variables within a workspace draft
Deletes require explicit
confirm=true
Versioning & Publishing
List container version headers, get details of specific versions, and get the currently live version
Snapshot the current workspace into a new container version (
create_version, requiresconfirm=true; consumes the workspace)Publish a version to make it live (
publish_version, requiresconfirm=true)
Safety Features
All writes stay in the workspace draft; only
publish_versionaffects the live siteDestructive operations (
delete_*,create_version,publish_version) require explicitconfirm=trueUpdates use fingerprint checking to prevent silent clobbering of concurrent edits
Rate-limit errors are retried; ambiguous 5xx errors are not (preventing duplicate creates)
Provides tools to interact with Google Tag Manager API v2 for auditing and analyzing GTM configurations, including listing and retrieving accounts, containers, workspaces, tags, triggers, and variables.
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., "@tagmanager-mcpWhich GTM accounts and containers do I have?"
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.
Google Tag Manager MCP Server (Alpha)
🚀 Empower your AI agents to handle the whole Google Tag Manager workflow!
This repo contains the source code for running a local MCP server that interacts with APIs for Google Tag Manager.
Features
No frequent authentication. Standard Google ADC with your own OAuth client is all you need. Everything runs on your machine, straight against the GTM API.
No service account required. The server runs as you, with the GTM permissions your account already has.
Built for LLM context windows. A single GTM tag can be hundreds of lines of JSON;
list_*tools return slim skeletons andget_*fetches full detail only when asked.
Related MCP server: unboundai-gtm-mcp-server
Tools
The server uses the Google Tag Manager API to provide Tools for use with LLMs. The most frequently used tools are:
Tool | Purpose |
| Containers in an account — where every session starts |
| Tags in the workspace as slim skeletons |
| One tag's full configuration, on demand |
| Unpublished changes and merge conflicts |
| Add a tag to the workspace draft |
| Merge partial changes into a tag (fingerprint-checked) |
| Remove a tag (requires |
Triggers and variables have the same four tools as tags, and versioning and publishing have their own. See Appendix I for the full list.
The write safety model:
Editing and going live are separate. Create/update/delete only touch the workspace draft; only
publish_versionchanges the live site.Updates are merge patches. The model sends just the fields it changes, and the server submits the entity's
fingerprint, so a concurrent edit fails cleanly instead of being clobbered.Deletes and publishing need
confirm=true, and every destructive tool is declared withdestructiveHint.No blind retries on writes. Rate-limit rejections are retried, ambiguous 5xx errors are not, so a create is never silently duplicated.
Prerequisites
Python >= 3.10
The gcloud CLI
A Google account with access to your GTM containers
A GCP project (used only for quota attribution)
Setup instructions
1. Install
pipx install tagmanager-mcp2. Enable the Tag Manager API on your quota project
gcloud services enable tagmanager.googleapis.com --project=YOUR_PROJECT3. Create a Desktop OAuth client
Check out Manage OAuth Clients for how to create an OAuth client. Two choices matter here: pick application type Desktop app, and publish the app to Production, because an app left in Testing issues refresh tokens that expire after 7 days. Download the client JSON at the end — step 4 needs it.
Why your own client? Google may block gcloud's built-in one for Tag Manager scopes ("This app is blocked"), and that block is not something you can work around from your side.
4. Log in
gcloud auth application-default login \
--client-id-file=path/to/your-client.json \
--scopes=\
https://www.googleapis.com/auth/tagmanager.readonly,\
https://www.googleapis.com/auth/tagmanager.edit.containers,\
https://www.googleapis.com/auth/tagmanager.edit.containerversions,\
https://www.googleapis.com/auth/tagmanager.publish,\
https://www.googleapis.com/auth/cloud-platform
gcloud auth application-default set-quota-project YOUR_PROJECTThe browser will warn "Google hasn't verified this app" — it is your own app; choose Advanced → Continue.
Those scopes unlock everything. Drop the lines you do not want:
Scope | Unlocks |
| Every read tool |
| Create / update / delete in a workspace |
|
|
|
|
| Nothing in GTM — needed by |
Tools outside your granted scopes fail with a clear re-login hint, and everything else keeps working.
Connect an MCP client
Configure Claude Code
claude mcp add --scope user tagmanager-mcp -- tagmanager-mcp--scope user registers the server for every project instead of just the
current directory. Verify with claude mcp list, or run /mcp inside a
session.
Configure Claude Desktop
Claude Desktop needs the absolute path to the executable. Print it:
which tagmanager-mcpOpen Settings → Developer → Edit Config, which reveals
claude_desktop_config.json
(~/Library/Application Support/Claude/ on macOS,
%APPDATA%\Claude\ on Windows), and add the server with the path you just
printed:
{
"mcpServers": {
"tagmanager-mcp": {
"command": "/Users/you/.local/bin/tagmanager-mcp"
}
}
}Save the file and restart Claude Desktop — it reads the config only at startup. The tools then appear under the tools icon in the chat box.
Example prompts
"Which GTM accounts and containers do I have?"
"How many tags are in container GTM-XXXXXXX, grouped by type?"
"Show me the purchase tag's config and which triggers fire it."
"Does the current workspace have unpublished changes?"
"Pause every tag that fires on the checkout trigger."
"Create a custom-event trigger for
sign_upand a GA4 event tag that fires on it."
Note on quota
The GTM API allows 10,000 requests/day and 25 requests per 100 seconds per GCP project; per-user overrides do not raise it. Ordinary audit conversations fit comfortably — just avoid sweeping every tag across many containers at once.
Appendix I: A Full List of Tools
Read
Tool | Purpose |
| GTM accounts you can access (optionally Google Tag accounts) |
| Containers in an account |
| Workspaces in a container |
| Unpublished changes and merge conflicts |
| Tags — skeleton list / full configuration |
| Triggers — skeleton list / full configuration |
| Variables — skeleton list / full configuration |
| Container version headers — skeleton list |
| One version / the currently live version, with slimmed contents |
Write
Tool | Purpose |
| Create an entity in the workspace draft |
| Merge partial changes into an entity |
| Delete an entity (requires |
| Snapshot the workspace into a version (consumes the workspace; returns |
| Publish a version live (requires |
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
- Flicense-qualityDmaintenanceAn MCP Server that provides a conversational interface to Google Tag Manager API, allowing users to manage tags, triggers, variables, and containers through natural language.Last updated
- AlicenseAqualityDmaintenanceMCP server for Google Tag Manager API, enabling users to manage containers, tags, and triggers through natural language using Google Application Default Credentials.Last updated1841Apache 2.0
- AlicenseBqualityAmaintenanceProduction-grade MCP server for the Google Tag Manager API v2 with read-only GA4 (Admin + Data API) tooling. 107 tools covering the full GTM surface, including server-side containers. Ships read-only: writes, publishes, and deletes are each gated behind separate opt-in flags, every mutation requires per-call confirmation, and a dry-run mode simulates changes. Includes container auditsLast updated410014,4601MIT
- AlicenseAqualityAmaintenanceMCP server for Google Tag Manager and GA4, enabling tag management, consent auditing, workspace versioning, and analytics reporting through natural language.Last updated18642MIT
Related MCP Connectors
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
Hosted Google Calendar MCP server for AI agents. No self-hosting or Google Cloud setup.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
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/jinchliu/tagmanager-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server