Skip to content
Back to search

google-tag-manager-mcp-server

MCP server for Google Tag Manager

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/stape-io/google-tag-manager-mcp-server with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/stape-io/google-tag-manager-mcp-server'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/stape-io--google-tag-manager-mcp-server/badge.svg)](/listings/stape-io--google-tag-manager-mcp-server)

HTML

<a href="/listings/stape-io--google-tag-manager-mcp-server"><img src="/api/listings/stape-io--google-tag-manager-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

This server comes in two flavours: Hosted server and Local CLI. Both give you the same 18 GTM tools; the difference is who handles Google auth.

| | Hosted server | Local CLI | | --- | --- | --- | | Auth | Google OAuth in your browser, handled for you | You supply a service account key, refresh token, or access token | | Data | Passes through `gtm-mcp.stape.ai` | Only ever leaves your machine | | Setup | None | Set one environment variable |

If you're a contributor testing an unreleased change rather than just using the tools, skip everything below and see [Test your changes locally](#test-your-changes-locally) instead.

Pick your client below. The hosted server needs the [`mcp-remote`](https://github.com/geelen/mcp-remote#readme) bridge on clients whose MCP support doesn't complete Google's OAuth flow natively; where a client does that itself, it connects straight to `https://gtm-mcp.stape.ai/mcp`.

Claude Desktop

<details> <summary>⬇️ Click to expand ⬇️</summary>

**Hosted server** — Claude Desktop connects to remote HTTP MCP servers natively, no bridge needed. Go to Settings → Connectors → Add custom connector, set the name to `gtm-mcp-server` and the URL to `https://gtm-mcp.stape.ai/mcp`, then save. Click the new connector to complete the Google OAuth flow in the browser window that opens.

> `mcp-remote` is also possible for the hosted server, for anyone who'd rather configure it through the JSON config file (Settings -> Developer -> Edit Config) instead of the Connectors UI — less recommended, but still supported: > > ```json > { > "mcpServers": { > "gtm-mcp-server": { > "command": "npx", > "args": [ > "-y", > "mcp-remote", > "https://gtm-mcp.stape.ai/mcp" > ] > } > } > } > ```

**Local CLI** — no OAuth flow, no data through anyone else's server, you supply a service account key or a refresh token. Open Settings -> Developer -> Edit Config and add:

{
  "mcpServers": {
    "gtm-mcp-server": {
      "command": "npx",
      "args": ["-y", "google-tag-manager-mcp-server"],
      "env": {
        "GOOGLE_SERVICE_ACCOUNT_KEY": "{\"type\":\"service_account\", ... }"
      }
    }
  }
}

See the [CLI README](packages/cli/README.md) for every credential option.

</details>

Claude Code

<details> <summary>⬇️ Click to expand ⬇️</summary>

Claude Code speaks HTTP directly, including the OAuth handshake, so the hosted server needs no bridge.

**Hosted server**:

claude mcp add --transport http gtm-mcp-server https://gtm-mcp.stape.ai/mcp

A browser window opens for the Google OAuth flow the first time a tool is used. Run `/mcp` inside Claude Code to confirm it connected.

**Local CLI**:

claude mcp add gtm-mcp-server -e GOOGLE_SERVICE_ACCOUNT_KEY='{"type":"service_account", ... }' -- npx -y google-tag-manager-mcp-server

Both write into `.mcp.json` / your Claude Code MCP config.

</details>

VS Code

<details> <summary>⬇️ Click to expand ⬇️</summary>

VS Code's MCP client supports HTTP servers and their OAuth flow natively, no `mcp-remote` needed. Add this to `.vscode/mcp.json`:

**Hosted server**:

{
  "servers": {
    "gtm-mcp-server": {
      "type": "http",
      "url": "https://gtm-mcp.stape.ai/mcp"
    }
  }
}

**Local CLI**:

{
  "servers": {
    "gtm-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "google-tag-manager-mcp-server"],
      "env": {
        "GOOGLE_SERVICE_ACCOUNT_KEY": "{\"type\":\"service_account\", ... }"
      }
    }
  }
}

</details>

GitHub Copilot

<details> <summary>⬇️ Click to expand ⬇️</summary>

GitHub Copilot Chat in VS Code uses VS Code's own MCP client, so it reads the same `.vscode/mcp.json` file — see [VS Code](#vs-code) above. No separate configuration is needed.

</details>

Copilot CLI

