An MCP server for Google Tag Manager. Connect it to your LLM, authenticate once, and start managing GTM through natural language.
# Add to your Claude Code skills
git clone https://github.com/paolobietolini/gtm-mcp-serverGuides for using mcp servers skills like gtm-mcp-server.
gtm-mcp-server is an open-source mcp servers skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by paolobietolini. An MCP server for Google Tag Manager. Connect it to your LLM, authenticate once, and start managing GTM through natural language. It has 192 GitHub stars.
gtm-mcp-server's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/paolobietolini/gtm-mcp-server" and add it to your Claude Code skills directory (see the Installation section above).
gtm-mcp-server is primarily written in Go. It is open-source under paolobietolini on GitHub, so you can review or fork the full source.
Yes. AgentsLLM lists many other MCP Servers skills you can browse and compare side by side. Open the MCP Servers category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh gtm-mcp-server against similar tools.
No comments yet. Be the first to share your thoughts!
Top skills in this category by stars
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
[!IMPORTANT] The hosted instance at
mcp.gtmeditor.comwas shut down during the night of 20–21 November 2026. There is no longer a public endpoint: to keep using the server, self-host it. Removehttps://mcp.gtmeditor.comfrom every MCP client configuration. The domain is not being renewed, so a future owner could serve something else at that address. See #139 for background. Thanks to everyone who used it!
GTM MCP Server connects MCP clients to the Google Tag Manager API. It can inspect containers, create and update workspace entities, create versions, and publish a selected version after explicit confirmation.
The repository also ships gtm-cli, a command-line tool
that gives people and agents direct GTM access with no server to host.
It authenticates either with browser-based Google OAuth (each user acts with their own Google identity and GTM permissions) or with a Google service account (one shared identity, for automation or a single local user).
| Item | Current state |
|---|---|
Version in server.json |
1.15.0 |
| Transport | MCP Streamable HTTP, or stdio for local service-account use |
| Runtime tools | 64 GTM tools by default; 94 with GTM_TOOL_GROUPS=all; plus 2 utility tools in both cases |
| MCP resources | 8 resource definitions (2 resources, 6 URI templates) |
| MCP prompts | 6 prompts |
| Official GTM API coverage | 101 of 106 methods |
| Hosted endpoint | None. mcp.gtmeditor.com was shut down on 20–21 November 2026 |
The project implements 101 methods from Google's 106-method GTM v2 discovery
surface. The five accounts.user_permissions methods are intentionally
excluded: granting and revoking GTM access is security-sensitive and should not
be managed by an LLM.
gtm-cli calls the Tag Manager API from your own machine, for shells, scripts and
agents such as Claude Code, Codex and Cursor. There is no server, MCP client
configuration or API key. It covers account, container and workspace discovery,
tag, trigger and variable create, read, update and delete, workspace status, and
version creation and publication. The MCP server covers the rest of the API.
With Go 1.26 or later:
go install github.com/paolobietolini/gtm-mcp-server/cmd/gtm-cli@latest
Releases also attach prebuilt archives named
gtm-cli_<version>_<os>_<arch> to the
release page. From a
clone:
go build -o bin/gtm-cli ./cmd/gtm-cli
Enable the Tag Manager API in a Google
Cloud project. gtm-cli finds credentials as stdio mode does:
GOOGLE_SERVICE_ACCOUNT_KEY_JSON, then Application Default Credentials (the file
in GOOGLE_APPLICATION_CREDENTIALS, then the gcloud login file, then the service
account attached on Google Cloud).
The plain gcloud login is not enough. gcloud auth application-default login
does not request Tag Manager scopes by default. Adding them to --scopes uses
gcloud's own OAuth client, which Google can reject with "This app is blocked"
(troubleshooting).
Use one of these instead.
Option 1: your own OAuth client, to act as yourself. In the Google Cloud project, configure the OAuth consent screen, create an OAuth client of type Desktop app and download its JSON file. While an external consent screen is in Testing, add yourself as a test user; Google expires those logins after 7 days.
SCOPES=https://www.googleapis.com/auth/cloud-platform
SCOPES+=,https://www.googleapis.com/auth/userinfo.email
for s in delete.containers edit.containers edit.containerversions manage.accounts publish; do
SCOPES+=,https://www.googleapis.com/auth/tagmanager.$s
done
gcloud auth application-default login \
--client-id-file=client_secret.json --scopes="$SCOPES"
Request fewer tagmanager scopes to limit what the CLI can do, for example only
tagmanager.readonly for audits.
Option 2: a service account, for automation. Create it and add it to GTM as in step 2b, then either point to its key file:
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa.json
or impersonate it without a key. This needs the IAM Service Account Credentials API and the Service Account Token Creator role on that account:
gcloud auth application-default login \
--impersonate-service-account=gtm-mcp@PROJECT_ID.iam.gserviceaccount.com
Check the result:
gtm-cli auth status
It prints the credential source and type, the account email when Google reports one, the quota project, and granted and missing scopes. It exits with code 3 if the credentials have no Tag Manager scope.
If a request fails for lack of a quota project, run
gcloud auth application-default set-quota-project PROJECT_ID.
gtm-cli accounts list --output table
gtm-cli containers list --account 123
gtm-cli workspaces list --account 123 --container 456
export GTM_ACCOUNT_ID=123 GTM_CONTAINER_ID=456 GTM_WORKSPACE_ID=7
gtm-cli tags list
gtm-cli tags create --file tag.json --dry-run
gtm-cli tags create --file tag.json
gtm-cli tags delete --tag-id 12 --confirm
gtm-cli workspaces status
gtm-cli versions create --name "Add sign_up event" --notes "GA4 sign_up on form submit"
gtm-cli versions publish --version-id 9 --confirm
gtm-cli help lists every command and gtm-cli <noun> <verb> --help its flags. A command
gtm-cli <nouns> <verb> matches the MCP tool verb_noun.
Missing --account, --container and --workspace flags are read from the
environment variables above, then from $XDG_CONFIG_HOME/gtm-cli/config.json
(normally ~/.config/gtm-cli/config.json), or from the file named by GTM_CONFIG:
{"accountId": "123", "containerId": "456", "workspaceId": "7"}
No configuration is read from the working directory, including .env.
--file takes a JSON object (- reads stdin):
{
"name": "HTML - Banner",
"type": "html",
"firingTriggerId": ["12"],
"parameter": [{"type": "template", "key": "html", "value": "<script></script>"}]
}
Parameter and condition shapes are in
tool-input-formats.md; the
gtm-cli skill lists the keys for each entity.
Unknown keys are rejected. On update, tags keep every omitted key; triggers and
variables require name and type and keep other omitted keys.
API commands print JSON with the same shape as the matching MCP tool's output;
--output table is for reading. Errors are JSON on stderr:
{"error": {"code": "not_found", "message": "resource not found: ..."}}
| Exit | error.code |
|---|---|
| 0 | success |
| 1 | api_error, cancelled, error |
| 2 | usage, invalid_input, invalid_request |
| 3 | auth |
| 4 | permission_denied |
| 5 | not_found |
| 6 | conflict, precondition_failed |
| 7 | rate_limited |
| 8 | confirmation_required |
A command gives up after two minutes. If a write ends in exit code 1, check the container before retrying: the change may have been applied.
delete and publish commands require --confirm.versions create refuses a workspace without changes or with merge conflicts.--dry-run, which prints the request and
sends no write. An update still reads the current entity, to show the full body
that would be sent. A dry run needs no --confirm.| Mode | Who it is for | Google identity used | How the client authenticates |
|---|---|---|---|
| stdio | One person, on their own machine | A service account | None: the MCP client starts the binary as a local process |
| HTTP + OAuth | Teams and agencies; every user keeps their own GTM permissions | Each user's own Google account | Browser sign-in with Google, handled by the MCP client |
| HTTP + service account | Automation, CI, agents, or a team that deliberately shares one identity | One service account for every caller | Static header Authorization: Bearer <SERVICE_ACCOUNT_API_KEY> |
| HTTP + OAuth + service account | Both of the above on one server | Per request: the API key selects the service account, any other bearer token is an OAuth user | Either of the two above |
Where the client connects from matters for remote (HTTP) deployments: