Skip to main content
Glama
Google Sheets MCP
by heist1337

Google Sheets MCP

Check FastMCP MIT Python

Пять инструментов для чтения и редактирования Google Sheets. Небольшой собственный MCP на FastMCP и официальном Google SDK. Удаления, очистка и уменьшение сетки блокируются до обращения к Google.

Быстрый старт

Установить uv, затем:

git clone https://github.com/heist1337/sheets-mcp.git
cd sheets-mcp
cp .env.example .env
# Указать путь к Google credentials в .env.
uv run --locked --env-file .env google-sheets-mcp

По умолчанию используется stdio: обычно эту команду запускает MCP-клиент. Python и зависимости устанавливает uv.

Related MCP server: vnsh-mcp

Подключение к агенту

Скопировать mcp.example.json в настройки MCP-клиента, заменив путь к checkout и приватному env-файлу. Запуск — одна команда; постоянно работающий сервис не требуется.

Инструмент

Действие

sheets_get

Метаданные, листы, форматы и свойства

sheets_read

Явный A1-диапазон; формулы по умолчанию

sheets_create

Создание таблицы при наличии соответствующих прав Google

sheets_write

Запись в согласованный диапазон; RAW по умолчанию

sheets_batch_update

Форматирование и разрешённые структурные операции

Обычное редактирование может заменить содержимое. Сначала прочитать цель; после таймаута записи проверить результат, прежде чем повторять запрос. Автоматических повторов записи и HTTP redirects нет.

Авторизация

GOOGLE_APPLICATION_CREDENTIALS — путь к service-account JSON либо стандартные Google Application Default Credentials. Таблицы должны быть доступны этому аккаунту; его права могут отличаться от прав пользователя.

Для пользовательского доступа задать GOOGLE_OAUTH_TOKEN_FILE. Первичный вход использует штатный Google OAuth Desktop flow:

uv run google-sheets-mcp --authorize --client-secrets /private/client.json --token-file /private/oauth-token.json

JSON с type=service_account — другой тип credentials, не OAuth Desktop client. Создание новых файлов ограничивается правами и storage quota Google-аккаунта. Секреты хранить вне Git с правами 0600; каталог — 0700.

HTTP и Docker

Для общего endpoint задать MCP_TOKEN длиной от 32 символов:

uv run --locked --env-file .env google-sheets-mcp --transport http --port 18091

URL: http://127.0.0.1:18091/mcp/, заголовок Authorization: Bearer <MCP_TOKEN>. По умолчанию сервер слушает loopback. Для доступа извне нужен приватный транспорт/HTTPS.

docker build -t google-sheets-mcp .
docker run --rm -i --env-file .env \
  -v /private/credentials.json:/run/secrets/google.json:ro \
  -e GOOGLE_APPLICATION_CREDENTIALS=/run/secrets/google.json google-sheets-mcp

Контейнер работает непривилегированным UID 1000; смонтированный файл должен быть доступен этому UID. Docker Desktop не требуется.

Перенос и разработка

Перенести checkout, приватный env-файл и Google credentials; обновить пути. Нет зависимости от Personal Context, Windmill, PostgreSQL или другого MCP.

uv sync --locked
uv run ruff check src tests
uv run python -m unittest discover -b -s tests
uv build

Это самостоятельный адаптер на официальном Google SDK.

Передача коллегам и проверка · MIT

Available Tools

5 tools
sheets_batch_updateSheets Batch UpdateB
Destructive

Apply approved formatting/structure operations. Deletion, clearing, grid shrinking and unknown requests are rejected. Other edits can still overwrite data.

Inputs: requests (required), spreadsheet_id (required), parameters. Returns: object

sheets_createSheets CreateB
Destructive

Create a spreadsheet only on explicit user request. On timeout check for prior creation before retry.

Inputs: parameters (required). Returns: object

sheets_getSheets GetB
Read-onlyIdempotent

Read spreadsheet metadata. Grid data requires explicit ranges; inspect before editing.

Inputs: spreadsheet_id (required), parameters. Returns: object

sheets_readSheets ReadA
Read-onlyIdempotent

Read one explicit A1 range; formulas are preserved by default. A range is not a full workbook.

Inputs: range (required), spreadsheet_id (required), parameters. Returns: object

sheets_writeSheets WriteA
Destructive

Replace values in the approved A1 range. Default RAW; read back before retrying uncertain writes.

Inputs: range (required), values (required), spreadsheet_id (required), parameters. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 5 tools

    Disambiguation4/5

    sheets_get and sheets_read both read, but one targets metadata and the other an explicit A1 value range. sheets_write and sheets_batch_update both mutate, but one replaces values while the other applies formatting/structure operations; descriptions clarify the boundary.

    Naming Consistency5/5

    All tools use the consistent sheets_ snake_case prefix followed by an action verb. batch_update is a compound action but remains predictable within the same pattern.

    Tool Count5/5

    Five tools are well-scoped for a Google Sheets server: create, inspect metadata, read ranges, write values, and batch-update structure/formatting. Each tool has a clear role without excessive surface area.

    Completeness3/5

    The core create/read/write/format lifecycle is covered, but deletion, clearing, appending rows, and sheet-level lifecycle operations are missing or explicitly rejected. These gaps create dead ends for common cleanup and data-entry workflows.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to remotely execute shell commands and transfer files on SSH hosts, including jump-host tunneling, background tasks, resumable transfers, and optional approval of destructive commands, while SSH credentials remain in the local process. It runs over stdio or a streamable HTTP daemon and supports auditing, allow/deny lists, and multiple authentication methods.
      ISC
    • A
      license
      Not graded
      quality
      A
      maintenance
      Lets agents create, read, update, list, and restore shared encrypted workspaces and artifacts, exchanging a single link that both people and other AI agents can open and edit. Content is encrypted client-side with version-checked writes, so concurrent writers can't silently clobber each other and links can be shared as read-only or editable.
      19 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables coding agents to browse, read, search, and write files inside a locked workspace, run asynchronous shell commands, and batch read operations, all with validated caching, health diagnostics, and a SQLite audit trail.
      38
      836 npm
      1
      AGPL 3.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables agent hosts to perform guarded, undoable filesystem operations confined to registered workspaces: atomic whole-file writes, file and directory create/copy/move/delete, staged literal text and line-range edits, patch application, and search, all journaled with content-addressed blobs. Every mutation returns an operation id and undo availability so history can be inspected and safely reverted with conflict detection, while credential-shaped targets are refused and errors come back as structured data with stable codes.
      25
      30 PyPI
      MIT