@a1-x-tech/mcp-google-sheets 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 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,307 @@
1
+ # <img src="./assets/a1-logo.svg" alt="A1" width="40"> Google Sheets MCP
2
+
3
+ **English** | [Русский](./README.ru.md)
4
+
5
+ [![npm](https://img.shields.io/npm/v/%40a1-x-tech%2Fmcp-google-sheets)](https://www.npmjs.com/package/@a1-x-tech/mcp-google-sheets)
6
+ [![CI](https://github.com/A1-x-Tech/mcp-google-sheets/actions/workflows/ci.yml/badge.svg)](https://github.com/A1-x-Tech/mcp-google-sheets/actions/workflows/ci.yml)
7
+ [![Glama](https://glama.ai/mcp/servers/A1-x-Tech/mcp-google-sheets/badges/score.svg)](https://glama.ai/mcp/servers/A1-x-Tech/mcp-google-sheets)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
9
+
10
+ **A1 Google Sheets MCP** lets an AI app work with Google Sheets in plain language. Find a spreadsheet, read its data, write and append rows, shape sheets and formatting, build charts and share the result.
11
+
12
+ It uses the Google Sheets API with your Google account. It separates reading from writing, keeps destructive operations explicit and makes the limits of the Sheets API clear instead of implying that every spreadsheet task is possible.
13
+
14
+ - **20 tools.** Search and create spreadsheets, read and write ranges, manage sheets, formatting, data validation, protected ranges, conditional formats, structured tables, charts and access.
15
+ - **Writes are deliberate.** A write is never replayed after an ambiguous failure — a replayed append would duplicate rows — and destructive tools are marked so your AI client can ask first.
16
+ - **Sheets only.** Drive is an internal dependency for spreadsheet search and sharing alone; there is no generic Drive tool, and `raw_request` cannot reach Drive.
17
+ - **Minimal Google scopes.** `spreadsheets` covers every Sheets tool; a Drive scope is needed only for spreadsheet search and sharing.
18
+
19
+ Start with a read-only question:
20
+
21
+ > Find the quarterly budget spreadsheet and summarize what each of its sheets contains.
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 me the structure of the sales report spreadsheet — its sheets, their sizes and frozen rows.
30
+ >
31
+ > **Assistant:** Shows the sheets with their sizes, frozen headers and the objects on them. Nothing changes.
32
+ >
33
+ > **You:** Prepare a “March” sheet as a copy of “February” and clear the numbers, keeping the layout.
34
+ >
35
+ > **Assistant:** Shows the plan — duplicate the sheet, rename it and clear the data ranges — then asks for confirmation before changing anything.
36
+ >
37
+ > **You:** Confirm.
38
+ >
39
+ > **Assistant:** Duplicates the sheet and clears the values. Formatting, data validation and frozen rows stay.
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 spreadsheet changes](#how-a-spreadsheet-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 Google Sheets 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 @a1-x-tech/mcp-google-sheets@latest` with `GOOGLE_SHEETS_CLIENT_ID`, `GOOGLE_SHEETS_CLIENT_SECRET` and `GOOGLE_SHEETS_REFRESH_TOKEN`.
67
+
68
+ **From the command line:**
69
+
70
+ ```bash
71
+ codex mcp add google-sheets \
72
+ --env GOOGLE_SHEETS_CLIENT_ID=your_client_id \
73
+ --env GOOGLE_SHEETS_CLIENT_SECRET=your_client_secret \
74
+ --env GOOGLE_SHEETS_REFRESH_TOKEN=your_refresh_token \
75
+ -- npx -y @a1-x-tech/mcp-google-sheets@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_SHEETS_CLIENT_ID=your_client_id \
94
+ --env GOOGLE_SHEETS_CLIENT_SECRET=your_client_secret \
95
+ --env GOOGLE_SHEETS_REFRESH_TOKEN=your_refresh_token \
96
+ --transport stdio --scope user google-sheets \
97
+ -- npx -y @a1-x-tech/mcp-google-sheets@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-sheets": {
119
+ "command": "npx",
120
+ "args": ["-y", "@a1-x-tech/mcp-google-sheets@latest"],
121
+ "env": {
122
+ "GOOGLE_SHEETS_CLIENT_ID": "your_client_id",
123
+ "GOOGLE_SHEETS_CLIENT_SECRET": "your_client_secret",
124
+ "GOOGLE_SHEETS_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-sheets": {
148
+ "type": "stdio",
149
+ "command": "npx",
150
+ "args": ["-y", "@a1-x-tech/mcp-google-sheets@latest"],
151
+ "env": {
152
+ "GOOGLE_SHEETS_CLIENT_ID": "your_client_id",
153
+ "GOOGLE_SHEETS_CLIENT_SECRET": "your_client_secret",
154
+ "GOOGLE_SHEETS_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-sheets": {
176
+ "type": "stdio",
177
+ "command": "npx",
178
+ "args": ["-y", "@a1-x-tech/mcp-google-sheets@latest"],
179
+ "env": {
180
+ "GOOGLE_SHEETS_CLIENT_ID": "${input:sheets_client_id}",
181
+ "GOOGLE_SHEETS_CLIENT_SECRET": "${input:sheets_client_secret}",
182
+ "GOOGLE_SHEETS_REFRESH_TOKEN": "${input:sheets_refresh_token}"
183
+ }
184
+ }
185
+ },
186
+ "inputs": [
187
+ { "type": "promptString", "id": "sheets_client_id", "description": "Google OAuth client ID" },
188
+ { "type": "promptString", "id": "sheets_client_secret", "description": "Google OAuth client secret", "password": true },
189
+ { "type": "promptString", "id": "sheets_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 read data
203
+
204
+ - Find the newest spreadsheet with “budget” in the name and show its structure.
205
+ - Read `'Q3'!A1:F50` and summarize the totals.
206
+ - Show the formulas behind the Summary sheet.
207
+
208
+ ### Update the numbers
209
+
210
+ - Write this table into `Sheet1!A1`, formulas included.
211
+ - Append today’s figures as a new row of the log.
212
+ - Update several ranges in one batch, or clear a draft range while keeping its formatting.
213
+
214
+ ### Shape and present
215
+
216
+ - Add a “March” sheet, freeze the header row and make it bold.
217
+ - Highlight negative amounts in red with a conditional format and add borders.
218
+ - Build a column chart of revenue by month on its own sheet.
219
+ - Turn the data into a structured table and add a dropdown with data validation.
220
+
221
+ ### Protect and share
222
+
223
+ - Protect the totals row so only I can edit it.
224
+ - Give a colleague edit access and everyone else read-only.
225
+ - Show who currently has access to the file.
226
+
227
+ ## How a spreadsheet changes
228
+
229
+ 1. Values tools address cells in **A1 notation** (`'Sheet name'!A1:C10`); structural tools (sheets, formatting, rules, tables, charts) address a numeric **sheetId** with 0-based indexes. `get_spreadsheet` supplies the ids — sheet titles are not addresses.
230
+ 2. A write **overwrites** its range; `append_values` adds rows after the last data row; a `null` cell is skipped, not cleared.
231
+ 3. `clear_values` empties values and formulas but keeps formatting, data validation, notes and merges. There is no undo through the API — deleting a sheet, rows or columns destroys their data.
232
+ 4. Batch tools carry several ranges or requests in one call and count once against the quota; a `batchUpdate` is atomic — all of its requests apply or none do.
233
+
234
+ Some spreadsheet features have no dedicated tool: merged cells, named ranges, banding, filters, slicers, find-and-replace and gradient conditional-format rules go through `raw_request`, which is limited to the Sheets API origin. A new spreadsheet lands in the My Drive root — moving it into a folder is not covered, and `manage_permissions` cannot transfer ownership.
235
+
236
+ ## What can change
237
+
238
+ | Operation | What happens | Confirmation boundary |
239
+ |---|---|---|
240
+ | Read metadata or values | Reads structure and cells | No change |
241
+ | Create a spreadsheet | Adds a file to My Drive | Changes Google Sheets |
242
+ | Write, batch-write or append values | Overwrites cells or adds rows | Changes a spreadsheet |
243
+ | Format, freeze, borders, dimensions, validation, rules, tables, charts | Changes presentation, structure and rules | Changes a spreadsheet |
244
+ | Clear values or delete a sheet, rows or columns | Removes data with no undo through the API | Destructive |
245
+ | Manage protected ranges and permissions | Changes who can open or edit the file | Changes access |
246
+ | Raw API request | Can call API methods without a dedicated tool | Potentially destructive |
247
+
248
+ 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.
249
+
250
+ ## Getting access
251
+
252
+ Google Sheets requires OAuth 2.0 to edit spreadsheets; an API key is not enough.
253
+
254
+ 1. Create or select a Google Cloud project and enable the **Google Sheets API**. Also enable the **Google Drive API** if you want spreadsheet search and sharing.
255
+ 2. Configure the OAuth consent screen and create a **Desktop app** OAuth client.
256
+ 3. Authorize the Google account that owns or can edit the spreadsheets. The [OAuth 2.0 Playground](https://developers.google.com/oauthplayground) can obtain the refresh token when **Use your own OAuth credentials** is enabled.
257
+ 4. Request the minimal scope:
258
+
259
+ ```text
260
+ https://www.googleapis.com/auth/spreadsheets
261
+ ```
262
+
263
+ It covers every Sheets tool. Only `search_spreadsheets` and `manage_permissions` need a Drive scope on top: `https://www.googleapis.com/auth/drive`, or `drive.readonly` for search alone, or `drive.file` for files created through this app.
264
+
265
+ 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.
266
+
267
+ ## Configuration
268
+
269
+ | Variable | Required | Description |
270
+ |---|---|---|
271
+ | `GOOGLE_SHEETS_CLIENT_ID` | Yes* | OAuth client ID. |
272
+ | `GOOGLE_SHEETS_CLIENT_SECRET` | Yes* | OAuth client secret. |
273
+ | `GOOGLE_SHEETS_REFRESH_TOKEN` | Yes* | OAuth refresh token. |
274
+ | `GOOGLE_SHEETS_ACCESS_TOKEN` | Yes* | Short-lived (~1 h) alternative to the OAuth trio. |
275
+ | `GOOGLE_SHEETS_API_BASE` | No | Google Sheets API base URL override. |
276
+ | `GOOGLE_SHEETS_TIMEOUT_MS` | No | Per-request timeout; default `60000` ms. |
277
+ | `GOOGLE_SHEETS_MAX_RETRIES` | No | Temporary-error retries; default `3`. |
278
+
279
+ \* Provide either the OAuth trio or an access token. Without credentials the server still starts and lists its tools; the first call names the variables to set.
280
+
281
+ ## Data, limits and background work
282
+
283
+ - **Requests go to Google.** The local server refreshes Google OAuth tokens and calls the Sheets API — and, for spreadsheet search and sharing only, the Drive API. Its anonymous telemetry contains an installation ID, package version, AI client and platform versions, and tool names — never OAuth tokens, spreadsheet data, tool arguments or prompts. Set `ASKADS_TELEMETRY=0` to opt out.
284
+ - **Google applies per-minute quotas.** The documented limits are 300 reads and 300 writes per minute per project, and 60 of each per user; a batch call counts once however many ranges or requests it carries. A spreadsheet holds at most 10,000,000 cells. On `429`, the server uses backoff; reads also retry after network and `5xx` errors, while writes are not replayed after an uncertain failure.
285
+ - **There is no background polling.** The server runs only when called. If your AI app supports scheduled tasks, it can check a spreadsheet periodically.
286
+
287
+ ## Technical documentation
288
+
289
+ - [MCP capability catalog](./docs/capabilities/index.md) — task-oriented pages for every tool.
290
+ - [All tools and inputs](./docs/TOOLS.md)
291
+ - [Development documentation](./docs/DEVELOPMENT.md)
292
+ - [Publishing documentation](./docs/PUBLISHING.md)
293
+ - [Google Sheets API reference](https://developers.google.com/sheets/api)
294
+
295
+ ## Support
296
+
297
+ Found a bug or need a scenario? [Create an issue](https://github.com/A1-x-Tech/mcp-google-sheets/issues) or write in [Telegram](https://t.me/a1_mcp).
298
+
299
+ <br>
300
+
301
+ <p align="center">
302
+ <img src="https://github.com/ztemerbekov/a1-yandex-kit-skills/raw/main/assets/images/mona-hifive-yandex-kit-warm.gif" alt="Две Моны дают пять" width="256">
303
+ </p>
304
+
305
+ <p align="center">
306
+ You made it to the end!
307
+ </p>
package/README.ru.md ADDED
@@ -0,0 +1,307 @@
1
+ # <img src="./assets/a1-logo.svg" alt="A1" width="40"> Google Sheets MCP
2
+
3
+ [English](./README.md) | **Русский**
4
+
5
+ [![npm](https://img.shields.io/npm/v/%40a1-x-tech%2Fmcp-google-sheets)](https://www.npmjs.com/package/@a1-x-tech/mcp-google-sheets)
6
+ [![CI](https://github.com/A1-x-Tech/mcp-google-sheets/actions/workflows/ci.yml/badge.svg)](https://github.com/A1-x-Tech/mcp-google-sheets/actions/workflows/ci.yml)
7
+ [![Glama](https://glama.ai/mcp/servers/A1-x-Tech/mcp-google-sheets/badges/score.svg)](https://glama.ai/mcp/servers/A1-x-Tech/mcp-google-sheets)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
9
+
10
+ **A1 Google Sheets MCP** позволяет AI-приложению работать с Google Sheets на естественном языке. Можно найти таблицу, прочитать данные, записать и дописать строки, настроить листы и форматирование, построить диаграммы и поделиться результатом.
11
+
12
+ Сервер работает с Google Sheets API через ваш Google-аккаунт. Он разделяет чтение и запись, явно помечает разрушительные операции и честно показывает ограничения Sheets API, а не создаёт впечатление, что с таблицей можно сделать всё.
13
+
14
+ - **20 инструментов.** Поиск и создание таблиц, чтение и запись диапазонов, управление листами, форматированием, проверкой данных, защищёнными диапазонами, условным форматированием, структурированными таблицами, диаграммами и доступом.
15
+ - **Осознанная запись.** Запись никогда не повторяется после неопределённой ошибки — повтор `append` продублировал бы строки, — а разрушительные инструменты помечены, чтобы AI-клиент мог сначала спросить.
16
+ - **Только Sheets.** Drive — внутренняя зависимость лишь для поиска таблиц и управления доступом; отдельного Drive-инструмента нет, и `raw_request` до Drive не дотягивается.
17
+ - **Минимальные scope Google.** `spreadsheets` покрывает каждый Sheets-инструмент; scope Drive нужен только для поиска таблиц и управления доступом.
18
+
19
+ Начните с запроса, который только читает данные:
20
+
21
+ > Найди таблицу с квартальным бюджетом и кратко расскажи, что на каждом её листе.
22
+
23
+ [Подключить сервер](#быстрый-старт) · [Посмотреть сценарии](#что-можно-поручить) · [Открыть техническую документацию](#техническая-документация)
24
+
25
+ ---
26
+
27
+ ## Увидеть работу за минуту
28
+
29
+ > **Вы:** Покажи структуру таблицы с отчётом о продажах: листы, их размеры и закреплённые строки.
30
+ >
31
+ > **Ассистент:** Показывает листы, их размеры, закреплённые заголовки и объекты на них. Ничего не меняется.
32
+ >
33
+ > **Вы:** Подготовь лист «Март» как копию «Февраля» и очисти цифры, сохранив оформление.
34
+ >
35
+ > **Ассистент:** Показывает план — продублировать лист, переименовать его и очистить диапазоны с данными — и запрашивает подтверждение перед любым изменением.
36
+ >
37
+ > **Вы:** Подтверждаю.
38
+ >
39
+ > **Ассистент:** Дублирует лист и очищает значения. Форматирование, проверка данных и закреплённые строки остаются.
40
+
41
+ ## Содержание
42
+
43
+ - [Быстрый старт](#быстрый-старт)
44
+ - [Что можно поручить](#что-можно-поручить)
45
+ - [Как меняется таблица](#как-меняется-таблица)
46
+ - [Что может измениться](#что-может-измениться)
47
+ - [Как получить доступ](#как-получить-доступ)
48
+ - [Конфигурация](#конфигурация)
49
+ - [Данные, лимиты и работа в фоне](#данные-лимиты-и-работа-в-фоне)
50
+ - [Техническая документация](#техническая-документация)
51
+ - [Поддержка](#поддержка)
52
+
53
+ ## Быстрый старт
54
+
55
+ Нужны Node.js 20+, Google-аккаунт и OAuth-данные из проекта Google Cloud с включённым Google Sheets 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 @a1-x-tech/mcp-google-sheets@latest` с `GOOGLE_SHEETS_CLIENT_ID`, `GOOGLE_SHEETS_CLIENT_SECRET` и `GOOGLE_SHEETS_REFRESH_TOKEN`.
67
+
68
+ **В командной строке:**
69
+
70
+ ```bash
71
+ codex mcp add google-sheets \
72
+ --env GOOGLE_SHEETS_CLIENT_ID=your_client_id \
73
+ --env GOOGLE_SHEETS_CLIENT_SECRET=your_client_secret \
74
+ --env GOOGLE_SHEETS_REFRESH_TOKEN=your_refresh_token \
75
+ -- npx -y @a1-x-tech/mcp-google-sheets@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_SHEETS_CLIENT_ID=your_client_id \
94
+ --env GOOGLE_SHEETS_CLIENT_SECRET=your_client_secret \
95
+ --env GOOGLE_SHEETS_REFRESH_TOKEN=your_refresh_token \
96
+ --transport stdio --scope user google-sheets \
97
+ -- npx -y @a1-x-tech/mcp-google-sheets@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-sheets": {
119
+ "command": "npx",
120
+ "args": ["-y", "@a1-x-tech/mcp-google-sheets@latest"],
121
+ "env": {
122
+ "GOOGLE_SHEETS_CLIENT_ID": "your_client_id",
123
+ "GOOGLE_SHEETS_CLIENT_SECRET": "your_client_secret",
124
+ "GOOGLE_SHEETS_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-sheets": {
148
+ "type": "stdio",
149
+ "command": "npx",
150
+ "args": ["-y", "@a1-x-tech/mcp-google-sheets@latest"],
151
+ "env": {
152
+ "GOOGLE_SHEETS_CLIENT_ID": "your_client_id",
153
+ "GOOGLE_SHEETS_CLIENT_SECRET": "your_client_secret",
154
+ "GOOGLE_SHEETS_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-sheets": {
176
+ "type": "stdio",
177
+ "command": "npx",
178
+ "args": ["-y", "@a1-x-tech/mcp-google-sheets@latest"],
179
+ "env": {
180
+ "GOOGLE_SHEETS_CLIENT_ID": "${input:sheets_client_id}",
181
+ "GOOGLE_SHEETS_CLIENT_SECRET": "${input:sheets_client_secret}",
182
+ "GOOGLE_SHEETS_REFRESH_TOKEN": "${input:sheets_refresh_token}"
183
+ }
184
+ }
185
+ },
186
+ "inputs": [
187
+ { "type": "promptString", "id": "sheets_client_id", "description": "Google OAuth client ID" },
188
+ { "type": "promptString", "id": "sheets_client_secret", "description": "Google OAuth client secret", "password": true },
189
+ { "type": "promptString", "id": "sheets_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
+ - Найди самую свежую таблицу со словом «бюджет» в названии и покажи её структуру.
205
+ - Прочитай `'Q3'!A1:F50` и суммируй итоги.
206
+ - Покажи формулы, по которым считается лист «Итоги».
207
+
208
+ ### Обновить цифры
209
+
210
+ - Запиши эту таблицу в `Sheet1!A1` вместе с формулами.
211
+ - Добавь сегодняшние показатели новой строкой журнала.
212
+ - Обнови несколько диапазонов одним пакетом или очисти черновой диапазон, сохранив его оформление.
213
+
214
+ ### Оформить и показать
215
+
216
+ - Добавь лист «Март», закрепи строку заголовка и выдели её жирным.
217
+ - Подсвети отрицательные суммы красным условным форматом и добавь границы.
218
+ - Построй столбчатую диаграмму выручки по месяцам на отдельном листе.
219
+ - Преврати данные в структурированную таблицу и добавь выпадающий список через проверку данных.
220
+
221
+ ### Защитить и поделиться
222
+
223
+ - Защити строку итогов, чтобы её мог менять только я.
224
+ - Дай коллеге право редактирования, а остальным — только чтение.
225
+ - Покажи, у кого сейчас есть доступ к файлу.
226
+
227
+ ## Как меняется таблица
228
+
229
+ 1. Инструменты значений адресуют ячейки в **нотации A1** (`'Имя листа'!A1:C10`); структурные инструменты (листы, форматирование, правила, таблицы, диаграммы) адресуют числовой **sheetId** и индексы с отсчётом от нуля. Идентификаторы даёт `get_spreadsheet` — названия листов адресами не являются.
230
+ 2. Запись **перезаписывает** свой диапазон; `append_values` добавляет строки после последней строки данных; ячейка `null` пропускается, а не очищается.
231
+ 3. `clear_values` очищает значения и формулы, но сохраняет форматирование, проверку данных, заметки и объединения. Отмены через API нет — удаление листа, строк или столбцов уничтожает их данные.
232
+ 4. Пакетные инструменты переносят несколько диапазонов или запросов одним вызовом и считаются в квоте один раз; `batchUpdate` атомарен — применяются все его запросы или ни один.
233
+
234
+ У части возможностей таблиц нет отдельного инструмента: объединённые ячейки, именованные диапазоны, чередование цветов, фильтры, срезы, поиск с заменой и градиентные правила условного форматирования доступны через `raw_request`, который ограничен доменом Sheets API. Новая таблица создаётся в корне My Drive — перенос в папку сервер не покрывает, а `manage_permissions` не передаёт владение файлом.
235
+
236
+ ## Что может измениться
237
+
238
+ | Операция | Что происходит | Граница подтверждения |
239
+ |---|---|---|
240
+ | Чтение метаданных и значений | Читает структуру и ячейки | Ничего не меняет |
241
+ | Создание таблицы | Добавляет файл в My Drive | Меняет Google Sheets |
242
+ | Запись, пакетная запись или добавление значений | Перезаписывает ячейки или добавляет строки | Меняет таблицу |
243
+ | Форматирование, закрепление, границы, строки и столбцы, проверка данных, правила, таблицы, диаграммы | Меняет оформление, структуру и правила | Меняет таблицу |
244
+ | Очистка значений, удаление листа, строк или столбцов | Удаляет данные без отмены через API | Разрушительно |
245
+ | Управление защищёнными диапазонами и доступом | Меняет, кто может открывать и редактировать файл | Меняет доступ |
246
+ | Технический запрос API | Может вызвать метод API без отдельного инструмента | Потенциально разрушительно |
247
+
248
+ Как AI-приложение просит подтверждение, определяет само приложение. Сервер помечает операции чтения, записи и удаления, чтобы оно отличило проверку от рабочего изменения.
249
+
250
+ ## Как получить доступ
251
+
252
+ Для редактирования таблиц Google Sheets требует OAuth 2.0: одного API-ключа недостаточно.
253
+
254
+ 1. Создайте или выберите проект Google Cloud и включите **Google Sheets API**. Включите также **Google Drive API**, если нужны поиск таблиц и управление доступом.
255
+ 2. Настройте OAuth consent screen и создайте OAuth-клиент типа **Desktop app**.
256
+ 3. Авторизуйте Google-аккаунт, который владеет таблицами или может их редактировать. [OAuth 2.0 Playground](https://developers.google.com/oauthplayground) поможет получить refresh token, если включить **Use your own OAuth credentials**.
257
+ 4. Запросите минимальный scope:
258
+
259
+ ```text
260
+ https://www.googleapis.com/auth/spreadsheets
261
+ ```
262
+
263
+ Он покрывает каждый Sheets-инструмент. Дополнительный scope Drive нужен только `search_spreadsheets` и `manage_permissions`: `https://www.googleapis.com/auth/drive`, либо `drive.readonly` только для поиска, либо `drive.file` для файлов, созданных через это приложение.
264
+
265
+ Refresh token OAuth-приложения в режиме Testing может истечь через семь дней. Для долгого доступа опубликуйте OAuth-приложение или используйте Internal-приложение в домене Workspace. Храните client secret и refresh token как пароли.
266
+
267
+ ## Конфигурация
268
+
269
+ | Переменная | Обязательна | Описание |
270
+ |---|---|---|
271
+ | `GOOGLE_SHEETS_CLIENT_ID` | Да* | OAuth client ID. |
272
+ | `GOOGLE_SHEETS_CLIENT_SECRET` | Да* | OAuth client secret. |
273
+ | `GOOGLE_SHEETS_REFRESH_TOKEN` | Да* | OAuth refresh token. |
274
+ | `GOOGLE_SHEETS_ACCESS_TOKEN` | Да* | Короткоживущая (~1 ч) альтернатива OAuth-тройке. |
275
+ | `GOOGLE_SHEETS_API_BASE` | Нет | Переопределяет базовый URL Google Sheets API. |
276
+ | `GOOGLE_SHEETS_TIMEOUT_MS` | Нет | Тайм-аут одного запроса; по умолчанию `60000` мс. |
277
+ | `GOOGLE_SHEETS_MAX_RETRIES` | Нет | Повторы временных ошибок; по умолчанию `3`. |
278
+
279
+ \* Передайте OAuth-тройку или access token. Без учётных данных сервер всё равно запустится и покажет инструменты; первый вызов назовёт переменные, которые нужно задать.
280
+
281
+ ## Данные, лимиты и работа в фоне
282
+
283
+ - **Запросы идут в Google.** Локальный сервер обновляет OAuth-токены Google и вызывает Sheets API, а для поиска таблиц и управления доступом — Drive API. Анонимная телеметрия содержит ID установки, версию пакета, версии AI-клиента и платформы и имена инструментов — но не OAuth-токены, данные таблиц, аргументы или промпты. Чтобы отключить её, задайте `ASKADS_TELEMETRY=0`.
284
+ - **У Google есть поминутные квоты.** Документированные лимиты: 300 чтений и 300 записей в минуту на проект и по 60 на пользователя; пакетный вызов считается один раз, сколько бы диапазонов или запросов он ни нёс. В одной таблице не больше 10 000 000 ячеек. При `429` сервер использует задержку; чтение также повторяется после сетевых и `5xx` ошибок, а запись после неопределённой ошибки не повторяется.
285
+ - **Постоянного опроса нет.** Сервер работает только при вызове. Если AI-приложение поддерживает задания по расписанию, оно может периодически проверять таблицу.
286
+
287
+ ## Техническая документация
288
+
289
+ - [Каталог MCP-возможностей](./docs/capabilities/index.md) — страницы по пользовательским задачам для каждого инструмента.
290
+ - [Все инструменты и параметры](./docs/TOOLS.md)
291
+ - [Документация по разработке](./docs/DEVELOPMENT.md)
292
+ - [Документация по публикации](./docs/PUBLISHING.md)
293
+ - [Справочник Google Sheets API](https://developers.google.com/sheets/api)
294
+
295
+ ## Поддержка
296
+
297
+ Нашли ошибку или не хватает сценария? [Создайте issue](https://github.com/A1-x-Tech/mcp-google-sheets/issues) или напишите в [Telegram](https://t.me/a1_mcp).
298
+
299
+ <br>
300
+
301
+ <p align="center">
302
+ <img src="https://github.com/ztemerbekov/a1-yandex-kit-skills/raw/main/assets/images/mona-hifive-yandex-kit-warm.gif" alt="Две Моны дают пять" width="256">
303
+ </p>
304
+
305
+ <p align="center">
306
+ Вы дочитали до конца!
307
+ </p>