Google Tag Manager MCP serverand Python AI tasks
qbash hosts a Google Tag Manager MCP server you can use in Claude, ChatGPT, Codex, Cursor, Grok Bot and Muse. Developers use qbash Tasks to write cloud-hosted Python functions that pair Google Tag Manager with models such as Claude and GPT.
Add the qbash MCP
Use Google Tag Manager from Claude Code, Codex, Cursor and other MCP clients. Connect Google Tag Manager in qbash, and your agent can work with its data and build Tasks that call it.
claude mcp add --transport http qbash https://mcp.qbash.com/mcp
Then run /mcp in Claude Code and sign in with qbash.
- List accounts, containers and workspaces, or find a container by its GTM- ID
- Read the tags, triggers and variables in a workspace
- Read the live version or any earlier one with everything it contains
- See the unpublished changes and merge conflicts in a workspace
- Create, update and delete tags, triggers and variables
- Turn on built-in variables such as Page URL and Click Text
Write a Google Tag Manager task in Python
A qbash Task is a Python function hosted in the cloud. Python is the runtime and defines the process, and built-in inline prompts run on leading models such as Claude, GPT, Gemini and Grok.
Run a Task on a schedule, from an HTTP request or when a connected app sends an event. Your agents and chat tools call it over MCP.
Each run is logged with its inputs and results, and you can turn data logging off for any Task. Every Task has version control, and each run is locked to the version it ran.
Audit what is live on the site
Read the published version of a container, then ask an inline prompt which tags fire on every page, which are paused and which load third-party scripts.
live = qbash.integrations.google_tag_manager.get_live_version(
account_id=qbash.inputs.get("account_id"),
container_id=qbash.inputs.get("container_id"),
)
version = live.get("version") or {}
if version.get("tag"):
audit = qbash.ai.run_prompt(
slug="google-tag-manager-live-audit",
variables={"version": json.dumps(version)},
)
qbash.output({"version": version.get("name"), "tags": len(version["tag"]), "audit": audit})
else:
qbash.output("The live version has no tags.")
Sample get_live_version response
{
"status": "success",
"version": {
"accountId": "6123456789",
"containerId": "198765432",
"containerVersionId": "14",
"name": "Add pricing page events",
"fingerprint": "1731398400000",
"container": {
"containerId": "198765432",
"publicId": "GTM-QB4SH12",
"name": "qbash.com"
},
"tag": [
{
"tagId": "3",
"name": "Google tag",
"type": "googtag",
"parameter": [
{
"type": "template",
"key": "tagId",
"value": "G-QBASH0001"
}
],
"firingTriggerId": [
"2147479553"
]
},
{
"tagId": "7",
"name": "GA4 event - start trial",
"type": "gaawe",
"parameter": [
{
"type": "template",
"key": "eventName",
"value": "start_trial"
}
],
"firingTriggerId": [
"5"
]
},
{
"tagId": "9",
"name": "Chat widget",
"type": "html",
"paused": true,
"parameter": [
{
"type": "template",
"key": "html",
"value": "<script src=\"https://widget.example.com/loader.js\"></script>"
}
],
"firingTriggerId": [
"2147479553"
]
}
],
"trigger": [
{
"triggerId": "5",
"name": "Start trial click",
"type": "click",
"filter": [
{
"type": "contains",
"parameter": [
{
"type": "template",
"key": "arg0",
"value": "{{Click Text}}"
},
{
"type": "template",
"key": "arg1",
"value": "Start free"
}
]
}
]
}
],
"variable": [],
"builtInVariable": [
{
"name": "Click Text",
"type": "clickText"
}
]
}
}
Custom MCP server
Build a custom MCP server with Google Tag Manager
Create a hosted MCP server that combines Google Tag Manager tools with your other connectors, Tasks and memory folders. You choose each tool it exposes, so a server can share Google Tag Manager reads with write tools left off.
Share the server with your team, and each person adds it to the client they already use.
How to set it up
- Connect Google Tag Manager on the qbash Connectors page.
- Create an MCP server and add the Google Tag Manager tools you want to share.
- Paste the server URL into your client. It connects with OAuth or an access token.
Google Tag Manager MCP questions
Does Google publish an official Tag Manager MCP server?
Google doesn't list one among its MCP servers. qbash calls the Tag Manager API v2 directly, so ChatGPT, Claude and Python tasks get the same methods.
Can it publish changes to my live site?
Yes. create_version turns a workspace into a version and publish_version makes it live. Pass the version's fingerprint to publish_version so Google refuses the publish when someone changed the version after you read it. Leave both tools off a chat server that should only read.
Can it delete containers or change who has access?
No. The connector asks Google for read, edit, version and publish access only. Deleting containers, managing users and changing account settings stay in the Tag Manager web app.
How many requests can a task make?
Google allows 25 Tag Manager requests per 100 seconds for each app, and qbash connections share that allowance. A task that audits many containers should read the live version once per container and leave a pause between containers.
Related analytics connectors
Build a Google Tag Manager task
Write it in Python with AI steps, or describe it to your coding agent through the qbash MCP.