Labsco
MCP SERVER

Google Tag Manager

by stape-io

The Google Tag Manager API as MCP tools, in two forms: a hosted server with Google OAuth already built in, or a local one running on credentials you supply.

SEO, Web & Product Analytics
Summary
Same tools, two trust models — pick one.

The split here is the useful part. If you want GTM in an assistant this afternoon, the hosted Worker handles OAuth and you paste four lines. If your tags are the kind of thing that cannot route through a third party, the identical tool set runs locally on your own service account, because credentials are fetched through an interface rather than baked into the tools.

What it is

An interface to the Google Tag Manager API over MCP, shipped as two things that share the same tool set. The hosted flavour is a Cloudflare Worker at `gtm-mcp.stape.ai` that handles Google OAuth and the approval flow for you; the local flavour is an npm package running over stdio against a service account key or refresh token you provide.

What you get
  • Every GTM tool and schema, held in a `google-tag-manager-mcp-core` package that is independent of how credentials are obtained
  • A hosted path where connecting means pasting one config and completing a browser OAuth flow — no key handling on your side
  • A local path where no data passes through anyone else's server: the `google-tag-manager-mcp-server` package run through `npx` with `GOOGLE_SERVICE_ACCOUNT_KEY` set, or a refresh token instead
  • Tools that reach Google through an auth provider interface rather than a specific session, which is what lets the same tool set back a private deployment with your own auth
  • A self-hostable Worker you can run locally against your own Google Cloud OAuth client for testing before deploying
Requirements

For the hosted server: nothing but the config, and a Google account to authorise. For the local server: Node with `npx`, plus either a service account key in `GOOGLE_SERVICE_ACCOUNT_KEY` or a refresh token. Running the Worker yourself needs a Google Cloud project with the Tag Manager API enabled, an OAuth client with `http://localhost:8788/callback` as a redirect URI, and `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `COOKIE_ENCRYPTION_KEY` and `WORKER_HOST` in `.dev.vars`. One gotcha worth knowing before you name things: some clients cap the combined server name plus tool name at 60 characters, and a long server name silently filters tools out — keep it short, as in `gtm-mcp-server`.

Setup effort

One command plus a key — npx -y mcp-remote https://gtm-mcp.stape.ai/mcp, then supply credentials