<details> <summary>⬇️ Click to expand ⬇️</summary>

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 530 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # MCP Server for Google Tag Manager
  2. [![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/stape-io/google-tag-manager-mcp-server)](https://archestra.ai/mcp-catalog/stape-io__google-tag-manager-mcp-server)
  3. An interface to the Google Tag Manager API over MCP, in two flavours: a hosted server with Google OAuth built in, and a local CLI that runs on your own credentials.
  4. ## Table of Contents
  5. - [MCP Server for Google Tag Manager](#mcp-server-for-google-tag-manager)
  6. - [Table of Contents](#table-of-contents)
  7. - [Repository layout](#repository-layout)
  8. - [Installation](#installation)
  9. - [Claude Desktop](#claude-desktop)
  10. - [Claude Code](#claude-code)
  11. - [VS Code](#vs-code)
  12. - [GitHub Copilot](#github-copilot)
  13. - [Copilot CLI](#copilot-cli)
  14. - [Cursor](#cursor)
  15. - [Antigravity](#antigravity)
  16. - [ChatGPT](#chatgpt)
  17. - [Other MCP clients](#other-mcp-clients)
  18. - [Troubleshooting](#troubleshooting)
  19. - [Test your changes locally](#test-your-changes-locally)
  20. - [Changes to `packages/core` or `packages/cli`](#changes-to-packagescore-or-packagescli)
  21. - [Changes to `apps/worker`](#changes-to-appsworker)
  22. - [1. Set up a Google Cloud OAuth client](#1-set-up-a-google-cloud-oauth-client)
  23. - [2. Configure local environment variables](#2-configure-local-environment-variables)
  24. - [3. Start the server](#3-start-the-server)
  25. - [4. Point your MCP client at the local server](#4-point-your-mcp-client-at-the-local-server)
  26. - [Releasing](#releasing)
  27. - [Development](#development)
  28. - [Useful resources](#useful-resources)
  29. - [Open Source](#open-source)
  30. ## Repository layout
  31. npm workspace with one app and two published packages:
  32. | Path | Package | What it is |
  33. | --- | --- | --- |
  34. | `apps/worker` | *(private)* | The hosted Cloudflare Worker at `gtm-mcp.stape.io`: Google OAuth, the approval flow, the public pages, session removal. |
  35. | `packages/cli` | [`google-tag-manager-mcp-server`](packages/cli/README.md) | The npm package: a local MCP server over stdio, authenticating with credentials you supply. |
  36. | `packages/core` | [`google-tag-manager-mcp-core`](packages/core/README.md) | Every GTM tool and schema, independent of how credentials are obtained. |
  37. Tools reach Google through a `GtmAuthProvider` (`getAccessToken(): Promise<string>`) rather than through any particular session, which is what lets the same tool set back both servers — and a private one with your own auth. See the [core package README](packages/core/README.md).
  38. ## Installation
  39. This server comes in two flavours: Hosted server and Local CLI. Both give you the same 20 GTM tools; the difference is who handles Google auth.
  40. | | Hosted server | Local CLI |
  41. | --- | --- | --- |
  42. | Auth | Google OAuth in your browser, handled for you | You supply a service account key, refresh token, or access token |
  43. | Data | Passes through `gtm-mcp.stape.io` | Only ever leaves your machine |
  44. | Setup | None | Set one environment variable |
  45. If you're a contributor testing an unreleased change rather than just using the tools, skip everything below and see [Test your changes locally](#test-your-changes-locally) instead.
  46. Pick your client below. The hosted server is a remote, HTTP-based MCP endpoint at `https://gtm-mcp.stape.io/mcp`. Clients that complete the Google OAuth flow themselves (Claude Desktop, Claude Code, VS Code, Copilot CLI, Cursor, ChatGPT) connect straight to that URL and sign you in with Google the first time they connect; the rest (Antigravity, stdio-only clients) reach it through [`mcp-remote`](https://github.com/geelen/mcp-remote#readme), a small bridge to remote HTTP MCP servers. Restart the client after changing its config.
  47. ### Claude Desktop
  48. <details>
  49. <summary>⬇️ Click to expand ⬇️</summary>
  50. **Hosted server, custom connector (recommended).**
  51. 1. Go to **Customize → Connectors → Add custom connector**. On Team and Enterprise plans, an Owner adds it under **Organization settings → Connectors → Add → Custom** instead, and each member then selects **Connect** on it under **Customize → Connectors** and signs in with their own Google account.
  52. 2. Set a name (e.g. `gtm-mcp-server`) and the URL to `https://gtm-mcp.stape.io/mcp`. If the dialog asks how to authenticate, choose **Sign in now**; if it asks for an OAuth client, choose **Register automatically** (the server doesn't support **Use Claude's published identity**).
  53. 3. Select **Add**, then **Connect**, and sign in with Google.
  54. The connector also works on claude.ai.
  55. **Hosted server, `mcp-remote`.** To configure it through `claude_desktop_config.json` (Settings → Developer → Edit Config) instead:
  56. ```json
  57. {
  58. "mcpServers": {
  59. "gtm-mcp-server": {
  60. "command": "npx",
  61. "args": [
  62. "-y",
  63. "mcp-remote",
  64. "https://gtm-mcp.stape.io/mcp"
  65. ]
  66. }
  67. }
  68. }
  69. ```
  70. **Local CLI** — no OAuth flow, no data through anyone else's server, you supply a service account key or a refresh token. Open Settings → Developer → Edit Config and add:
  71. ```json
  72. {
  73. "mcpServers": {
  74. "gtm-mcp-server": {
  75. "command": "npx",
  76. "args": ["-y", "google-tag-manager-mcp-server"],
  77. "env": {
  78. "GOOGLE_SERVICE_ACCOUNT_KEY": "{\"type\":\"service_account\", ... }"
  79. }
  80. }
  81. }
  82. }
  83. ```
  84. See the [CLI README](packages/cli/README.md) for every credential option.
  85. </details>
  86. ### Claude Code
  87. <details>
  88. <summary>⬇️ Click to expand ⬇️</summary>
  89. Claude Code speaks HTTP directly, including the OAuth handshake, so the hosted server needs no bridge.
  90. **Hosted server**:
  91. ```bash
  92. claude mcp add --transport http gtm-mcp-server https://gtm-mcp.stape.io/mcp
  93. ```
  94. Then run `/mcp` inside Claude Code (or `claude mcp login gtm-mcp-server` from the shell) and sign in with Google. `claude mcp list` shows whether it connected.
  95. **Local CLI**:
  96. ```bash
  97. claude mcp add gtm-mcp-server -e GOOGLE_SERVICE_ACCOUNT_KEY='{"type":"service_account", ... }' -- npx -y google-tag-manager-mcp-server
  98. ```
  99. Both add the server to the current project only. Add `--scope user` to use it in every project. `--scope project` writes it to the project's `.mcp.json`, which suits the hosted server (no secrets in it, each teammate signs in with their own Google account) but not the Local CLI, whose entry holds your credentials.
  100. </details>
  101. ### VS Code
  102. <details>
  103. <summary>⬇️ Click to expand ⬇️</summary>
  104. VS Code's MCP client supports HTTP servers and their OAuth flow natively, no `mcp-remote` needed. Add this to `.vscode/mcp.json` (this workspace) or to the file **MCP: Open User Configuration** opens (every workspace):
  105. **Hosted server**:
  106. ```json
  107. {
  108. "servers": {
  109. "gtm-mcp-server": {
  110. "type": "http",
  111. "url": "https://gtm-mcp.stape.io/mcp"
  112. }
  113. }
  114. }
  115. ```
  116. VS Code asks you to sign in with Google when the server first starts.
  117. **Local CLI**:
  118. ```json
  119. {
  120. "servers": {
  121. "gtm-mcp-server": {
  122. "type": "stdio",
  123. "command": "npx",
  124. "args": ["-y", "google-tag-manager-mcp-server"],
  125. "env": {
  126. "GOOGLE_SERVICE_ACCOUNT_KEY": "{\"type\":\"service_account\", ... }"
  127. }
  128. }
  129. }
  130. }
  131. ```
  132. </details>
  133. ### GitHub Copilot
  134. <details>
  135. <summary>⬇️ Click to expand ⬇️</summary>
  136. GitHub Copilot Chat in VS Code uses VS Code's own MCP client, so it reads the same MCP configuration — see [VS Code](#vs-code) above. No separate configuration is needed.
  137. </details>
  138. ### Copilot CLI
  139. <details>
  140. <summary>⬇️ Click to expand ⬇️</summary>
  141. **Hosted server** — Copilot CLI completes OAuth natively for remote HTTP servers:
  142. ```bash
  143. copilot mcp add --transport http gtm-mcp-server https://gtm-mcp.stape.io/mcp
  144. ```
  145. Sign in with Google when Copilot CLI prompts you.
  146. **Local CLI**:
  147. ```bash
  148. copilot mcp add --env GOOGLE_SERVICE_ACCOUNT_KEY='{"type":"service_account", ... }' gtm-mcp-server -- npx -y google-tag-manager-mcp-server
  149. ```
  150. Both write the server entry into `~/.copilot/mcp-config.json`. Run `copilot mcp get gtm-mcp-server` to check it. Inside an interactive session, `/mcp add` does the same through a form. See [GitHub's docs](https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers#using-the-copilot-mcp-add-subcommand) for more.
  151. </details>
  152. ### Cursor
  153. <details>
  154. <summary>⬇️ Click to expand ⬇️</summary>
  155. Cursor speaks HTTP directly, including the OAuth flow, no `mcp-remote` needed. Add this to `.cursor/mcp.json` (this project) or `~/.cursor/mcp.json` (every project):
  156. **Hosted server**:
  157. ```json
  158. {
  159. "mcpServers": {
  160. "gtm-mcp-server": {
  161. "url": "https://gtm-mcp.stape.io/mcp"
  162. }
  163. }
  164. }
  165. ```
  166. Then sign in with Google from the server's entry under **Customize** in Cursor's sidebar.
  167. **Local CLI**:
  168. ```json
  169. {
  170. "mcpServers": {
  171. "gtm-mcp-server": {
  172. "command": "npx",
  173. "args": ["-y", "google-tag-manager-mcp-server"],
  174. "env": {
  175. "GOOGLE_SERVICE_ACCOUNT_KEY": "{\"type\":\"service_account\", ... }"
  176. }
  177. }
  178. }
  179. }
  180. ```
  181. </details>
  182. ### Antigravity
  183. <details>
  184. <summary>⬇️ Click to expand ⬇️</summary>
  185. Antigravity's OAuth support for remote HTTP servers doesn't get a token to the server yet ([antigravity-cli#25](https://github.com/google-antigravity/antigravity-cli/issues/25)), so use `mcp-remote` for the hosted server here. Add this to `~/.gemini/config/mcp_config.json`, which the Antigravity editor and CLI share. In the editor, open it from the agent panel via **… → MCP Servers → Manage MCP Servers → View raw config**:
  186. **Hosted server**:
  187. ```json
  188. {
  189. "mcpServers": {
  190. "gtm-mcp-server": {
  191. "command": "npx",
  192. "args": [
  193. "-y",
  194. "mcp-remote",
  195. "https://gtm-mcp.stape.io/mcp"
  196. ]
  197. }
  198. }
  199. }
  200. ```
  201. **Local CLI**:
  202. ```json
  203. {
  204. "mcpServers": {
  205. "gtm-mcp-server": {
  206. "command": "npx",
  207. "args": ["-y", "google-tag-manager-mcp-server"],
  208. "env": {
  209. "GOOGLE_SERVICE_ACCOUNT_KEY": "{\"type\":\"service_account\", ... }"
  210. }
  211. }
  212. }
  213. }
  214. ```
  215. Or, from the Antigravity CLI, run one of these (`agy mcp add` replaces an entry with the same name):
  216. **Hosted server**:
  217. ```bash
  218. agy mcp add gtm-mcp-server -- npx -y mcp-remote https://gtm-mcp.stape.io/mcp
  219. ```
  220. **Local CLI**:
  221. ```bash
  222. agy mcp add --env GOOGLE_SERVICE_ACCOUNT_KEY='{"type":"service_account", ... }' gtm-mcp-server -- npx -y google-tag-manager-mcp-server
  223. ```
  224. `mcp-remote` opens the Google sign-in in your browser the first time it connects.
  225. </details>
  226. ### ChatGPT
  227. <details>
  228. <summary>⬇️ Click to expand ⬇️</summary>
  229. 1. In ChatGPT on the web, go to [Plugins](https://chatgpt.com/plugins), select **+**, then **Add custom MCP server**.
  230. 2. Enter a name (e.g. `gtm-mcp-server`) and, under **Connection**, set the server URL to `https://gtm-mcp.stape.io/mcp`.
  231. 3. Set authentication to **OAuth**. The server supports Dynamic Client Registration, so no client ID or secret is needed.
  232. 4. Confirm the risk warning (**I understand and want to continue**), then select **Create as a plugin**.
  233. 5. Install the plugin from your personal plugins, sign in with Google, and pick it with `@` in the prompt box.
  234. ChatGPT only reaches servers over the public internet, so there's no Local CLI option here, only the hosted server. Workspace admins can restrict custom MCP servers. See [OpenAI's docs](https://developers.openai.com/api/docs/guides/custom-mcp-server) for more.
  235. </details>
  236. ### Other MCP clients
  237. <details>
  238. <summary>⬇️ Click to expand ⬇️</summary>
  239. If your client supports remote HTTP MCP servers with OAuth, point it at `https://gtm-mcp.stape.io/mcp`, as in the [Cursor](#cursor) config. Otherwise, use `mcp-remote` for the hosted server:
  240. ```json
  241. {
  242. "mcpServers": {
  243. "gtm-mcp-server": {
  244. "command": "npx",
  245. "args": [
  246. "-y",
  247. "mcp-remote",
  248. "https://gtm-mcp.stape.io/mcp"
  249. ]
  250. }
  251. }
  252. }
  253. ```
  254. Or the local CLI directly, with your credentials:
  255. ```json
  256. {
  257. "mcpServers": {
  258. "gtm-mcp-server": {
  259. "command": "npx",
  260. "args": ["-y", "google-tag-manager-mcp-server"],
  261. "env": {
  262. "GOOGLE_SERVICE_ACCOUNT_KEY": "{\"type\":\"service_account\", ... }"
  263. }
  264. }
  265. }
  266. }
  267. ```
  268. </details>
  269. ### Troubleshooting
  270. **Authentication errors**
  271. If tools fail with 401/403 errors, ask your assistant to run `gtm_auth_status`. It reports whether the current Google token is accepted, when it expires and which Tag Manager scopes are missing, without revealing the token.
  272. **MCP Server Name Length Limit**
  273. Some MCP clients (like Cursor AI) have a 60-character limit for the combined MCP server name + tool name length. If you use a longer server name in your configuration (e.g., `gtm-mcp-server-your-additional-long-name`), some tools may be filtered out.
  274. To avoid this issue:
  275. - Use shorter server names in your MCP configuration (e.g., `gtm-mcp-server`)
  276. **Clearing MCP Cache**
  277. If you're connecting through `mcp-remote` (Antigravity, Claude Desktop configured that way, or other clients using the `mcp-remote` block), it stores all the credential information inside `~/.mcp-auth` (or wherever your `MCP_REMOTE_CONFIG_DIR` points to). If you're having persistent issues, try running:
  278. ```bash
  279. rm -rf ~/.mcp-auth
  280. ```
  281. Then, restart your MCP client.
  282. ## Test your changes locally
  283. Which workflow you need depends on what you changed. Most changes are in the first
  284. category — reach for the second only if you're touching the Worker itself.
  285. ### Changes to `packages/core` or `packages/cli`
  286. This is the tool logic itself (schemas, GTM API calls, error handling) — almost
  287. everything you'd fix or add lives here. You don't need a Google Cloud OAuth client
  288. or any Worker setup: build from source and run the CLI directly with credentials
  289. you already have.
  290. ```bash
  291. git clone https://github.com/stape-io/google-tag-manager-mcp-server
  292. cd google-tag-manager-mcp-server
  293. gh pr checkout <PR number> # or: git checkout <your-branch>
  294. npm install
  295. npm run build
  296. ```
  297. Point your MCP client at the local build instead of `npx` — same credential
  298. options as the [Claude Desktop](#claude-desktop) Local CLI example above, an access
  299. token from the [OAuth Playground](https://developers.google.com/oauthplayground) is
  300. the fastest way to test a single change:
  301. ```json
  302. {
  303. "mcpServers": {
  304. "gtm-mcp-local": {
  305. "command": "node",
  306. "args": ["/absolute/path/to/google-tag-manager-mcp-server/packages/cli/dist/index.js"],
  307. "env": {
  308. "GOOGLE_ACCESS_TOKEN": "..."
  309. }
  310. }
  311. }
  312. }
  313. ```
  314. See the [CLI README](packages/cli/README.md) for every credential option.
  315. ### Changes to `apps/worker`
  316. Only needed for the hosted server's own code: the OAuth flow, routing, session
  317. handling, the approval and status pages. This runs that code on your own machine
  318. against your own Google Cloud OAuth credentials instead of `gtm-mcp.stape.io`.
  319. #### 1. Set up a Google Cloud OAuth client
  320. 1. In the [Google Cloud Console](https://console.cloud.google.com/), create or select a project, then enable the **Tag Manager API**.
  321. 2. Go to **APIs & Services > OAuth consent screen** and configure it (External is fine). While the app is in **Testing** publishing status, only accounts listed as test users can log in.
  322. 3. Go to **Audience**, under **Test users** add your own Google account.
  323. 4. Go to **APIs & Services > Credentials > Create Credentials > OAuth client ID**, type **Web application**.
  324. 5. Under **Authorized redirect URIs**, add `http://localhost:8788/callback`. (You can leave **Authorized JavaScript origins** empty — this flow is server-side only, no browser JS calls Google directly.)
  325. 6. Save, then copy the generated **Client ID** and **Client secret**.
  326. #### 2. Configure local environment variables
  327. Copy the example file and fill in the values from the previous step:
  328. ```bash
  329. cp apps/worker/.dev.vars.example apps/worker/.dev.vars
  330. ```
  331. ```
  332. GOOGLE_CLIENT_ID="<your client ID>"
  333. GOOGLE_CLIENT_SECRET="<your client secret>"
  334. COOKIE_ENCRYPTION_KEY="<any random string, at least 32 chars, e.g. output of: openssl rand -hex 32>"
  335. WORKER_HOST="http://localhost:8788"
  336. HOSTED_DOMAIN=""
  337. ```
  338. `.dev.vars` is git-ignored — it's only used locally and never committed.
  339. #### 3. Start the server
  340. ```bash
  341. npm install
  342. npm run build
  343. npm run dev
  344. ```
  345. `npm run build` compiles the core package the Worker bundles against; `npm run dev` starts the Worker on `http://localhost:8788`.
  346. #### 4. Point your MCP client at the local server
  347. Claude Desktop's Custom Connectors need a publicly reachable URL, so `mcp-remote` is the only option for pointing at `localhost`:
  348. ```json
  349. {
  350. "mcpServers": {
  351. "gtm-mcp-server-local": {
  352. "command": "npx",
  353. "args": ["-y", "mcp-remote", "http://localhost:8788/mcp"]
  354. }
  355. }
  356. }
  357. ```
  358. Restart Claude Desktop. A browser window will open for the Google OAuth flow; log in with the
  359. account you added as a test user in step 1.
  360. **Note:** if you've previously connected to the hosted server (or switch back and forth between
  361. local and hosted), clear mcp-remote's cache first (see [Troubleshooting](#troubleshooting) above)
  362. and fully restart your MCP client, otherwise it may reuse a stale/cached connection.
  363. ## Releasing
  364. Versions and changelogs are managed with [Changesets](https://github.com/changesets/changesets). Along with a change that should ship, add:
  365. ```bash
  366. npm run changeset
  367. ```
  368. On merge to `main` the release workflow opens a "Version Packages" PR; merging that PR publishes to npm, core first and then the CLI that depends on it. The Worker is private and never published — it deploys from `main` on every push.
  369. ## Development
  370. Repository tooling requires Node.js 22+ (Wrangler's minimum); `.nvmrc` selects
  371. Node 24, as used by the main CI jobs. Published core and CLI packages retain
  372. Node.js 20.3+ support, verified by a separate compatibility job.
  373. ```bash
  374. npm install
  375. npm run build # core, then the CLI, then the Worker's generated version
  376. npm run typecheck
  377. npm run lint
  378. npm run smoke # starts the built CLI and runs an MCP handshake against it
  379. ```
  380. `npm test` builds fixtures once before running workspace suites. A standalone
  381. `npm test -w google-tag-manager-mcp-core` builds its own core/CLI fixtures.
  382. `npm test --ignore-scripts` expects fixtures to have been built explicitly.
  383. `npm run check:versions` detects generated version-source drift without repairing
  384. it. CI runs this before builds; use `node scripts/generate-version.mjs --all` to
  385. regenerate it. The release workflow uses `npm run version-packages` so changeset
  386. version bumps also regenerate core, CLI, and Worker source before committing.
  387. Pull requests run all of the above plus a Worker bundle check, and flag changes to a published package that arrive without a changeset.
  388. Both `@modelcontextprotocol/sdk` and `agents` are pinned to exact versions in `apps/worker`. The SDK identifies tool schemas with `instanceof`, so the whole workspace has to resolve a single copy, and `agents` releases pin the SDK version they were built against. Bump them together and deploy deliberately.
  389. ## Useful resources
  390. - [Step-by-step guide: MCP Server for Google Tag Manager](https://stape.io/blog/mcp-server-for-google-tag-manager)
  391. ## Open Source
  392. The **MCP Server for Google Tag Manager** is developed and maintained by [Stape Team](https://stape.io/) under the Apache 2.0 license.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.