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 "Deploy 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-mcp Which 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-mcpor, with uv:
uv tool install tagmanager-mcpEither one puts a tagmanager-mcp executable on your PATH.
2. 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 |
Available Tools
24 toolscreate_tagA
Creates a tag in the workspace draft.
Changes stay in the workspace until a version is published; nothing goes live. Returns the created tag including its tagId.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. tag: Tag resource body. Requires 'name' and 'type'; most types also need 'parameter' (list of {'type', 'key', 'value'} dicts) and 'firingTriggerId' (list of trigger ID strings). Minimal example: {'name': 'Hello', 'type': 'html', 'parameter': [{'type': 'template', 'key': 'html', 'value': '...'}], 'firingTriggerId': ['2147479553']} (2147479553 is the built-in All Pages trigger; built-in triggers do not appear in list_triggers).
Inputs: tag (required), account_id (required), container_id (required), workspace_id (required). Returns: object
create_triggerA
Creates a trigger in the workspace draft.
Changes stay in the workspace until a version is published; nothing goes live. Returns the created trigger including its triggerId.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. trigger: Trigger resource body. Requires 'name' and 'type' (e.g. 'pageview', 'domReady', 'click', 'customEvent'). Minimal example: {'name': 'DOM Ready', 'type': 'domReady'}. A customEvent trigger also needs 'customEventFilter', e.g. [{'type': 'equals', 'parameter': [{'type': 'template', 'key': 'arg0', 'value': '{{_event}}'}, {'type': 'template', 'key': 'arg1', 'value': 'my_event'}]}].
Inputs: trigger (required), account_id (required), container_id (required), workspace_id (required). Returns: object
create_variableA
Creates a variable in the workspace draft.
Changes stay in the workspace until a version is published; nothing goes live. Returns the created variable including its variableId.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. variable: Variable resource body. Requires 'name' and 'type'; most types also need 'parameter' (list of {'type', 'key', 'value'} dicts). Data layer variable example: {'name': 'DL - user_id', 'type': 'v', 'parameter': [{'type': 'integer', 'key': 'dataLayerVersion', 'value': '2'}, {'type': 'template', 'key': 'name', 'value': 'user_id'}]}.
Inputs: variable (required), account_id (required), container_id (required), workspace_id (required). Returns: object
create_versionADestructive
Snapshots a workspace into a new container version.
WARNING: this consumes the workspace. The workspace is deleted and a fresh empty one is created; its path is returned as newWorkspacePath. Use that path for any further edits — the workspace_id passed here is gone afterwards. Nothing goes live yet; publish_version does that.
Check the result before publishing: if compilerError is true or syncStatus reports a conflict, the version has problems. Fix them in the new workspace and create another version rather than publishing.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. name: Optional name for the version. notes: Optional notes describing the version.
Inputs: account_id (required), container_id (required), workspace_id (required), name, +1 more. Returns: object
delete_tagADestructive
Deletes a tag from the workspace draft.
Requires explicit confirmation: ask the user first, then call again with confirm=True. The removal stays in the workspace until a version is published.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. tag_id: Numeric tag ID; find it via list_tags. confirm: Must be True to actually delete.
Inputs: tag_id (required), account_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
delete_triggerADestructive
Deletes a trigger from the workspace draft.
Requires explicit confirmation: ask the user first, then call again with confirm=True. Check first (via list_tags) that no tag still references the trigger. The removal stays in the workspace until a version is published.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. trigger_id: Numeric trigger ID; find it via list_triggers. confirm: Must be True to actually delete.
Inputs: account_id (required), trigger_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
delete_variableADestructive
Deletes a variable from the workspace draft.
Requires explicit confirmation: ask the user first, then call again with confirm=True. Check first that no tag, trigger or variable still references it as {{Variable Name}}. The removal stays in the workspace until a version is published.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. variable_id: Numeric variable ID; find it via list_variables. confirm: Must be True to actually delete.
Inputs: account_id (required), variable_id (required), container_id (required), workspace_id (required), +1 more. Returns: object
get_live_versionARead-only
Gets the container version currently published (live).
Returns metadata plus slimmed contents, like get_version. Useful to see what is live before publishing a new version.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path.
Inputs: account_id (required), container_id (required). Returns: object
get_tagARead-only
Gets the full configuration of one tag, including parameters.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. tag_id: Numeric tag ID; find it via list_tags.
Inputs: tag_id (required), account_id (required), container_id (required), workspace_id (required). Returns: object
get_triggerARead-only
Gets the full configuration of one trigger, including filters.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. trigger_id: Numeric trigger ID; find it via list_triggers.
Inputs: account_id (required), trigger_id (required), container_id (required), workspace_id (required). Returns: object
get_variableARead-only
Gets the full configuration of one variable.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. variable_id: Numeric variable ID; find it via list_variables.
Inputs: account_id (required), variable_id (required), container_id (required), workspace_id (required). Returns: object
get_versionARead-only
Gets one container version: metadata plus slimmed contents.
The embedded tags, triggers and variables are reduced to their skeleton (name + id); a full version can otherwise run to thousands of lines. Use get_tag/get_trigger/get_variable for full entity configs, but note those read the workspace draft, not this version.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. version_id: Numeric version ID; find it via list_versions.
Inputs: account_id (required), version_id (required), container_id (required). Returns: object
get_workspace_statusBRead-only
Shows unpublished changes and merge conflicts in a workspace.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces.
Inputs: account_id (required), container_id (required), workspace_id (required). Returns: object
list_accountsARead-only
Lists all Google Tag Manager accounts accessible to the caller.
Args: include_google_tags: Also include Google Tag accounts in the results.
Inputs: include_google_tags. Returns: object
list_containersARead-only
Lists all containers in a Google Tag Manager account.
Args: account_id: Numeric GTM account ID (e.g. 6000000000) or a full path like 'accounts/6000000000'.
Inputs: account_id (required). Returns: object
list_tagsARead-only
Lists tags in a workspace, skeleton fields only.
Returns tagId, name, type, firingTriggerId, blockingTriggerId, paused and fingerprint per tag. Use get_tag for the full configuration of a specific tag.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces.
Inputs: account_id (required), container_id (required), workspace_id (required). Returns: object
list_triggersARead-only
Lists triggers in a workspace, skeleton fields only.
Returns triggerId, name, type and fingerprint per trigger. Use get_trigger for the full configuration of a specific trigger.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces.
Inputs: account_id (required), container_id (required), workspace_id (required). Returns: object
list_variablesARead-only
Lists variables in a workspace, skeleton fields only.
Returns variableId, name, type and fingerprint per variable. Use get_variable for the full configuration of a specific variable.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces.
Inputs: account_id (required), container_id (required), workspace_id (required). Returns: object
list_versionsARead-only
Lists container version headers, skeleton fields only.
Returns containerVersionId, name, deleted and entity counts per version. Use get_version for the full contents of one version, or get_live_version for the one currently published.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path.
Inputs: account_id (required), container_id (required). Returns: object
list_workspacesARead-only
Lists workspaces in a container.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID (e.g. 200001) or a full path like 'accounts/123/containers/200001'.
Inputs: account_id (required), container_id (required). Returns: object
publish_versionADestructive
Publishes a container version, making it live on the site.
This is the only operation that changes what runs on the live site. Requires explicit confirmation: ask the user first, then call again with confirm=True. Publish a version you have already checked for compiler errors (see create_version).
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. version_id: Numeric version ID; find it via list_versions. confirm: Must be True to actually publish.
Inputs: account_id (required), version_id (required), container_id (required), confirm. Returns: object
update_tagA
Updates a tag by merging changes into its current configuration.
The merge is shallow: each top-level key in changes replaces the current value, a null value removes the key, and lists are replaced whole (e.g. firingTriggerId must be the complete new list). The current config is re-read in the same call and its fingerprint sent along, so concurrent edits fail cleanly instead of being clobbered. Changes stay in the workspace draft until a version is published. Returns the updated tag.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. tag_id: Numeric tag ID; find it via list_tags. changes: Partial tag body, e.g. {'paused': True} or {'firingTriggerId': ['5', '7']}.
Inputs: tag_id (required), changes (required), account_id (required), container_id (required), +1 more. Returns: object
update_triggerA
Updates a trigger by merging changes into its current config.
The merge is shallow: each top-level key in changes replaces the current value, a null value removes the key, and lists are replaced whole (e.g. a filter list must be passed complete). The current config is re-read in the same call and its fingerprint sent along, so concurrent edits fail cleanly instead of being clobbered. Changes stay in the workspace draft until a version is published. Returns the updated trigger.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. trigger_id: Numeric trigger ID; find it via list_triggers. changes: Partial trigger body, e.g. {'name': 'New name'}.
Inputs: changes (required), account_id (required), trigger_id (required), container_id (required), +1 more. Returns: object
update_variableA
Updates a variable by merging changes into its current config.
The merge is shallow: each top-level key in changes replaces the current value, a null value removes the key, and lists are replaced whole (e.g. the parameter list must be passed complete). The current config is re-read in the same call and its fingerprint sent along, so concurrent edits fail cleanly instead of being clobbered. Changes stay in the workspace draft until a version is published. Returns the updated variable.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. variable_id: Numeric variable ID; find it via list_variables. changes: Partial variable body, e.g. {'name': 'New name'}.
Inputs: changes (required), account_id (required), variable_id (required), container_id (required), +1 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 24 tools
Each tool targets a distinct GTM entity and action. Tags, triggers, variables each have their own create/get/list/update/delete, and workspace/version lifecycle tools are clearly separate.
All tools follow a consistent verb_noun pattern with snake_case. Verbs like create, list, get, update, delete, publish are used uniformly across entities.
24 tools cover the core GTM workflow without bloat: account/container/workspace listing, version management, and full CRUD for tags, triggers, variables. Each tool earns its place.
The tool set provides full lifecycle management for tags, triggers, variables, and versions. Missing account/container creation is acceptable as these are typically managed outside CI/CD.
Related MCP Connectors
Hosted Google Tag Manager MCP server, with each action switched on or off per account.
Read-only Google Analytics 4 MCP server for AI assistants.
Google Ads MCP server: run Search, Display, Demand Gen and PMax campaigns from AI.
Read and edit GA4, Search Console and Google Tag Manager from any MCP client. 29 tools.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP Server that provides a conversational interface to Google Tag Manager API, allowing users to manage tags, triggers, variables, and containers through natural language.-
- AlicenseAqualityDmaintenanceMCP server for Google Tag Manager API, enabling users to manage containers, tags, and triggers through natural language using Google Application Default Credentials.1854 npmApache 2.0
- AlicenseNot gradedqualityDmaintenanceMCP server for Google Tag Manager API v2, enabling programmatic management of accounts, containers, workspaces, tags, triggers, variables, and version workflows.46 npm15MIT
- FlicenseNot gradedqualityBmaintenanceA remote MCP server for Google Tag Manager that enables AI assistants to manage GTM accounts, containers, tags, triggers, variables, and more via OAuth or service account authentication.1-