mcp-google-forms 1.3.1 → 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
@@ -56,7 +56,7 @@ Start with a read-only question:
56
56
  You need Node.js 20+ and a Google account. Credentials are not required at install time — the server connects from the conversation.
57
57
 
58
58
  1. Add the server to your AI app.
59
- 2. Say "connect Google Forms": the assistant walks you through [creating the OAuth client and approving access](#getting-access) without editing config files.
59
+ 2. Say "connect Google Forms": the assistant gives you a Google sign-in link — [no Google Cloud project or OAuth client to create](#getting-access).
60
60
  3. Ask the read-only question above.
61
61
 
62
62
  <details open>
@@ -64,7 +64,7 @@ You need Node.js 20+ and a Google account. Credentials are not required at insta
64
64
 
65
65
  <br>
66
66
 
67
- **In the app:** open **Settings → MCP servers**, select **Add server**, choose **STDIO**, enter the command `npx -y mcp-google-forms@latest` and environment variables `GOOGLE_FORMS_CLIENT_ID`, `GOOGLE_FORMS_CLIENT_SECRET`, `GOOGLE_FORMS_REFRESH_TOKEN`, then select **Save** and **Restart**.
67
+ **In the app:** open **Settings → MCP servers**, select **Add server**, choose **STDIO**, enter the command `npx -y mcp-google-forms@latest`, then select **Save** and **Restart**.
68
68
 
69
69
  **From the command line:**
70
70
 
@@ -224,12 +224,20 @@ Google Forms requires OAuth 2.0; an API key is not enough. There are two ways in
224
224
 
225
225
  ### Connect from the chat (recommended)
226
226
 
227
- Say "connect Google Forms" and the assistant runs the flow with you:
227
+ Say "connect Google Forms". The server ships with a built-in OAuth client, so there is no Google Cloud project or OAuth client to create:
228
+
229
+ 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.
230
+ 2. `finish_login` exchanges the code and saves the tokens to `~/.config/mcp-google-forms/credentials.json` (mode 0600).
231
+
232
+ 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.
233
+
234
+ #### Use your own OAuth client
235
+
236
+ 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:
228
237
 
229
238
  1. `setup_instructions` prints the checklist: create or select a Google Cloud project, enable **Google Forms API**, configure the consent screen and create a **Desktop app** OAuth client.
230
- 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.
231
- 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.
232
- 4. `finish_login` exchanges the code and saves the tokens to `~/.config/mcp-google-forms/credentials.json` (mode 0600).
239
+ 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.
240
+ 3. Run `start_login` and `finish_login` again.
233
241
 
234
242
  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.
235
243
 
@@ -262,7 +270,7 @@ Every variable is optional — with none of them the server connects [from the c
262
270
  | `GOOGLE_FORMS_TIMEOUT_MS` | No | Per-request timeout; default `60000` ms. |
263
271
  | `GOOGLE_FORMS_MAX_RETRIES` | No | Temporary-error retries; default `3`. |
264
272
 
265
- \* Provide either the OAuth trio or an access token.
273
+ \* Only for a setup without the in-chat login: provide either the OAuth trio or an access token.
266
274
 
267
275
  ## Data, limits and background work
268
276
 
package/README.ru.md CHANGED
@@ -12,7 +12,7 @@
12
12
  Сервер работает с Google Forms API через ваш Google-аккаунт. Он отличает черновую форму от опубликованной и явно показывает ограничения API, а не создаёт впечатление, что через форму можно сделать всё.
13
13
 
14
14
  - **19 инструментов.** Проверка структуры формы и ответов, создание и редактирование форм и вопросов, управление публикацией и Pub/Sub watches.
15
- - **Подключение из диалога.** Скажите «подключи Google Формы»: сервер проведёт через создание OAuth-клиента, поймает редирект Google на `127.0.0.1` с PKCE и сам сохранит токены — без конфигов и перезапуска.
15
+ - **Подключение из диалога.** Скажите «подключи Google Формы»: встроенный OAuth-клиент уже есть — сервер даст ссылку на согласие Google, поймает редирект Google на `127.0.0.1` с PKCE и сам сохранит токены — без конфигов и перезапуска.
16
16
  - **Осознанная публикация.** Формы, созданные через API, по умолчанию не опубликованы и не принимают ответы, пока вы их не опубликуете.
17
17
  - **Ответы сохраняются как есть.** API умеет читать ответы, но не создавать и не редактировать их; инструмента отправки ответов у сервера нет.
18
18
  - **Минимальные scope Google.** Используются `forms.body` и `forms.responses.readonly` без широкого доступа к Drive.
@@ -56,7 +56,7 @@
56
56
  Нужны Node.js 20+ и Google-аккаунт. Учётные данные при установке не нужны: сервер подключается прямо в диалоге.
57
57
 
58
58
  1. Добавьте сервер в AI-приложение.
59
- 2. Скажите «подключи Google Формы» — ассистент проведёт [создание OAuth-клиента и выдачу доступа](#как-получить-доступ), не трогая конфиги.
59
+ 2. Скажите «подключи Google Формы» — ассистент даст ссылку на согласие Google и [подключит аккаунт](#как-получить-доступ) — без проекта Google Cloud и без правки конфигов.
60
60
  3. Отправьте запрос, который только читает данные.
61
61
 
62
62
  <details open>
@@ -64,7 +64,7 @@
64
64
 
65
65
  <br>
66
66
 
67
- **В приложении:** откройте **Settings → MCP servers**, нажмите **Add server**, выберите **STDIO**, укажите команду `npx -y mcp-google-forms@latest` и переменные окружения `GOOGLE_FORMS_CLIENT_ID`, `GOOGLE_FORMS_CLIENT_SECRET`, `GOOGLE_FORMS_REFRESH_TOKEN`, затем нажмите **Save**, потом **Restart**.
67
+ **В приложении:** откройте **Settings → MCP servers**, нажмите **Add server**, выберите **STDIO**, укажите команду `npx -y mcp-google-forms@latest`, затем нажмите **Save**, потом **Restart**.
68
68
 
69
69
  **В командной строке:**
70
70
 
@@ -224,12 +224,20 @@ Google Forms требует OAuth 2.0: одного API-ключа недост
224
224
 
225
225
  ### Подключение из диалога (рекомендуемый путь)
226
226
 
227
- Скажите «подключи Google Формы», и ассистент пройдёт флоу вместе с вами:
227
+ Скажите «подключи Google Формы». У сервера есть встроенный OAuth-клиент, поэтому создавать проект Google Cloud и OAuth-клиент не нужно:
228
+
229
+ 1. `start_login` возвращает ссылку на согласие Google. Откройте её **на этой же машине** и подтвердите доступ: код возвращается на одноразовый слушатель `127.0.0.1` (PKCE), а не в чат.
230
+ 2. `finish_login` меняет код на токены и кладёт их в `~/.config/mcp-google-forms/credentials.json` (права 0600).
231
+
232
+ Пока приложение проходит проверку Google, на шаге согласия может появиться экран **«Google hasn't verified this app»**: выберите **Advanced → Go to A1 MCP**. Встроенный клиент только называет приложение для Google — токены выдаются вашей машине и хранятся на ней, A1 их не получает.
233
+
234
+ #### Свой OAuth-клиент
235
+
236
+ Встроенный клиент и его квоту Google API делят все, кто им пользуется. Свой клиент даёт собственную квоту и нужен, если администратор Google Workspace блокирует сторонние приложения:
228
237
 
229
238
  1. `setup_instructions` выдаёт чек-лист: создать или выбрать проект Google Cloud, включить **Google Forms API**, настроить consent screen и создать OAuth-клиент типа **Desktop app**.
230
- 2. Скачайте JSON этого клиента («Download JSON») и передайте ассистенту **путь** к файлу — `set_client` сохранит его с правами только для владельца. Секрет через переписку не проходит.
231
- 3. `start_login` возвращает ссылку на согласие Google. Откройте её **на этой же машине** и подтвердите доступ: код возвращается на одноразовый слушатель `127.0.0.1` (PKCE), а не в чат.
232
- 4. `finish_login` меняет код на токены и кладёт их в `~/.config/mcp-google-forms/credentials.json` (права 0600).
239
+ 2. Скачайте JSON этого клиента («Download JSON») и передайте ассистенту **путь** к файлу — `set_client` сохранит его с правами только для владельца. Секрет через переписку не проходит. С этого момента он имеет приоритет над встроенным.
240
+ 3. Снова выполните `start_login` и `finish_login`.
233
241
 
234
242
  Токены перечитываются на каждый вызов, поэтому подключение действует немедленно — перезапускать AI-приложение не нужно. `auth_status` показывает состояние, `logout` отзывает токен и удаляет его.
235
243
 
@@ -262,7 +270,7 @@ Refresh token OAuth-приложения в режиме Testing может ис
262
270
  | `GOOGLE_FORMS_TIMEOUT_MS` | Нет | Тайм-аут одного запроса; по умолчанию `60000` мс. |
263
271
  | `GOOGLE_FORMS_MAX_RETRIES` | Нет | Повторы временных ошибок; по умолчанию `3`. |
264
272
 
265
- \* Передайте OAuth-тройку или access token.
273
+ \* Нужны только для установки без входа из диалога: передайте OAuth-тройку или access token.
266
274
 
267
275
  ## Данные, лимиты и работа в фоне
268
276
 
package/dist/telemetry.js CHANGED
@@ -135,10 +135,10 @@ const OUTCOME_PATTERNS = [
135
135
  ["error_timeout", /timed?[ _-]?out|таймаут|ETIMEDOUT|AbortError|не был готов|not ready/i],
136
136
  ["error_network", /ECONNRESET|ECONNREFUSED|ENOTFOUND|EAI_AGAIN|EPIPE|fetch failed|socket hang up/i],
137
137
  ["error_rate_limit", /\b429\b|rate[ _-]?limit|too many requests|quota|квот|лимит|\[(?:56|152|506|9000)\]/i],
138
- ["error_permission", /нет доступа к кабинету|не подключ[её]н к аккаунту/i],
138
+ ["error_permission", /нет доступа к кабинету|не подключ[её]н к аккаунту|accessNotConfigured|SERVICE_DISABLED/i],
139
139
  [
140
140
  "error_auth",
141
- /\b401\b|unauthori[sz]ed|unauthenticated|invalid[ _-]?(?:token|grant|credentials)|token (?:expired|revoked)|login required|AuthRequired|авториз|не подключ|\[53\]/i,
141
+ /\b401\b|unauthori[sz]ed|unauthenticated|invalid[ _-]?(?:token|grant|credentials)|token (?:expired|revoked)|login required|AuthRequired|OAuthError|авториз|не подключ|\[53\]/i,
142
142
  ],
143
143
  ["error_permission", /\b403\b|forbidden|access[ _-]?denied|permission|insufficient[ _-]?scope|нет доступа|\[(?:54|3228)\]/i],
144
144
  ["error_not_found", /\b404\b|not[ _-]?found|не найден|не существует|\[8800\]/i],
@@ -248,6 +248,10 @@ function jsBug(err) {
248
248
  function errorText(err) {
249
249
  if (!(err instanceof Error) || "errno" in err || "syscall" in err)
250
250
  return undefined;
251
+ // OAuthError's code is a fixed OAuth/Google vocabulary (invalid_grant, accessNotConfigured), not user data.
252
+ const code = err.code;
253
+ if (err.name === "OAuthError" && typeof code === "string" && /^[A-Za-z_]{2,40}$/.test(code))
254
+ return `OAuthError ${code}`;
251
255
  return /^[A-Z][A-Za-z0-9]*(?:Error|Exception)$/.test(err.name) && err.name !== "Error" ? err.name : undefined;
252
256
  }
253
257
  /**
@@ -1,4 +1,5 @@
1
- import { registerGoogleAuth, TokenProvider, unconfiguredPrefix, } from "@a1-x-tech/mcp-google-auth";
1
+ import { A1_DEFAULT_CLIENT, registerGoogleAuth, TokenProvider, unconfiguredPrefix, } from "@a1-x-tech/mcp-google-auth";
2
+ import { fail } from "./util.js";
2
3
  /**
3
4
  * The scopes an in-chat login requests (the per-task table lives in
4
5
  * docs/TOOLS.md). The component always adds the identity scopes on top.
@@ -18,6 +19,10 @@ export const AUTH_OPTIONS = {
18
19
  serverName: "forms",
19
20
  envPrefix: "GOOGLE_FORMS",
20
21
  scopes: LOGIN_SCOPES,
22
+ // Built-in A1 OAuth client: login without a Google Cloud project. Env and set_client still win.
23
+ defaultClient: A1_DEFAULT_CLIENT,
24
+ // Login-tool failures go through the server's own renderer, so telemetry gets their origin.
25
+ fail,
21
26
  };
22
27
  /**
23
28
  * Registers the six onboarding tools (auth_status, setup_instructions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-google-forms",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "MCP server for the Google Forms API — create forms, manage questions, publish, read responses and watch for new submissions. For Claude, Cursor, Codex and other AI clients.",
5
5
  "mcpName": "io.github.A1-x-Tech/mcp-google-forms",
6
6
  "type": "module",
@@ -49,7 +49,7 @@
49
49
  "url": "https://github.com/A1-x-Tech/mcp-google-forms/issues"
50
50
  },
51
51
  "dependencies": {
52
- "@a1-x-tech/mcp-google-auth": "^0.1.0",
52
+ "@a1-x-tech/mcp-google-auth": "^0.1.3",
53
53
  "@modelcontextprotocol/sdk": "^1.29.0",
54
54
  "zod": "^3.25.0"
55
55
  },