Skip to main content
Glama
gustavomkt

mcp-tagmanager

by gustavomkt

Google Tag Manager 的 MCP

专用于 Tag Manager 的 MCP 连接器,按照与 "Gustavo google ads- mcp" 相同的标准构建:每个操作都明确要求账户 / 容器 / 工作区(或版本)——没有任何隐式内容——并且影响生产环境的操作(暂停标签、发布版本)要求 confirm=true。这取代了之前"打开 Chrome 并读取屏幕"的做法,那是面板中最脆弱的标签页,因为它依赖网页界面而不是类型化的 API。

成本:Tag Manager API 是免费的(正常使用下 Google 不收费)。 它作为 Render 上的第二个免费 Web Service 部署,与 "Gustavo google ads- mcp" 相同——相同的套餐,相同的成本(零),你目前已经如此。

凭据的组织方式(标准化模式)

此服务器在生产环境中不使用 token.json 文件——它使用环境变量,与你其他在 Render 上的连接器一样:

  • GOOGLE_ADS_CLIENT_ID / GOOGLE_ADS_CLIENT_SECRET —— 复用, 它们是 "Gustavo google ads- mcp" 已经使用的同一个 OAuth 客户端。不需要为每个工具创建新客户端。

  • GTM_REFRESH_TOKEN —— 唯一的新值,Tag Manager 专用。

如果将来你希望为 Tag Manager 单独使用一个独立的 OAuth 客户端, 可以定义 GTM_CLIENT_ID / GTM_CLIENT_SECRET,它们优先于 Google Ads 的。

Related MCP server: Samarth GTM MCP Server

1. 将代码上传到 GitHub

  1. 仓库已创建:github.com/gustavomkt/mcp-tagmanager(公开)。

  2. 上传此文件夹中的所有文件,除了 client_secret.jsontoken.json.flow_state.json(这些仅用于本地测试; 绝不应上传——.gitignore 已将其排除)。

2. 在 Render 上部署

  1. Render → New → Web Service → 连接 mcp-tagmanager 仓库。

  2. Runtime:Docker(自动检测 Dockerfile)。

  3. 套餐:Free。

  4. 环境变量(你在 Render 的仪表板中自行添加—— 这些是凭据,所以我不会替你填写):

    • GOOGLE_ADS_CLIENT_ID = 与你在 Google Ads 服务中已有的值相同。

    • GOOGLE_ADS_CLIENT_SECRET = 与你在 Google Ads 服务中已有的值相同。

    • GTM_REFRESH_TOKEN = 我们已为 Tag Manager 生成的刷新令牌(我在聊天中单独分享给你了)。

  5. Create Web Service。构建完成后,复制公共 URL (类似 https://mcp-tagmanager.onrender.com)。

3. 在 Claude 中连接

将其添加为新的远程 MCP 连接器,指向上一步的 Render URL(末尾加 /mcp,例如 https://mcp-tagmanager.onrender.com/mcp ——这是标准的 streamable-http 端点)。连接后,通知我,我会更新控制面板的 Tag Manager 标签页,使其使用这些真实的工具,而不是基于浏览器的指令。

备选方案:使用文件在本地运行(无需 Render)

如果你将来想在笔记本电脑上运行而不是在 Render 上:

pip install -r requirements.txt
python auth_setup.py   # una vez, abre tu navegador
python server.py       # sin PORT definido, corre por stdio

server.py 首先在环境变量中查找 GTM_REFRESH_TOKEN + client_id/secret;如果找不到,则回退到 token.json

可用工具

读取(不改变任何内容):

  • list_accounts()

  • list_containers(account_id)

  • list_workspaces(account_id, container_id)

  • list_tags(account_id, container_id, workspace_id)

  • get_tag(account_id, container_id, workspace_id, tag_id)

  • list_triggers(account_id, container_id, workspace_id)

  • list_variables(account_id, container_id, workspace_id)

  • audit_workspace(account_id, container_id, workspace_id) —— 无触发器的标签、无标签的触发器、可能的重复项,以及是否配置了 Consent Mode。这是之前让 Claude 在 Chrome 中"读取屏幕并猜测"的可靠版本。

  • list_versions(account_id, container_id)

写入(要求 confirm=true):

  • pause_tag(...) / resume_tag(...) —— 在工作区中暂停或恢复标签。不发布容器。

  • create_version(...) —— 从工作区创建版本。不发布。

  • publish_version(account_id, container_id, version_id, confirm=true) —— 发布版本(进入生产环境)。也可用于回滚:传入 list_versions 中先前版本的 version_id

稳定性说明

  • 每次对 Google API 的调用都包含错误处理,返回清晰的消息({"ok": false, "error": "..."}),而不是无解释地断开 MCP 连接——这种静默失败正是其他连接器"无故掉线"的部分原因。

  • 令牌在每次调用时使用刷新令牌自动刷新;如果某天被撤销(更改密码、在 myaccount.google.com 手动撤销),错误会明确告诉你,只需生成一个新的 GTM_REFRESH_TOKEN

  • 由于是 Render 的免费 Web Service,一段时间不使用后会"休眠",之后的第一次调用需要约 ~50 秒才能响应——与今天的 "Gustavo google ads- mcp" 相同。这是连接器看起来"掉线"的最可能原因:不是错误,而是免费套餐的冷启动。如果将来你想消除这种延迟,唯一的方法是使用 Render 的付费套餐——这是你的决定,不是我会在未经你要求的情况下更改的事情。

F
license - not found
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    A
    quality
    D
    maintenance
    MCP server for Google Tag Manager API, enabling users to manage containers, tags, and triggers through natural language using Google Application Default Credentials.
    18
    30
    Apache 2.0
  • A
    license
    B
    quality
    A
    maintenance
    Production-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 audits
    100
    8,216
    1
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    MCP server for Google Tag Manager and GA4, enabling tag management, consent auditing, workspace versioning, and analytics reporting through natural language.
    18
    55
    2
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server for Google Tag Manager API v2, enabling programmatic management of accounts, containers, workspaces, tags, triggers, variables, and version workflows.
    48
    14
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for interacting with the Supabase platform

  • The official MCP Server from Mia-Platform to interact with Mia-Platform Console

  • MCP server for managing Prisma Postgres.

View all MCP Connectors

Latest Blog Posts

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/gustavomkt/mcp-tagmanager'

If you have feedback or need assistance with the MCP directory API, please join our Discord server