mcp-google-contacts 1.1.1 → 1.2.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 +15 -7
- package/README.ru.md +16 -8
- package/dist/telemetry.js +6 -2
- package/dist/tools/auth.js +6 -1
- package/package.json +2 -2
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 Contacts": the assistant
|
|
59
|
+
2. Say "connect Google Contacts": 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-contacts@latest
|
|
67
|
+
**In the app:** open **Settings → MCP servers**, select **Add server**, choose **STDIO**, enter the command `npx -y mcp-google-contacts@latest`, then select **Save** and **Restart**.
|
|
68
68
|
|
|
69
69
|
**From the command line:**
|
|
70
70
|
|
|
@@ -228,12 +228,20 @@ Google Contacts requires OAuth 2.0; an API key is not enough. There are two ways
|
|
|
228
228
|
|
|
229
229
|
### Connect from the chat (recommended)
|
|
230
230
|
|
|
231
|
-
Say "connect Google Contacts"
|
|
231
|
+
Say "connect Google Contacts". The server ships with a built-in OAuth client, so there is no Google Cloud project or OAuth client to create:
|
|
232
|
+
|
|
233
|
+
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.
|
|
234
|
+
2. `finish_login` exchanges the code, saves the tokens to `~/.config/mcp-google-contacts/credentials.json` (mode 0600) and verifies them with a real Google People API call — so an API that is still switched off is caught right there.
|
|
235
|
+
|
|
236
|
+
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.
|
|
237
|
+
|
|
238
|
+
#### Use your own OAuth client
|
|
239
|
+
|
|
240
|
+
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:
|
|
232
241
|
|
|
233
242
|
1. `setup_instructions` prints the checklist: create or select a Google Cloud project, enable **Google People API**, configure the consent screen and create a **Desktop app** OAuth client.
|
|
234
|
-
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.
|
|
235
|
-
3. `start_login`
|
|
236
|
-
4. `finish_login` exchanges the code and saves the tokens to `~/.config/mcp-google-contacts/credentials.json` (mode 0600) and verifies them with a real Google People API call — so an API that is still switched off is caught right there.
|
|
243
|
+
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.
|
|
244
|
+
3. Run `start_login` and `finish_login` again.
|
|
237
245
|
|
|
238
246
|
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.
|
|
239
247
|
|
|
@@ -268,7 +276,7 @@ Every variable is optional — with none of them the server connects [from the c
|
|
|
268
276
|
| `GOOGLE_CONTACTS_TIMEOUT_MS` | No | Per-request timeout; default `60000` ms. |
|
|
269
277
|
| `GOOGLE_CONTACTS_MAX_RETRIES` | No | Temporary-error retries; default `3`. |
|
|
270
278
|
|
|
271
|
-
\*
|
|
279
|
+
\* Only for a setup without the in-chat login: provide either the OAuth trio or an access token. With no credentials at all the server still starts and completes the MCP handshake; the first tool call then names the exact variables to set.
|
|
272
280
|
|
|
273
281
|
## Data, limits and background work
|
|
274
282
|
|
package/README.ru.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
Сервер работает с Google People API — API, на котором построены Google Контакты, — через ваш Google-аккаунт. Он защищает каждое обновление от параллельных правок, делает чтение компактным за счёт явных масок полей и явно показывает ограничения People API, а не создаёт впечатление, что с контактами можно сделать всё.
|
|
13
13
|
|
|
14
14
|
- **25 инструментов.** Список, поиск и чтение контактов, создание, обновление и удаление по одному или пакетами, управление группами контактов и их составом, доступ к «Другим контактам».
|
|
15
|
-
- **Подключение из диалога.** Скажите «подключи Google Контакты»: сервер
|
|
15
|
+
- **Подключение из диалога.** Скажите «подключи Google Контакты»: встроенный OAuth-клиент уже есть — сервер даст ссылку на согласие Google, поймает редирект Google на `127.0.0.1` с PKCE и сам сохранит токены — без конфигов и перезапуска.
|
|
16
16
|
- **Обновления не затирают чужие правки.** Каждое обновление защищено etag: если контакт изменился где-то ещё после чтения, запись завершится ошибкой, а не молча перезапишет параллельную правку.
|
|
17
17
|
- **Удаление — настоящее.** В People API нет корзины; удаление контакта или группы необратимо, и сервер помечает эти инструменты как разрушительные, чтобы AI-приложение спросило заранее.
|
|
18
18
|
- **Минимальные scope Google.** Используется `contacts` для чтения и записи — для read-only-установки достаточно `contacts.readonly` — плюс `contacts.other.readonly` только для «Других контактов», без широкого доступа к аккаунту.
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
Нужны Node.js 20+ и Google-аккаунт. Учётные данные при установке не нужны: сервер подключается прямо в диалоге.
|
|
57
57
|
|
|
58
58
|
1. Добавьте сервер в AI-приложение.
|
|
59
|
-
2. Скажите «подключи Google Контакты» — ассистент
|
|
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-contacts@latest
|
|
67
|
+
**В приложении:** откройте **Settings → MCP servers**, нажмите **Add server**, выберите **STDIO**, укажите команду `npx -y mcp-google-contacts@latest`, затем нажмите **Save**, потом **Restart**.
|
|
68
68
|
|
|
69
69
|
**В командной строке:**
|
|
70
70
|
|
|
@@ -228,12 +228,20 @@ Google Contacts требует OAuth 2.0: одного API-ключа недос
|
|
|
228
228
|
|
|
229
229
|
### Подключение из диалога (рекомендуемый путь)
|
|
230
230
|
|
|
231
|
-
Скажите «подключи Google
|
|
231
|
+
Скажите «подключи Google Контакты». У сервера есть встроенный OAuth-клиент, поэтому создавать проект Google Cloud и OAuth-клиент не нужно:
|
|
232
|
+
|
|
233
|
+
1. `start_login` возвращает ссылку на согласие Google. Откройте её **на этой же машине** и подтвердите доступ: код возвращается на одноразовый слушатель `127.0.0.1` (PKCE), а не в чат.
|
|
234
|
+
2. `finish_login` меняет код на токены и кладёт их в `~/.config/mcp-google-contacts/credentials.json` (права 0600) и проверяет их реальным вызовом Google People API — так невключённый API ловится сразу.
|
|
235
|
+
|
|
236
|
+
Пока приложение проходит проверку Google, на шаге согласия может появиться экран **«Google hasn't verified this app»**: выберите **Advanced → Go to A1 MCP**. Встроенный клиент только называет приложение для Google — токены выдаются вашей машине и хранятся на ней, A1 их не получает.
|
|
237
|
+
|
|
238
|
+
#### Свой OAuth-клиент
|
|
239
|
+
|
|
240
|
+
Встроенный клиент и его квоту Google API делят все, кто им пользуется. Свой клиент даёт собственную квоту и нужен, если администратор Google Workspace блокирует сторонние приложения:
|
|
232
241
|
|
|
233
242
|
1. `setup_instructions` выдаёт чек-лист: создать или выбрать проект Google Cloud, включить **Google People API**, настроить consent screen и создать OAuth-клиент типа **Desktop app**.
|
|
234
|
-
2. Скачайте JSON этого клиента («Download JSON») и передайте ассистенту **путь** к файлу — `set_client` сохранит его с правами только для владельца. Секрет через переписку не проходит.
|
|
235
|
-
3. `start_login`
|
|
236
|
-
4. `finish_login` меняет код на токены и кладёт их в `~/.config/mcp-google-contacts/credentials.json` (права 0600) и проверяет их реальным вызовом Google People API — так невключённый API ловится сразу.
|
|
243
|
+
2. Скачайте JSON этого клиента («Download JSON») и передайте ассистенту **путь** к файлу — `set_client` сохранит его с правами только для владельца. Секрет через переписку не проходит. С этого момента он имеет приоритет над встроенным.
|
|
244
|
+
3. Снова выполните `start_login` и `finish_login`.
|
|
237
245
|
|
|
238
246
|
Токены перечитываются на каждый вызов, поэтому подключение действует немедленно — перезапускать AI-приложение не нужно. `auth_status` показывает состояние, `logout` отзывает токен и удаляет его.
|
|
239
247
|
|
|
@@ -268,7 +276,7 @@ Refresh token OAuth-приложения в режиме Testing может ис
|
|
|
268
276
|
| `GOOGLE_CONTACTS_TIMEOUT_MS` | Нет | Тайм-аут одного запроса; по умолчанию `60000` мс. |
|
|
269
277
|
| `GOOGLE_CONTACTS_MAX_RETRIES` | Нет | Повторы временных ошибок; по умолчанию `3`. |
|
|
270
278
|
|
|
271
|
-
\*
|
|
279
|
+
\* Нужны только для установки без входа из диалога: передайте OAuth-тройку или access token. Совсем без учётных данных сервер всё равно стартует и завершает MCP-handshake; первый же вызов инструмента назовёт, какие именно переменные задать.
|
|
272
280
|
|
|
273
281
|
## Данные, лимиты и работа в фоне
|
|
274
282
|
|
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", /нет доступа к кабинету|не подключ[её]н к
|
|
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
|
/**
|
package/dist/tools/auth.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 { GoogleContactsError } from "../types.js";
|
|
4
|
+
import { fail } from "./util.js";
|
|
4
5
|
/**
|
|
5
6
|
* The scopes an in-chat login requests (the per-task table lives in
|
|
6
7
|
* docs/TOOLS.md). The component always adds the identity scopes on top.
|
|
@@ -92,7 +93,11 @@ export const AUTH_OPTIONS = {
|
|
|
92
93
|
serverName: "contacts",
|
|
93
94
|
envPrefix: "GOOGLE_CONTACTS",
|
|
94
95
|
scopes: LOGIN_SCOPES,
|
|
96
|
+
// Built-in A1 OAuth client: login without a Google Cloud project. Env and set_client still win.
|
|
97
|
+
defaultClient: A1_DEFAULT_CLIENT,
|
|
95
98
|
verifyIdentity,
|
|
99
|
+
// Login-tool failures go through the server's own renderer, so telemetry gets their origin.
|
|
100
|
+
fail,
|
|
96
101
|
};
|
|
97
102
|
/**
|
|
98
103
|
* Registers the six onboarding tools (auth_status, setup_instructions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-google-contacts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "MCP server for Google Contacts (People API) — search, read, create, update and delete contacts, manage contact groups and run batch operations. For Claude, Cursor, Codex and other AI clients.",
|
|
5
5
|
"mcpName": "io.github.A1-x-Tech/mcp-google-contacts",
|
|
6
6
|
"type": "module",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"url": "https://github.com/A1-x-Tech/mcp-google-contacts/issues"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@a1-x-tech/mcp-google-auth": "^0.1.
|
|
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
|
},
|