Google Tag Manager MCP compared with AgentFirstStack Tags
Stape's open-source Google Tag Manager MCP server lets an agent edit a GTM account you already have: sign in with Google, then create containers, tags, triggers and variables, and publish versions. AgentFirstStack Tags is a tag manager an agent creates from nothing, with server-side delivery to Meta, Google Ads, TikTok and GA4 built in.
Set it up with one prompt
Paste this into your coding agent. It scans the site first, so an existing GTM setup isn't overwritten blind.
Set up AgentFirstStack conversion tracking for this project. It's a free, open-source tag manager with server-side conversion APIs, built for agents. You can do the setup yourself: there is no signup form, and no email or verification is needed. 1. Read https://agentfirststack.com/llms.txt and https://tags.agentfirststack.com/llms.txt. 2. If this project's .env already has AGENTFIRSTSTACK_API_KEY, use it. Otherwise get a key with one request: curl -X POST https://agentfirststack.com/v1/signup Save api_key in .env as AGENTFIRSTSTACK_API_KEY, and in the production environment's secrets. 3. Create a tags container for the production domain, add its snippet to <head>, deploy, and run scan. If the site already loads a Google Tag Manager container, tell me what it fires before you change anything. 4. Run setup with the conversions that matter here (sign-ups, purchases, leads) and the platforms this business uses (Google Ads, Meta, GA4, TikTok). If you have tools for those platforms, use them to find the IDs. Otherwise ask me for exactly the IDs and tokens setup reports as missing, and tell me where to find each one. 5. Validate the draft, test every destination and show me each platform's answer, then publish. 6. Write the container id and the env var that holds the key (never the key itself) in AGENTFIRSTSTACK.md, and create a claim link for me with POST https://agentfirststack.com/v1/claim-link. When you're done, tell me what you set up, what each test returned, what's still waiting on me, and give me the claim link.
The Google Tag Manager MCP server
The GTM MCP server compared here is stape-io/google-tag-manager-mcp-server, developed and maintained by the Stape team under Apache-2.0. It calls Google's Tag Manager API with your Google credentials:
- The hosted server is
https://gtm-mcp.stape.io/mcp. In Claude Code:claude mcp add --transport http gtm-mcp-server https://gtm-mcp.stape.io/mcp, then sign in with Google when it first connects. - A local CLI takes a service account key or a refresh token instead, so no data passes through Stape's server.
- It has 20 tools, most of them one per GTM resource with an action parameter:
gtm_container,gtm_tag,gtm_trigger,gtm_variable,gtm_versionand so on. Tags, triggers, variables and containers can be created; versions can be published. - The account tool only gets, lists and updates. That matches the API: Google's accounts resource has no create method, so a person creates the GTM account first.
Server-side GTM is a second piece. Google's server-side tagging docs say it runs on a server you control, in your own Google Cloud project or another environment. Stape provides hosting for it, and its separate Stape MCP server (https://mcp.stape.io/mcp, with a Stape API key) manages Stape containers, logs and billing.
How AgentFirstStack Tags works
One snippet on the site, and everything else by API or MCP. The browser side fires pixels; the server side calls each platform's conversion API with the owner's credentials. There is no tagging server to run.
T=https://tags.agentfirststack.com
H="Authorization: Bearer $AGENTFIRSTSTACK_API_KEY"
J="content-type: application/json"
curl -s -X POST $T/v1/containers -H "$H" -H "$J" -d '{"domain":"example.com"}'
# install the returned <script> in <head>, deploy, then:
curl -s -X POST $T/v1/containers/$C/scan -H "$H" # tags, forms, thank-you pages
curl -s -X POST $T/v1/containers/$C/setup -H "$H" -H "$J" -d @setup.json
curl -s -X POST $T/v1/containers/$C/draft/validate -H "$H"
curl -s -X POST $T/v1/containers/$C/destinations/$D/test -H "$H" # its answer
curl -s -X POST $T/v1/containers/$C/publish -H "$H" -H "$J" -d '{"note":"purchase"}'
scan reports what the pages already load (GTM containers, G- and AW- tags, Meta and TikTok pixels and others), the forms and the likely thank-you pages, and suggests a config.
setup takes conversions in plain terms ("purchase when the dataLayer gets a purchase event") and writes a validated draft with the tags, triggers and variables, plus a list of the IDs and tokens still missing and where the owner finds each.
Published versions are kept (the last 10 on the hosted service), and rollback moves the live pointer back. destinations/:id/test sends a test event in the platform's test mode and returns its answer, and the event log shows what each platform received. Over MCP the same calls are tags_scan_site, tags_setup_conversion_tracking, tags_test_destination and tags_publish. The tags manual has the full config format.
Side by side
| GTM through Stape's MCP server | AgentFirstStack Tags | |
|---|---|---|
| Account | A GTM account a person creates; the API can't | Created by POST /v1/signup |
| Agent auth | Google sign-in (hosted) or a service account (local) | An API key; OAuth 2.1 for chat apps |
| Containers and publishing | Create containers, edit tags, triggers and variables, publish versions | Create a container, edit the draft, validate, preview, publish, roll back |
| Server-side | A server container on a tagging server you host or rent | Included: the service calls Meta, Google Ads, TikTok and GA4 |
| Browser tags | GTM's tag types and templates | GA4, Google Ads, Meta, TikTok, LinkedIn, Microsoft UET, Reddit, X, Pinterest, custom HTML and JS |
| License | Apache-2.0 (the MCP server) | MIT (the whole service) |
When to choose which
Use Google Tag Manager and its MCP server if
- Your marketing team already works in GTM and you want an agent to help edit it.
- You depend on tags or community templates that AgentFirstStack doesn't have.
- You already run server-side GTM, on Google Cloud or Stape.
Use AgentFirstStack Tags if
- It's a new site, and the agent should set up conversion tracking end to end.
- You want the Meta Conversions API, Google Ads and TikTok server-side without running a tagging server.
- You want the browser and server copies of a conversion to share one event id, so each platform counts it once (how dedup works).
For analytics next to it, see Google Analytics MCP compared, or start from the home page prompt, which sets up every service at once.
FAQ
Who maintains the Google Tag Manager MCP server?
The Stape team, under Apache-2.0. It calls Google's Tag Manager API with your own Google credentials, either through Stape's hosted endpoint with Google sign-in or as a local CLI with a service account.
Can a GTM MCP server create a GTM account?
No. The Tag Manager API's accounts resource has get, list and update, but no create. A person creates the account in GTM; the MCP server can then create containers in it.
What's the difference between the Stape MCP and the GTM MCP?
The GTM MCP server edits Google Tag Manager itself. The Stape MCP server manages your Stape account (containers hosted on Stape, logs, billing) with a Stape API key.
Can AgentFirstStack import my GTM container?
No. Its scan finds GTM containers and other tags on your pages, and setup builds a new config from the conversions you describe. You can keep GTM running while you move tags over.
Related
- Server-side conversion trackingMeta, Google Ads, TikTok and GA4, counted once.
- AnalyticsGoogle Analytics MCP comparedRead GA4, or let the agent create the analytics.
- AnalyticsAdd analytics with Claude CodeOne prompt: a key, a site, the snippet, a verify check.
- AnalyticsPostHog MCP comparedA product platform, or web analytics an agent sets up alone.
- AnalyticsMixpanel MCP comparedQuery a Mixpanel org, or start from nothing.
- All servicesOne MCP server for every serviceAnalytics, tags, mail and replay tools on one key.
- MailGmail MCPInboxes an agent creates for itself.
- MailAgentMail alternativeFree inboxes for agents, with wait-for-email.
- MailEmail inboxes for AI agentsSign up for services and read the codes.
- ReplayMicrosoft Clarity MCPSession replay an agent reads as text.
- ReplaySession replay for AI agentsFind out why visitors drop off.