mcp-google-tagmanager 1.3.4 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -57,7 +57,7 @@ Start with a read-only question:
57
57
  You need Node.js 20+ and a Google account. Credentials are not required at install time — the server connects from the conversation.
58
58
 
59
59
  1. Add the server to your AI app.
60
- 2. Say "connect Google Tag Manager": the assistant walks you through [creating the OAuth client and approving access](#getting-access) without editing config files.
60
+ 2. Say "connect Google Tag Manager": the assistant gives you a Google sign-in link — [no Google Cloud project or OAuth client to create](#getting-access).
61
61
  3. Start with the read-only question above.
62
62
 
63
63
  <details open>
@@ -69,14 +69,7 @@ You need Node.js 20+ and a Google account. Credentials are not required at insta
69
69
 
70
70
  1. Open **Settings → MCP servers**.
71
71
  2. Select **Add server**.
72
- 3. Choose **STDIO**, then enter `npx -y mcp-google-tagmanager@latest` and the three environment variables below.
73
-
74
- | Variable | Value |
75
- |---|---|
76
- | `GOOGLE_TAGMANAGER_CLIENT_ID` | Your Google OAuth client ID |
77
- | `GOOGLE_TAGMANAGER_CLIENT_SECRET` | Your Google OAuth client secret |
78
- | `GOOGLE_TAGMANAGER_REFRESH_TOKEN` | Your Google OAuth refresh token |
79
-
72
+ 3. Choose **STDIO**, then enter `npx -y mcp-google-tagmanager@latest`.
80
73
  4. Select **Save**, then **Restart**.
81
74
 
82
75
  **From the command line:**
@@ -245,12 +238,20 @@ Google Tag Manager requires OAuth 2.0; an API key is not enough. There are two w
245
238
 
246
239
  ### Connect from the chat (recommended)
247
240
 
248
- Say "connect Google Tag Manager" and the assistant runs the flow with you:
241
+ Say "connect Google Tag Manager". The server ships with a built-in OAuth client, so there is no Google Cloud project or OAuth client to create:
242
+
243
+ 1. `start_login` returns a Google consent link. Open it **on this machine** and approve; the code comes back to a one-shot listener on `127.0.0.1` (PKCE), never through the chat.
244
+ 2. `finish_login` exchanges the code, saves the tokens to `~/.config/mcp-google-tagmanager/credentials.json` (mode 0600) and verifies them with a real Tag Manager API call — so an API that is still switched off is caught right there.
245
+
246
+ Google may show a **"Google hasn't verified this app"** screen while the app's verification is in progress: choose **Advanced → Go to A1 MCP**. The built-in client only identifies the app to Google — the tokens are issued to and stored on your machine, and A1 never receives them.
247
+
248
+ #### Use your own OAuth client
249
+
250
+ The built-in client and its Google API quota are shared by everyone who uses it. Bring your own client to get a quota of your own, or when a Google Workspace admin blocks third-party apps:
249
251
 
250
252
  1. `setup_instructions` prints the checklist: create or select a Google Cloud project, enable **Tag Manager API**, configure the consent screen and create a **Desktop app** OAuth client.
251
- 2. Download that client's JSON ("Download JSON") and give the assistant its **path** — `set_client` stores it owner-only. The secret never goes through the conversation.
252
- 3. `start_login` returns a Google consent link. Open it **on this machine** and approve; the code comes back to a one-shot listener on `127.0.0.1` (PKCE), never through the chat.
253
- 4. `finish_login` exchanges the code and saves the tokens to `~/.config/mcp-google-tagmanager/credentials.json` (mode 0600) and verifies them with a real Tag Manager API call — so an API that is still switched off is caught right there.
253
+ 2. Download that client's JSON ("Download JSON") and give the assistant its **path** — `set_client` stores it owner-only. The secret never goes through the conversation. From then on it takes priority over the built-in client.
254
+ 3. Run `start_login` and `finish_login` again.
254
255
 
255
256
  The tokens are re-read on every call, so the connection works immediately — no restart of the AI app. `auth_status` shows what is connected, `logout` revokes and deletes it.
256
257
 
@@ -286,7 +287,7 @@ Every variable is optional — with none of them the server connects [from the c
286
287
  | `GOOGLE_TAGMANAGER_MAX_RETRIES` | No | Maximum retries on temporary failures; default `3`. |
287
288
  | `GOOGLE_TAGMANAGER_MIN_INTERVAL_MS` | No | Minimum request spacing; default `4200` ms. |
288
289
 
289
- \* Provide either the OAuth trio or an access token. Access tokens expire in about an hour and are not refreshed automatically.
290
+ \* Only for a setup without the in-chat login: provide either the OAuth trio or an access token. Access tokens expire in about an hour and are not refreshed automatically.
290
291
 
291
292
  ## Data and telemetry
292
293
 
package/README.ru.md CHANGED
@@ -12,7 +12,7 @@
12
12
  Сервер подключается к Google Tag Manager API v2 через ваш аккаунт Google. В отличие от догадки AI о настройке GTM, он работает с выбранными вами настоящими контейнером, рабочим пространством и версией.
13
13
 
14
14
  - **25 инструментов.** 10 операций только читают данные GTM; 4 создают черновики или меняют встроенные переменные; 5 могут изменить, удалить, собрать или опубликовать конфигурацию.
15
- - **Подключение из диалога.** Скажите «подключи Google Tag Manager»: сервер проведёт через создание OAuth-клиента, поймает редирект Google на `127.0.0.1` с PKCE и сам сохранит токены — без конфигов и перезапуска.
15
+ - **Подключение из диалога.** Скажите «подключи Google Tag Manager»: встроенный OAuth-клиент уже есть — сервер даст ссылку на согласие Google, поймает редирект Google на `127.0.0.1` с PKCE и сам сохранит токены — без конфигов и перезапуска.
16
16
  - **Сначала черновик.** Теги, триггеры и переменные создаются в рабочем пространстве. Публикация — отдельная явно разрушительная операция.
17
17
  - **С учётом квоты.** GTM разрешает 0,25 запроса в секунду на проект; сервер делает паузу не менее 4,2 секунды между запросами, а не перегружает API.
18
18
  - **Ваш доступ Google.** Сервер использует ваши OAuth-данные и запрашивает только scope GTM, нужные для чтения, редактирования, версий и публикации.
@@ -57,7 +57,7 @@
57
57
  Нужны Node.js 20+ и Google-аккаунт. Учётные данные при установке не нужны: сервер подключается прямо в диалоге.
58
58
 
59
59
  1. Добавьте сервер в AI-приложение.
60
- 2. Скажите «подключи Google Tag Manager» — ассистент проведёт [создание OAuth-клиента и выдачу доступа](#как-получить-доступ), не трогая конфиги.
60
+ 2. Скажите «подключи Google Tag Manager» — ассистент даст ссылку на согласие Google и [подключит аккаунт](#как-получить-доступ) — без проекта Google Cloud и без правки конфигов.
61
61
  3. Начните с запроса, который только читает данные.
62
62
 
63
63
  <details open>
@@ -69,14 +69,7 @@
69
69
 
70
70
  1. Откройте **Settings → MCP servers**.
71
71
  2. Нажмите **Add server**.
72
- 3. Выберите **STDIO**, затем укажите `npx -y mcp-google-tagmanager@latest` и три переменные окружения ниже.
73
-
74
- | Переменная | Значение |
75
- |---|---|
76
- | `GOOGLE_TAGMANAGER_CLIENT_ID` | Ваш Google OAuth client ID |
77
- | `GOOGLE_TAGMANAGER_CLIENT_SECRET` | Ваш Google OAuth client secret |
78
- | `GOOGLE_TAGMANAGER_REFRESH_TOKEN` | Ваш Google OAuth refresh token |
79
-
72
+ 3. Выберите **STDIO**, затем укажите `npx -y mcp-google-tagmanager@latest`.
80
73
  4. Нажмите **Save**, затем **Restart**.
81
74
 
82
75
  **В командной строке:**
@@ -245,12 +238,20 @@ Google Tag Manager требует OAuth 2.0: одного API-ключа нед
245
238
 
246
239
  ### Подключение из диалога (рекомендуемый путь)
247
240
 
248
- Скажите «подключи Google Tag Manager», и ассистент пройдёт флоу вместе с вами:
241
+ Скажите «подключи Google Tag Manager». У сервера есть встроенный OAuth-клиент, поэтому создавать проект Google Cloud и OAuth-клиент не нужно:
242
+
243
+ 1. `start_login` возвращает ссылку на согласие Google. Откройте её **на этой же машине** и подтвердите доступ: код возвращается на одноразовый слушатель `127.0.0.1` (PKCE), а не в чат.
244
+ 2. `finish_login` меняет код на токены и кладёт их в `~/.config/mcp-google-tagmanager/credentials.json` (права 0600) и проверяет их реальным вызовом Tag Manager API — так невключённый API ловится сразу.
245
+
246
+ Пока приложение проходит проверку Google, на шаге согласия может появиться экран **«Google hasn't verified this app»**: выберите **Advanced → Go to A1 MCP**. Встроенный клиент только называет приложение для Google — токены выдаются вашей машине и хранятся на ней, A1 их не получает.
247
+
248
+ #### Свой OAuth-клиент
249
+
250
+ Встроенный клиент и его квоту Google API делят все, кто им пользуется. Свой клиент даёт собственную квоту и нужен, если администратор Google Workspace блокирует сторонние приложения:
249
251
 
250
252
  1. `setup_instructions` выдаёт чек-лист: создать или выбрать проект Google Cloud, включить **Tag Manager API**, настроить consent screen и создать OAuth-клиент типа **Desktop app**.
251
- 2. Скачайте JSON этого клиента («Download JSON») и передайте ассистенту **путь** к файлу — `set_client` сохранит его с правами только для владельца. Секрет через переписку не проходит.
252
- 3. `start_login` возвращает ссылку на согласие Google. Откройте её **на этой же машине** и подтвердите доступ: код возвращается на одноразовый слушатель `127.0.0.1` (PKCE), а не в чат.
253
- 4. `finish_login` меняет код на токены и кладёт их в `~/.config/mcp-google-tagmanager/credentials.json` (права 0600) и проверяет их реальным вызовом Tag Manager API — так невключённый API ловится сразу.
253
+ 2. Скачайте JSON этого клиента («Download JSON») и передайте ассистенту **путь** к файлу — `set_client` сохранит его с правами только для владельца. Секрет через переписку не проходит. С этого момента он имеет приоритет над встроенным.
254
+ 3. Снова выполните `start_login` и `finish_login`.
254
255
 
255
256
  Токены перечитываются на каждый вызов, поэтому подключение действует немедленно — перезапускать AI-приложение не нужно. `auth_status` показывает состояние, `logout` отзывает токен и удаляет его.
256
257
 
@@ -286,7 +287,7 @@ Scope разделены: для чтения, редактирования, с
286
287
  | `GOOGLE_TAGMANAGER_MAX_RETRIES` | Нет | Максимум повторов при временных ошибках; по умолчанию `3`. |
287
288
  | `GOOGLE_TAGMANAGER_MIN_INTERVAL_MS` | Нет | Минимальная пауза между запросами; по умолчанию `4200` мс. |
288
289
 
289
- \* Передайте либо OAuth-тройку, либо access token. Access token истекает примерно через час и автоматически не обновляется.
290
+ \* Нужны только для установки без входа из диалога: передайте либо OAuth-тройку, либо access token. Access token истекает примерно через час и автоматически не обновляется.
290
291
 
291
292
  ## Данные и телеметрия
292
293
 
@@ -1,4 +1,4 @@
1
- import { OAuthError, registerGoogleAuth, TokenProvider, unconfiguredPrefix, USERINFO_URL, } from "@a1-x-tech/mcp-google-auth";
1
+ import { OAuthError, A1_DEFAULT_CLIENT, registerGoogleAuth, TokenProvider, unconfiguredPrefix, USERINFO_URL, } from "@a1-x-tech/mcp-google-auth";
2
2
  import { probeApi } from "../client.js";
3
3
  import { TagManagerError } from "../types.js";
4
4
  import { fail } from "./util.js";
@@ -97,6 +97,8 @@ export const AUTH_OPTIONS = {
97
97
  serverName: "tagmanager",
98
98
  envPrefix: "GOOGLE_TAGMANAGER",
99
99
  scopes: LOGIN_SCOPES,
100
+ // Built-in A1 OAuth client: login without a Google Cloud project. Env and set_client still win.
101
+ defaultClient: A1_DEFAULT_CLIENT,
100
102
  verifyIdentity,
101
103
  // Login-tool failures go through the server's own renderer, so telemetry gets their origin.
102
104
  fail,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-google-tagmanager",
3
- "version": "1.3.4",
3
+ "version": "1.4.0",
4
4
  "description": "MCP server for the Google Tag Manager API v2 — accounts, containers, workspaces, tags, triggers, variables, versions and publishing. For Claude, Cursor, Codex and other AI clients.",
5
5
  "mcpName": "io.github.A1-x-Tech/mcp-google-tagmanager",
6
6
  "type": "module",
@@ -51,7 +51,7 @@
51
51
  "url": "https://github.com/A1-x-Tech/mcp-google-tagmanager/issues"
52
52
  },
53
53
  "dependencies": {
54
- "@a1-x-tech/mcp-google-auth": "^0.1.2",
54
+ "@a1-x-tech/mcp-google-auth": "^0.1.3",
55
55
  "@modelcontextprotocol/sdk": "^1.29.0",
56
56
  "zod": "^3.25.0"
57
57
  },