mcp-google-contacts 0.1.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/LICENSE +21 -0
- package/README.md +306 -0
- package/README.ru.md +306 -0
- package/dist/client.js +561 -0
- package/dist/config.js +83 -0
- package/dist/index.js +126 -0
- package/dist/telemetry.js +120 -0
- package/dist/tools/batch.js +71 -0
- package/dist/tools/contacts.js +150 -0
- package/dist/tools/groups.js +123 -0
- package/dist/tools/other.js +62 -0
- package/dist/tools/raw.js +30 -0
- package/dist/tools/util.js +221 -0
- package/dist/types.js +48 -0
- package/package.json +60 -0
- package/test/dist-smoke.test.js +176 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 A1 x Tech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
# <img src="./assets/a1-logo.svg" alt="A1" width="40"> Google Contacts MCP
|
|
2
|
+
|
|
3
|
+
**English** | [Русский](./README.ru.md)
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/mcp-google-contacts)
|
|
6
|
+
[](https://github.com/A1-x-Tech/mcp-google-contacts/actions/workflows/ci.yml)
|
|
7
|
+
[](https://glama.ai/mcp/servers/A1-x-Tech/mcp-google-contacts)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
|
|
10
|
+
**A1 Google Contacts MCP** lets an AI app manage your Google address book in plain language. Find a contact, create or update one, organize contacts with labels, run batch imports and clean-ups, and turn auto-saved "Other contacts" into real ones.
|
|
11
|
+
|
|
12
|
+
It uses the Google People API — the API behind Google Contacts — with your Google account. It guards every update against concurrent edits, keeps reads compact with explicit field masks and makes the limits of the People API explicit instead of implying that every contacts task is possible.
|
|
13
|
+
|
|
14
|
+
- **19 tools.** List, search and read contacts, create, update and delete them one at a time or in batches, manage contact groups and membership, and reach "Other contacts".
|
|
15
|
+
- **Updates don't clobber.** Every update is etag-guarded: if a contact changed elsewhere since it was read, the write fails instead of silently overwriting the concurrent edit.
|
|
16
|
+
- **Deletes are real.** The People API has no trash; deleting a contact or group is permanent, and the server marks those tools destructive so your AI app can ask first.
|
|
17
|
+
- **Minimal Google scopes.** It uses `contacts` for read/write — `contacts.readonly` is enough for a read-only setup — plus `contacts.other.readonly` only for "Other contacts", without broad account access.
|
|
18
|
+
|
|
19
|
+
Start with a read-only question:
|
|
20
|
+
|
|
21
|
+
> Find everyone from Acme in my contacts and show their emails and phone numbers.
|
|
22
|
+
|
|
23
|
+
[Connect the server](#quick-start) · [Explore use cases](#what-you-can-ask-it-to-do) · [Open technical documentation](#technical-documentation)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## See it work in a minute
|
|
28
|
+
|
|
29
|
+
> **You:** Show my contact card for Jane Doe — email, phone and company.
|
|
30
|
+
>
|
|
31
|
+
> **Assistant:** Finds the contact and shows the requested fields. Nothing changes.
|
|
32
|
+
>
|
|
33
|
+
> **You:** Change her phone number to +1 415 555 0100 and add her to the "Clients" label.
|
|
34
|
+
>
|
|
35
|
+
> **Assistant:** Shows the contact and the proposed change, then asks for confirmation before writing.
|
|
36
|
+
>
|
|
37
|
+
> **You:** Confirm.
|
|
38
|
+
>
|
|
39
|
+
> **Assistant:** Applies the etag-guarded update and the label. If the contact changed elsewhere in the meantime, the write fails instead of overwriting it.
|
|
40
|
+
|
|
41
|
+
## Contents
|
|
42
|
+
|
|
43
|
+
- [Quick start](#quick-start)
|
|
44
|
+
- [What you can ask it to do](#what-you-can-ask-it-to-do)
|
|
45
|
+
- [How a contact changes](#how-a-contact-changes)
|
|
46
|
+
- [What can change](#what-can-change)
|
|
47
|
+
- [Getting access](#getting-access)
|
|
48
|
+
- [Configuration](#configuration)
|
|
49
|
+
- [Data, limits and background work](#data-limits-and-background-work)
|
|
50
|
+
- [Technical documentation](#technical-documentation)
|
|
51
|
+
- [Support](#support)
|
|
52
|
+
|
|
53
|
+
## Quick start
|
|
54
|
+
|
|
55
|
+
You need Node.js 20+, a Google account and OAuth credentials from a Google Cloud project with the People API enabled.
|
|
56
|
+
|
|
57
|
+
1. [Prepare Google OAuth access](#getting-access).
|
|
58
|
+
2. Add the server to your AI app.
|
|
59
|
+
3. Ask the read-only question above.
|
|
60
|
+
|
|
61
|
+
<details open>
|
|
62
|
+
<summary><strong>Codex</strong></summary>
|
|
63
|
+
|
|
64
|
+
<br>
|
|
65
|
+
|
|
66
|
+
**In the app:** open **Settings → Plugins → MCP servers**, select **Add server**, then add `npx -y mcp-google-contacts@latest` with `GOOGLE_CONTACTS_CLIENT_ID`, `GOOGLE_CONTACTS_CLIENT_SECRET` and `GOOGLE_CONTACTS_REFRESH_TOKEN`.
|
|
67
|
+
|
|
68
|
+
**From the command line:**
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
codex mcp add google-contacts \
|
|
72
|
+
--env GOOGLE_CONTACTS_CLIENT_ID=your_client_id \
|
|
73
|
+
--env GOOGLE_CONTACTS_CLIENT_SECRET=your_client_secret \
|
|
74
|
+
--env GOOGLE_CONTACTS_REFRESH_TOKEN=your_refresh_token \
|
|
75
|
+
-- npx -y mcp-google-contacts@latest
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
codex mcp list
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
[Codex MCP documentation](https://learn.chatgpt.com/docs/extend/mcp?surface=cli)
|
|
83
|
+
|
|
84
|
+
</details>
|
|
85
|
+
|
|
86
|
+
<details>
|
|
87
|
+
<summary><strong>Claude Code</strong></summary>
|
|
88
|
+
|
|
89
|
+
<br>
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
claude mcp add \
|
|
93
|
+
--env GOOGLE_CONTACTS_CLIENT_ID=your_client_id \
|
|
94
|
+
--env GOOGLE_CONTACTS_CLIENT_SECRET=your_client_secret \
|
|
95
|
+
--env GOOGLE_CONTACTS_REFRESH_TOKEN=your_refresh_token \
|
|
96
|
+
--transport stdio --scope user google-contacts \
|
|
97
|
+
-- npx -y mcp-google-contacts@latest
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
claude mcp list
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
[Claude Code MCP documentation](https://code.claude.com/docs/en/mcp)
|
|
105
|
+
|
|
106
|
+
</details>
|
|
107
|
+
|
|
108
|
+
<details>
|
|
109
|
+
<summary><strong>Claude Desktop</strong></summary>
|
|
110
|
+
|
|
111
|
+
<br>
|
|
112
|
+
|
|
113
|
+
Open **Settings → Developer → Edit Config** and add:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"mcpServers": {
|
|
118
|
+
"google-contacts": {
|
|
119
|
+
"command": "npx",
|
|
120
|
+
"args": ["-y", "mcp-google-contacts@latest"],
|
|
121
|
+
"env": {
|
|
122
|
+
"GOOGLE_CONTACTS_CLIENT_ID": "your_client_id",
|
|
123
|
+
"GOOGLE_CONTACTS_CLIENT_SECRET": "your_client_secret",
|
|
124
|
+
"GOOGLE_CONTACTS_REFRESH_TOKEN": "your_refresh_token"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
If **Edit Config** is unavailable, edit `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS or `%APPDATA%\Claude\claude_desktop_config.json` on Windows.
|
|
132
|
+
|
|
133
|
+
[Claude Desktop MCP documentation](https://support.claude.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop)
|
|
134
|
+
|
|
135
|
+
</details>
|
|
136
|
+
|
|
137
|
+
<details>
|
|
138
|
+
<summary><strong>Cursor</strong></summary>
|
|
139
|
+
|
|
140
|
+
<br>
|
|
141
|
+
|
|
142
|
+
Add this to `~/.cursor/mcp.json` on macOS/Linux or `%USERPROFILE%\.cursor\mcp.json` on Windows:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"google-contacts": {
|
|
148
|
+
"type": "stdio",
|
|
149
|
+
"command": "npx",
|
|
150
|
+
"args": ["-y", "mcp-google-contacts@latest"],
|
|
151
|
+
"env": {
|
|
152
|
+
"GOOGLE_CONTACTS_CLIENT_ID": "your_client_id",
|
|
153
|
+
"GOOGLE_CONTACTS_CLIENT_SECRET": "your_client_secret",
|
|
154
|
+
"GOOGLE_CONTACTS_REFRESH_TOKEN": "your_refresh_token"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
[Cursor MCP documentation](https://cursor.com/docs/mcp)
|
|
162
|
+
|
|
163
|
+
</details>
|
|
164
|
+
|
|
165
|
+
<details>
|
|
166
|
+
<summary><strong>VS Code</strong></summary>
|
|
167
|
+
|
|
168
|
+
<br>
|
|
169
|
+
|
|
170
|
+
Run **MCP: Open User Configuration** and add:
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"servers": {
|
|
175
|
+
"google-contacts": {
|
|
176
|
+
"type": "stdio",
|
|
177
|
+
"command": "npx",
|
|
178
|
+
"args": ["-y", "mcp-google-contacts@latest"],
|
|
179
|
+
"env": {
|
|
180
|
+
"GOOGLE_CONTACTS_CLIENT_ID": "${input:contacts_client_id}",
|
|
181
|
+
"GOOGLE_CONTACTS_CLIENT_SECRET": "${input:contacts_client_secret}",
|
|
182
|
+
"GOOGLE_CONTACTS_REFRESH_TOKEN": "${input:contacts_refresh_token}"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"inputs": [
|
|
187
|
+
{ "type": "promptString", "id": "contacts_client_id", "description": "Google OAuth client ID" },
|
|
188
|
+
{ "type": "promptString", "id": "contacts_client_secret", "description": "Google OAuth client secret", "password": true },
|
|
189
|
+
{ "type": "promptString", "id": "contacts_refresh_token", "description": "Google OAuth refresh token", "password": true }
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Check it with **MCP: List Servers**.
|
|
195
|
+
|
|
196
|
+
[VS Code MCP documentation](https://code.visualstudio.com/docs/agent-customization/mcp-servers)
|
|
197
|
+
|
|
198
|
+
</details>
|
|
199
|
+
|
|
200
|
+
## What you can ask it to do
|
|
201
|
+
|
|
202
|
+
### Find and inspect contacts
|
|
203
|
+
|
|
204
|
+
- Find everyone from Acme and show their emails and phone numbers.
|
|
205
|
+
- Show who is in the "Clients" label.
|
|
206
|
+
- List the contacts that changed since the last sync.
|
|
207
|
+
|
|
208
|
+
### Keep the address book up to date
|
|
209
|
+
|
|
210
|
+
- Create a contact for Jane Doe with her email, phone and company.
|
|
211
|
+
- Update a contact's phone number or job title.
|
|
212
|
+
- Import fifty people in one batch, or delete outdated contacts in one call.
|
|
213
|
+
|
|
214
|
+
### Organize with labels
|
|
215
|
+
|
|
216
|
+
- Create a "Clients" label and add these contacts to it.
|
|
217
|
+
- Rename a label, or move a contact from one label to another.
|
|
218
|
+
- Delete a label without deleting its contacts — or with them, but only when asked explicitly.
|
|
219
|
+
|
|
220
|
+
### Work with "Other contacts"
|
|
221
|
+
|
|
222
|
+
- Show the addresses Google saved automatically that are not in my contacts.
|
|
223
|
+
- Copy one of them into My Contacts as a real contact.
|
|
224
|
+
|
|
225
|
+
## How a contact changes
|
|
226
|
+
|
|
227
|
+
1. Every contact, group and Other contact has a full **resource name** (`people/c...`, `contactGroups/...`, `otherContacts/...`); tools address records by it, exactly as the API returns it.
|
|
228
|
+
2. Reads return only the fields named in the **field mask** (default: names, emails, phones, organizations, group memberships). An absent field may simply be outside the mask, not empty.
|
|
229
|
+
3. An update **replaces** each provided field group as a whole and is guarded by an **etag**: if the contact changed elsewhere since it was read, the write fails instead of overwriting the concurrent edit.
|
|
230
|
+
4. Deletes are permanent. The People API has no trash and no undo.
|
|
231
|
+
|
|
232
|
+
Search covers a cache that can lag recent writes by a few seconds and returns at most 30 results. "Other contacts" — addresses Google saves automatically — can only be read or copied into My Contacts, not edited in place. Contact photos have no dedicated tool; `raw_request` reaches those endpoints.
|
|
233
|
+
|
|
234
|
+
## What can change
|
|
235
|
+
|
|
236
|
+
| Operation | What happens | Confirmation boundary |
|
|
237
|
+
|---|---|---|
|
|
238
|
+
| Read, search or batch-read contacts and groups | Reads contact data | No change |
|
|
239
|
+
| Create a contact, a group or a batch of contacts | Adds records | Changes Google Contacts |
|
|
240
|
+
| Update a contact or rename a group | Replaces the provided field groups, etag-guarded | Changes a contact |
|
|
241
|
+
| Change label membership | Adds or removes a label on chosen contacts | Changes contacts |
|
|
242
|
+
| Copy an Other contact | Adds a real contact to My Contacts | Changes Google Contacts |
|
|
243
|
+
| Delete a contact, a group or a batch | Removes records permanently; deleting a group deletes its member contacts only when explicitly requested | Destructive |
|
|
244
|
+
| Raw API request | Can call API methods without a dedicated tool | Potentially destructive |
|
|
245
|
+
|
|
246
|
+
The AI client controls confirmation prompts. The server marks reads, writes and destructive tools so the client can distinguish an inspection from a live change.
|
|
247
|
+
|
|
248
|
+
## Getting access
|
|
249
|
+
|
|
250
|
+
Google Contacts requires OAuth 2.0; an API key is not enough.
|
|
251
|
+
|
|
252
|
+
1. Create or select a Google Cloud project and enable **People API**.
|
|
253
|
+
2. Configure the OAuth consent screen and create a **Desktop app** OAuth client.
|
|
254
|
+
3. Authorize the Google account whose contacts you want to manage. The [OAuth 2.0 Playground](https://developers.google.com/oauthplayground) can obtain the refresh token when **Use your own OAuth credentials** is enabled.
|
|
255
|
+
4. Request the minimal scopes for what you use:
|
|
256
|
+
|
|
257
|
+
```text
|
|
258
|
+
https://www.googleapis.com/auth/contacts
|
|
259
|
+
https://www.googleapis.com/auth/contacts.other.readonly
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
`contacts` covers reading and writing contacts and groups; for a read-only setup `contacts.readonly` alone is enough. `contacts.other.readonly` is needed only by the "Other contacts" tools. A `403` on a single tool usually means the refresh token was minted without the scope that tool needs — re-consent with the missing scope added.
|
|
263
|
+
|
|
264
|
+
Testing-mode OAuth refresh tokens can expire after seven days. Publish the OAuth app, or use an Internal app in a Workspace domain, when you need long-lived access. Treat the client secret and refresh token as passwords.
|
|
265
|
+
|
|
266
|
+
## Configuration
|
|
267
|
+
|
|
268
|
+
| Variable | Required | Description |
|
|
269
|
+
|---|---|---|
|
|
270
|
+
| `GOOGLE_CONTACTS_CLIENT_ID` | Yes* | OAuth client ID. |
|
|
271
|
+
| `GOOGLE_CONTACTS_CLIENT_SECRET` | Yes* | OAuth client secret. |
|
|
272
|
+
| `GOOGLE_CONTACTS_REFRESH_TOKEN` | Yes* | OAuth refresh token. |
|
|
273
|
+
| `GOOGLE_CONTACTS_ACCESS_TOKEN` | Yes* | Short-lived alternative to the OAuth trio (~1 h). |
|
|
274
|
+
| `GOOGLE_CONTACTS_API_BASE` | No | Google People API base URL override. |
|
|
275
|
+
| `GOOGLE_CONTACTS_TIMEOUT_MS` | No | Per-request timeout; default `60000` ms. |
|
|
276
|
+
| `GOOGLE_CONTACTS_MAX_RETRIES` | No | Temporary-error retries; default `3`. |
|
|
277
|
+
|
|
278
|
+
\* 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.
|
|
279
|
+
|
|
280
|
+
## Data, limits and background work
|
|
281
|
+
|
|
282
|
+
- **Requests go to Google.** The local server refreshes Google OAuth tokens and calls the People API at `people.googleapis.com`. Its anonymous telemetry contains an installation ID, package version, AI client and platform versions, and tool names — never OAuth tokens, contact data, tool arguments or prompts. Set `ASKADS_TELEMETRY=0` to opt out.
|
|
283
|
+
- **Google quotas are per-user and low.** The default People API quota allows roughly 90 reads and 90 writes per user per minute, so the batch tools beat loops of single calls; mutating batches must run one at a time. On `429` the server backs off and retries; reads also retry after network and `5xx` errors, while writes are not replayed after an uncertain failure.
|
|
284
|
+
- **There is no background polling.** The server runs only when called. `list_contacts` supports sync tokens, so an AI app with scheduled tasks can periodically fetch only what changed; a sync token expires after about seven days, after which a full re-list is needed.
|
|
285
|
+
|
|
286
|
+
## Technical documentation
|
|
287
|
+
|
|
288
|
+
- [MCP capability catalog](./docs/capabilities/index.md) — task-oriented pages for every tool.
|
|
289
|
+
- [All tools and inputs](./docs/TOOLS.md)
|
|
290
|
+
- [Development documentation](./docs/DEVELOPMENT.md)
|
|
291
|
+
- [Publishing documentation](./docs/PUBLISHING.md)
|
|
292
|
+
- [Google People API reference](https://developers.google.com/people)
|
|
293
|
+
|
|
294
|
+
## Support
|
|
295
|
+
|
|
296
|
+
Found a bug or need a scenario? [Create an issue](https://github.com/A1-x-Tech/mcp-google-contacts/issues) or write in [Telegram](https://t.me/a1_mcp).
|
|
297
|
+
|
|
298
|
+
<br>
|
|
299
|
+
|
|
300
|
+
<p align="center">
|
|
301
|
+
<img src="https://github.com/ztemerbekov/a1-yandex-kit-skills/raw/main/assets/images/mona-hifive-yandex-kit-warm.gif" alt="Две Моны дают пять" width="256">
|
|
302
|
+
</p>
|
|
303
|
+
|
|
304
|
+
<p align="center">
|
|
305
|
+
You made it to the end!
|
|
306
|
+
</p>
|
package/README.ru.md
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
# <img src="./assets/a1-logo.svg" alt="A1" width="40"> Google Contacts MCP
|
|
2
|
+
|
|
3
|
+
[English](./README.md) | **Русский**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/mcp-google-contacts)
|
|
6
|
+
[](https://github.com/A1-x-Tech/mcp-google-contacts/actions/workflows/ci.yml)
|
|
7
|
+
[](https://glama.ai/mcp/servers/A1-x-Tech/mcp-google-contacts)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
|
|
10
|
+
**A1 Google Contacts MCP** позволяет AI-приложению управлять вашей адресной книгой Google на естественном языке. Можно найти контакт, создать или обновить его, разложить контакты по ярлыкам, выполнить пакетный импорт и чистку и превратить автосохранённые «Другие контакты» в настоящие.
|
|
11
|
+
|
|
12
|
+
Сервер работает с Google People API — API, на котором построены Google Контакты, — через ваш Google-аккаунт. Он защищает каждое обновление от параллельных правок, делает чтение компактным за счёт явных масок полей и явно показывает ограничения People API, а не создаёт впечатление, что с контактами можно сделать всё.
|
|
13
|
+
|
|
14
|
+
- **19 инструментов.** Список, поиск и чтение контактов, создание, обновление и удаление по одному или пакетами, управление группами контактов и их составом, доступ к «Другим контактам».
|
|
15
|
+
- **Обновления не затирают чужие правки.** Каждое обновление защищено etag: если контакт изменился где-то ещё после чтения, запись завершится ошибкой, а не молча перезапишет параллельную правку.
|
|
16
|
+
- **Удаление — настоящее.** В People API нет корзины; удаление контакта или группы необратимо, и сервер помечает эти инструменты как разрушительные, чтобы AI-приложение спросило заранее.
|
|
17
|
+
- **Минимальные scope Google.** Используется `contacts` для чтения и записи — для read-only-установки достаточно `contacts.readonly` — плюс `contacts.other.readonly` только для «Других контактов», без широкого доступа к аккаунту.
|
|
18
|
+
|
|
19
|
+
Начните с запроса, который только читает данные:
|
|
20
|
+
|
|
21
|
+
> Найди в моих контактах всех из Acme и покажи их email и телефоны.
|
|
22
|
+
|
|
23
|
+
[Подключить сервер](#быстрый-старт) · [Посмотреть сценарии](#что-можно-поручить) · [Открыть техническую документацию](#техническая-документация)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Увидеть работу за минуту
|
|
28
|
+
|
|
29
|
+
> **Вы:** Покажи карточку контакта Jane Doe — email, телефон и компанию.
|
|
30
|
+
>
|
|
31
|
+
> **Ассистент:** Находит контакт и показывает запрошенные поля. Ничего не меняется.
|
|
32
|
+
>
|
|
33
|
+
> **Вы:** Поменяй её телефон на +1 415 555 0100 и добавь её в ярлык «Клиенты».
|
|
34
|
+
>
|
|
35
|
+
> **Ассистент:** Показывает контакт и предлагаемое изменение, затем запрашивает подтверждение перед записью.
|
|
36
|
+
>
|
|
37
|
+
> **Вы:** Подтверждаю.
|
|
38
|
+
>
|
|
39
|
+
> **Ассистент:** Применяет обновление под защитой etag и добавляет ярлык. Если контакт за это время изменился где-то ещё, запись завершится ошибкой, а не перезапишет правку.
|
|
40
|
+
|
|
41
|
+
## Содержание
|
|
42
|
+
|
|
43
|
+
- [Быстрый старт](#быстрый-старт)
|
|
44
|
+
- [Что можно поручить](#что-можно-поручить)
|
|
45
|
+
- [Как меняется контакт](#как-меняется-контакт)
|
|
46
|
+
- [Что может измениться](#что-может-измениться)
|
|
47
|
+
- [Как получить доступ](#как-получить-доступ)
|
|
48
|
+
- [Конфигурация](#конфигурация)
|
|
49
|
+
- [Данные, лимиты и работа в фоне](#данные-лимиты-и-работа-в-фоне)
|
|
50
|
+
- [Техническая документация](#техническая-документация)
|
|
51
|
+
- [Поддержка](#поддержка)
|
|
52
|
+
|
|
53
|
+
## Быстрый старт
|
|
54
|
+
|
|
55
|
+
Нужны Node.js 20+, Google-аккаунт и OAuth-данные из проекта Google Cloud с включённым People API.
|
|
56
|
+
|
|
57
|
+
1. [Подготовьте Google OAuth-доступ](#как-получить-доступ).
|
|
58
|
+
2. Добавьте сервер в AI-приложение.
|
|
59
|
+
3. Отправьте запрос, который только читает данные.
|
|
60
|
+
|
|
61
|
+
<details open>
|
|
62
|
+
<summary><strong>Codex</strong></summary>
|
|
63
|
+
|
|
64
|
+
<br>
|
|
65
|
+
|
|
66
|
+
**В приложении:** откройте **Settings → Plugins → MCP servers**, нажмите **Add server**, затем добавьте `npx -y mcp-google-contacts@latest` с `GOOGLE_CONTACTS_CLIENT_ID`, `GOOGLE_CONTACTS_CLIENT_SECRET` и `GOOGLE_CONTACTS_REFRESH_TOKEN`.
|
|
67
|
+
|
|
68
|
+
**В командной строке:**
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
codex mcp add google-contacts \
|
|
72
|
+
--env GOOGLE_CONTACTS_CLIENT_ID=your_client_id \
|
|
73
|
+
--env GOOGLE_CONTACTS_CLIENT_SECRET=your_client_secret \
|
|
74
|
+
--env GOOGLE_CONTACTS_REFRESH_TOKEN=your_refresh_token \
|
|
75
|
+
-- npx -y mcp-google-contacts@latest
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
codex mcp list
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
[Документация Codex MCP](https://learn.chatgpt.com/docs/extend/mcp?surface=cli)
|
|
83
|
+
|
|
84
|
+
</details>
|
|
85
|
+
|
|
86
|
+
<details>
|
|
87
|
+
<summary><strong>Claude Code</strong></summary>
|
|
88
|
+
|
|
89
|
+
<br>
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
claude mcp add \
|
|
93
|
+
--env GOOGLE_CONTACTS_CLIENT_ID=your_client_id \
|
|
94
|
+
--env GOOGLE_CONTACTS_CLIENT_SECRET=your_client_secret \
|
|
95
|
+
--env GOOGLE_CONTACTS_REFRESH_TOKEN=your_refresh_token \
|
|
96
|
+
--transport stdio --scope user google-contacts \
|
|
97
|
+
-- npx -y mcp-google-contacts@latest
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
claude mcp list
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
[Документация Claude Code MCP](https://code.claude.com/docs/en/mcp)
|
|
105
|
+
|
|
106
|
+
</details>
|
|
107
|
+
|
|
108
|
+
<details>
|
|
109
|
+
<summary><strong>Claude Desktop</strong></summary>
|
|
110
|
+
|
|
111
|
+
<br>
|
|
112
|
+
|
|
113
|
+
Откройте **Settings → Developer → Edit Config** и добавьте:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"mcpServers": {
|
|
118
|
+
"google-contacts": {
|
|
119
|
+
"command": "npx",
|
|
120
|
+
"args": ["-y", "mcp-google-contacts@latest"],
|
|
121
|
+
"env": {
|
|
122
|
+
"GOOGLE_CONTACTS_CLIENT_ID": "your_client_id",
|
|
123
|
+
"GOOGLE_CONTACTS_CLIENT_SECRET": "your_client_secret",
|
|
124
|
+
"GOOGLE_CONTACTS_REFRESH_TOKEN": "your_refresh_token"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Если **Edit Config** недоступна, отредактируйте `~/Library/Application Support/Claude/claude_desktop_config.json` на macOS или `%APPDATA%\Claude\claude_desktop_config.json` на Windows.
|
|
132
|
+
|
|
133
|
+
[Документация Claude Desktop MCP](https://support.claude.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop)
|
|
134
|
+
|
|
135
|
+
</details>
|
|
136
|
+
|
|
137
|
+
<details>
|
|
138
|
+
<summary><strong>Cursor</strong></summary>
|
|
139
|
+
|
|
140
|
+
<br>
|
|
141
|
+
|
|
142
|
+
Добавьте в `~/.cursor/mcp.json` на macOS/Linux или `%USERPROFILE%\.cursor\mcp.json` на Windows:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"google-contacts": {
|
|
148
|
+
"type": "stdio",
|
|
149
|
+
"command": "npx",
|
|
150
|
+
"args": ["-y", "mcp-google-contacts@latest"],
|
|
151
|
+
"env": {
|
|
152
|
+
"GOOGLE_CONTACTS_CLIENT_ID": "your_client_id",
|
|
153
|
+
"GOOGLE_CONTACTS_CLIENT_SECRET": "your_client_secret",
|
|
154
|
+
"GOOGLE_CONTACTS_REFRESH_TOKEN": "your_refresh_token"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
[Документация Cursor MCP](https://cursor.com/docs/mcp)
|
|
162
|
+
|
|
163
|
+
</details>
|
|
164
|
+
|
|
165
|
+
<details>
|
|
166
|
+
<summary><strong>VS Code</strong></summary>
|
|
167
|
+
|
|
168
|
+
<br>
|
|
169
|
+
|
|
170
|
+
Запустите **MCP: Open User Configuration** и добавьте:
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"servers": {
|
|
175
|
+
"google-contacts": {
|
|
176
|
+
"type": "stdio",
|
|
177
|
+
"command": "npx",
|
|
178
|
+
"args": ["-y", "mcp-google-contacts@latest"],
|
|
179
|
+
"env": {
|
|
180
|
+
"GOOGLE_CONTACTS_CLIENT_ID": "${input:contacts_client_id}",
|
|
181
|
+
"GOOGLE_CONTACTS_CLIENT_SECRET": "${input:contacts_client_secret}",
|
|
182
|
+
"GOOGLE_CONTACTS_REFRESH_TOKEN": "${input:contacts_refresh_token}"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"inputs": [
|
|
187
|
+
{ "type": "promptString", "id": "contacts_client_id", "description": "Google OAuth client ID" },
|
|
188
|
+
{ "type": "promptString", "id": "contacts_client_secret", "description": "Google OAuth client secret", "password": true },
|
|
189
|
+
{ "type": "promptString", "id": "contacts_refresh_token", "description": "Google OAuth refresh token", "password": true }
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Проверьте сервер командой **MCP: List Servers**.
|
|
195
|
+
|
|
196
|
+
[Документация VS Code MCP](https://code.visualstudio.com/docs/agent-customization/mcp-servers)
|
|
197
|
+
|
|
198
|
+
</details>
|
|
199
|
+
|
|
200
|
+
## Что можно поручить
|
|
201
|
+
|
|
202
|
+
### Найти и посмотреть контакты
|
|
203
|
+
|
|
204
|
+
- Найди всех из Acme и покажи их email и телефоны.
|
|
205
|
+
- Покажи, кто входит в ярлык «Клиенты».
|
|
206
|
+
- Выведи контакты, изменившиеся с прошлой синхронизации.
|
|
207
|
+
|
|
208
|
+
### Поддерживать адресную книгу в порядке
|
|
209
|
+
|
|
210
|
+
- Создай контакт Jane Doe с email, телефоном и компанией.
|
|
211
|
+
- Обнови телефон или должность контакта.
|
|
212
|
+
- Импортируй пятьдесят человек одним пакетом или удали устаревшие контакты одним вызовом.
|
|
213
|
+
|
|
214
|
+
### Наводить порядок с ярлыками
|
|
215
|
+
|
|
216
|
+
- Создай ярлык «Клиенты» и добавь в него эти контакты.
|
|
217
|
+
- Переименуй ярлык или перенеси контакт из одного ярлыка в другой.
|
|
218
|
+
- Удали ярлык, не удаляя его контакты, — или вместе с ними, но только по явной просьбе.
|
|
219
|
+
|
|
220
|
+
### Работать с «Другими контактами»
|
|
221
|
+
|
|
222
|
+
- Покажи адреса, которые Google сохранил автоматически, но которых нет в моих контактах.
|
|
223
|
+
- Скопируй один из них в «Мои контакты» как настоящий контакт.
|
|
224
|
+
|
|
225
|
+
## Как меняется контакт
|
|
226
|
+
|
|
227
|
+
1. У каждого контакта, группы и «другого контакта» есть полное **имя ресурса** (`people/c...`, `contactGroups/...`, `otherContacts/...`); инструменты адресуют записи по нему, ровно в том виде, в каком его возвращает API.
|
|
228
|
+
2. Чтение возвращает только поля из **маски полей** (по умолчанию: имена, email, телефоны, организации, членство в группах). Отсутствующее поле может быть просто вне маски, а не пустым.
|
|
229
|
+
3. Обновление **заменяет** каждую переданную группу полей целиком и защищено **etag**: если контакт изменился где-то ещё после чтения, запись завершится ошибкой, а не перезапишет параллельную правку.
|
|
230
|
+
4. Удаление необратимо. В People API нет корзины и отмены.
|
|
231
|
+
|
|
232
|
+
Поиск работает по кэшу, который может отставать от свежих записей на несколько секунд, и возвращает не более 30 результатов. «Другие контакты» — адреса, которые Google сохраняет автоматически, — можно только читать или копировать в «Мои контакты», но не редактировать на месте. Для фотографий контактов отдельного инструмента нет; до этих эндпоинтов достаёт `raw_request`.
|
|
233
|
+
|
|
234
|
+
## Что может измениться
|
|
235
|
+
|
|
236
|
+
| Операция | Что происходит | Граница подтверждения |
|
|
237
|
+
|---|---|---|
|
|
238
|
+
| Чтение, поиск или пакетное чтение контактов и групп | Читает данные контактов | Ничего не меняет |
|
|
239
|
+
| Создание контакта, группы или пакета контактов | Добавляет записи | Меняет Google Контакты |
|
|
240
|
+
| Обновление контакта или переименование группы | Заменяет переданные группы полей, под защитой etag | Меняет контакт |
|
|
241
|
+
| Изменение состава ярлыка | Добавляет или снимает ярлык у выбранных контактов | Меняет контакты |
|
|
242
|
+
| Копирование «другого контакта» | Добавляет настоящий контакт в «Мои контакты» | Меняет Google Контакты |
|
|
243
|
+
| Удаление контакта, группы или пакета | Удаляет записи безвозвратно; удаление группы удаляет её контакты только по явному запросу | Разрушительно |
|
|
244
|
+
| Технический запрос API | Может вызвать метод API без отдельного инструмента | Потенциально разрушительно |
|
|
245
|
+
|
|
246
|
+
Как AI-приложение просит подтверждение, определяет само приложение. Сервер помечает операции чтения, записи и удаления, чтобы оно отличило проверку от рабочего изменения.
|
|
247
|
+
|
|
248
|
+
## Как получить доступ
|
|
249
|
+
|
|
250
|
+
Google Контакты требуют OAuth 2.0: одного API-ключа недостаточно.
|
|
251
|
+
|
|
252
|
+
1. Создайте или выберите проект Google Cloud и включите **People API**.
|
|
253
|
+
2. Настройте OAuth consent screen и создайте OAuth-клиент типа **Desktop app**.
|
|
254
|
+
3. Авторизуйте Google-аккаунт, контактами которого хотите управлять. [OAuth 2.0 Playground](https://developers.google.com/oauthplayground) поможет получить refresh token, если включить **Use your own OAuth credentials**.
|
|
255
|
+
4. Запросите минимальные scope под свои задачи:
|
|
256
|
+
|
|
257
|
+
```text
|
|
258
|
+
https://www.googleapis.com/auth/contacts
|
|
259
|
+
https://www.googleapis.com/auth/contacts.other.readonly
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
`contacts` покрывает чтение и запись контактов и групп; для read-only-установки достаточно одного `contacts.readonly`. `contacts.other.readonly` нужен только инструментам «Других контактов». Ошибка `403` на одном инструменте обычно означает, что refresh token выпущен без нужного этому инструменту scope, — пройдите авторизацию заново, добавив недостающий scope.
|
|
263
|
+
|
|
264
|
+
Refresh token OAuth-приложения в режиме Testing может истечь через семь дней. Для долгого доступа опубликуйте OAuth-приложение или используйте Internal-приложение в домене Workspace. Храните client secret и refresh token как пароли.
|
|
265
|
+
|
|
266
|
+
## Конфигурация
|
|
267
|
+
|
|
268
|
+
| Переменная | Обязательна | Описание |
|
|
269
|
+
|---|---|---|
|
|
270
|
+
| `GOOGLE_CONTACTS_CLIENT_ID` | Да* | OAuth client ID. |
|
|
271
|
+
| `GOOGLE_CONTACTS_CLIENT_SECRET` | Да* | OAuth client secret. |
|
|
272
|
+
| `GOOGLE_CONTACTS_REFRESH_TOKEN` | Да* | OAuth refresh token. |
|
|
273
|
+
| `GOOGLE_CONTACTS_ACCESS_TOKEN` | Да* | Короткоживущая альтернатива OAuth-тройке (~1 ч). |
|
|
274
|
+
| `GOOGLE_CONTACTS_API_BASE` | Нет | Переопределяет базовый URL Google People API. |
|
|
275
|
+
| `GOOGLE_CONTACTS_TIMEOUT_MS` | Нет | Тайм-аут одного запроса; по умолчанию `60000` мс. |
|
|
276
|
+
| `GOOGLE_CONTACTS_MAX_RETRIES` | Нет | Повторы временных ошибок; по умолчанию `3`. |
|
|
277
|
+
|
|
278
|
+
\* Передайте OAuth-тройку или access token. Совсем без учётных данных сервер всё равно стартует и завершает MCP-handshake; первый же вызов инструмента назовёт, какие именно переменные задать.
|
|
279
|
+
|
|
280
|
+
## Данные, лимиты и работа в фоне
|
|
281
|
+
|
|
282
|
+
- **Запросы идут в Google.** Локальный сервер обновляет OAuth-токены Google и вызывает People API на `people.googleapis.com`. Анонимная телеметрия содержит ID установки, версию пакета, версии AI-клиента и платформы и имена инструментов — но не OAuth-токены, данные контактов, аргументы или промпты. Чтобы отключить её, задайте `ASKADS_TELEMETRY=0`.
|
|
283
|
+
- **Квоты Google — на пользователя и небольшие.** Квота People API по умолчанию даёт примерно 90 чтений и 90 записей на пользователя в минуту, поэтому пакетные инструменты выгоднее циклов одиночных вызовов; изменяющие пакеты нужно выполнять по одному. При `429` сервер делает паузу и повторяет; чтение также повторяется после сетевых и `5xx` ошибок, а запись после неопределённой ошибки не повторяется.
|
|
284
|
+
- **Постоянного опроса нет.** Сервер работает только при вызове. `list_contacts` поддерживает sync-токены, поэтому AI-приложение с заданиями по расписанию может периодически забирать только изменения; sync-токен истекает примерно через семь дней, после чего нужно заново получить полный список.
|
|
285
|
+
|
|
286
|
+
## Техническая документация
|
|
287
|
+
|
|
288
|
+
- [Каталог MCP-возможностей](./docs/capabilities/index.md) — страницы по пользовательским задачам для каждого инструмента.
|
|
289
|
+
- [Все инструменты и параметры](./docs/TOOLS.md)
|
|
290
|
+
- [Документация по разработке](./docs/DEVELOPMENT.md)
|
|
291
|
+
- [Документация по публикации](./docs/PUBLISHING.md)
|
|
292
|
+
- [Справочник Google People API](https://developers.google.com/people)
|
|
293
|
+
|
|
294
|
+
## Поддержка
|
|
295
|
+
|
|
296
|
+
Нашли ошибку или не хватает сценария? [Создайте issue](https://github.com/A1-x-Tech/mcp-google-contacts/issues) или напишите в [Telegram](https://t.me/a1_mcp).
|
|
297
|
+
|
|
298
|
+
<br>
|
|
299
|
+
|
|
300
|
+
<p align="center">
|
|
301
|
+
<img src="https://github.com/ztemerbekov/a1-yandex-kit-skills/raw/main/assets/images/mona-hifive-yandex-kit-warm.gif" alt="Две Моны дают пять" width="256">
|
|
302
|
+
</p>
|
|
303
|
+
|
|
304
|
+
<p align="center">
|
|
305
|
+
Вы дочитали до конца!
|
|
306
|
+
</p>
|