Mcp Google Sheets Full

io.github.moooonad由 GitHub 帳號 moooonad 發布v0.2.0更新於 Oct 27, 2026

Full Google Sheets MCP: 26 tools + run_sheets_script escape hatch. User OAuth, no service account.

概覽

AI 產生的概覽

功能完整的 Google Sheets MCP 伺服器,提供 26 個工具用於讀寫、格式化與管理試算表,並可透過腳本執行任意 Sheets 與 Drive 操作。

可以做什麼
  • 尋找與檢視試算表:列出或搜尋 Drive 中的試算表、從試算表網址解析 ID、讀取中繼資料與儲存格範圍
  • 寫入與清除資料:更新或批次更新範圍、附加列、清除內容
  • 管理結構:建立試算表,新增、刪除、複製或重新命名工作表,插入與刪除列欄,合併儲存格,送出原始 batchUpdate 請求
  • 格式化儲存格:設定背景、文字與數字格式、對齊方式與框線
  • 透過 run_sheets_script 執行任意 Node 程式碼,腳本中已預先注入完成驗證的 Sheets 與 Drive 用戶端
  • 查看驗證狀態與憑證尋找位置
適用情境
適合讓助理直接操作 Google Sheets 的情境:讀取或更新資料、調整工作表與範圍結構、格式化報表,或用自訂腳本完成內建工具未涵蓋的操作。
執行需求
需在本機執行 Node.js,從 npm 套件 mcp-google-sheets-full 安裝。需要已啟用 Sheets 與 Drive API 的 Google Cloud 專案,並提供下列其一:放在設定目錄中的 OAuth 桌面用戶端 JSON(首次呼叫需瀏覽器授權,本機 3456 埠需可用),或透過 GOOGLE_APPLICATION_CREDENTIALS 指定服務帳戶金鑰路徑。可用 GSHEETS_CONFIG_DIR 覆寫設定目錄。
安裝前請注意
run_sheets_script 會在你的機器上以你的使用者身分、使用你的 Google 憑證執行任意 Node 程式碼,僅在信任請求時呼叫。OAuth 模式以你的整個 Google 帳號身分運作,可看到你能看到的所有試算表;申請的權限涵蓋全部 Sheets 與 Drive。相關工具會寫入、清除、調整結構並刪除試算表內容。憑證與權杖以檔案形式保存在設定目錄中。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mcp Google Sheets Full,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mcp-google-sheets-full

The Google Sheets MCP server that can do anything the Sheets API can.

26 tools spanning read/write, structural batchUpdate, Drive search, and an escape hatch (run_sheets_script) that executes arbitrary Node.js code with sheets / drive / auth / spreadsheetId pre-injected. Two auth modes: OAuth (default, your own Google account, zero per-sheet setup) or service account (opt-in, for headless / CI).

Why this server

Most Google Sheets MCP servers expose a curated set of operations and stop there. If you need something they didn't anticipate (a particular conditional-format request, a multi-step migration, a Drive-side operation, an analysis-then-write workflow), you're stuck.

This server adds the missing primitive: run_sheets_script. Pass a snippet of Node code, get back the result. The Sheets v4 and Drive v3 clients are already authenticated and in scope. The temp file is always cleaned up.

mcp-google-sheets-fullfreema/mcp-gsheetsxing5/mcp-google-sheetsringo380/claude-google-sheets-mcp
Read / write / append / clear✅✅✅✅
Structural batchUpdate (raw)✅partial❌❌
Granular tabs / rows / format / borders✅✅partial❌
Drive search (list / search_spreadsheets)✅❌partial❌
Arbitrary code execution (run_sheets_script)✅❌❌❌
Auth modes✅ OAuth default + service account opt-inservice-account-firstbothboth
LanguageTypeScript / NodeTypeScript / NodePythonPython

spreadsheetId is always an explicit parameter of every tool — there is no hidden default.

Security model

run_sheets_script executes Node code on the machine where the MCP server runs, under your user account, against your OAuth token. The trust boundary is the same as any tool that lets Claude run code on your behalf (Bash, Edit, Write):

  • The script can only do what the OAuth scopes allow (Sheets + Drive). It cannot touch your other Google services, your filesystem outside tmpdir, or the network in ways the host node process can't.
  • Every script gets a fresh temp file in os.tmpdir(), executed via node, deleted on completion (success or failure).
  • There is a per-call timeout (default 2 min, max 10 min).
  • The token never leaves disk: the OAuth file lives in ~/.mcp-google-sheets/.

If you're not comfortable with code execution, simply don't call run_sheets_script — the other 25 tools cover the common cases without it.

For AI agents

If you're an AI agent (Claude Code, Cursor, etc.) installing or operating this server for a user, read AGENTS.md. It contains the canonical step-by-step setup flow, tool selection guide, common failure modes, and the trust/security expectations.

Setup (one-time)

1. Install

bash
npm install -g mcp-google-sheets-full

This places an mcp-google-sheets-full executable on your PATH. To update: re-run the same command. To remove: npm uninstall -g mcp-google-sheets-full.

For development: clone the repo and run npm install && npm run build.

2. Choose an auth mode

Two ways to authenticate the server. Pick exactly one depending on how you will use it.

OAuth (default)Service account
Best forClaude Desktop / Code / Cursor on your laptopCI, cron, serverless, headless automation
Setup effort1 file in ~/.mcp-google-sheets/1 file anywhere + 1 env var
Acts asYou (your Google account)A bot identity
SeesEvery sheet you can seeOnly sheets explicitly shared with the bot email
Requires a browser?Yes (once, on first call)Never
Token refreshAutomaticN/A

Selection is automatic: if the env var GOOGLE_APPLICATION_CREDENTIALS is set, the server uses service account mode; otherwise it uses OAuth mode.

OAuth setup
  1. Go to https://console.cloud.google.com/, create or select a project.

  2. APIs & Services → Library: enable Google Sheets API and Google Drive API.

  3. APIs & Services → OAuth consent screen: set up an "External" app (or "Internal" if you have a Workspace). Add yourself as a test user.

  4. APIs & Services → Credentials → Create Credentials → OAuth client ID:

    • Application type: Desktop app.
    • Name: anything.
  5. Download the JSON.

  6. Save it to:

    • Windows: %USERPROFILE%\.mcp-google-sheets\gdrive-credentials.json
    • macOS / Linux: ~/.mcp-google-sheets/gdrive-credentials.json

    (Override the directory via env GSHEETS_CONFIG_DIR.)

The first time any tool runs, the server opens your browser to grant access. The resulting token is saved to gdrive-token.json next to the credentials. Subsequent runs refresh silently. If a refresh fails (e.g. the token was revoked), delete gdrive-token.json and the next call re-triggers the browser flow.

Service account setup (opt-in, headless)
  1. In Google Cloud Console, enable Google Sheets API and Google Drive API on your project (same as OAuth).
  2. IAM & Admin → Service Accounts → Create service account. Give it a name; no roles needed at the project level for our use case.
  3. Open the service account → Keys → Add Key → JSON. Download the file.
  4. Place the file anywhere readable (e.g. ~/.mcp-google-sheets/sa-key.json or a CI secret path).
  5. Set the env var when launching the server:
    • Shell: export GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to/sa-key.json
    • Claude config: add it under the server entry (see below).
  6. Share every spreadsheet you want the server to access with the service account's email (visible inside the key JSON as client_email, looks like [email protected]). Without this, calls return 403 even though the credentials are valid.

There is no token file in this mode; the server gets fresh access tokens on demand. No browser flow.

Register the server

After global install the mcp-google-sheets-full binary is on PATH.

Claude Code (project or user scope)

bash
claude mcp add google-sheets -- mcp-google-sheets-full

Claude Desktop (claude_desktop_config.json)

OAuth mode (default):

json
{  "mcpServers": {    "google-sheets": {      "command": "mcp-google-sheets-full"    }  }}

Service account mode — add the env var to switch the server into headless auth:

json
{  "mcpServers": {    "google-sheets": {      "command": "mcp-google-sheets-full",      "env": {        "GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/sa-key.json"      }    }  }}

If Claude Desktop can't find the command (it sometimes ignores PATH on macOS/Windows), use the absolute path from npm bin -g followed by /mcp-google-sheets-full (or .cmd on Windows).

Recognized env vars:

  • GOOGLE_APPLICATION_CREDENTIALS — if set to a service account JSON key path, the server switches to service account mode. If unset, OAuth mode.
  • GSHEETS_CONFIG_DIR — override the directory where OAuth credentials/token live (default: ~/.mcp-google-sheets).

Using run_sheets_script

When the caller needs to do something not covered by the convenience tools (multi-step operations, custom batchUpdate composition, Drive operations, ad-hoc analysis), it passes a chunk of Node code. The harness pre-creates an authenticated context, so the script body itself just uses sheets, drive, spreadsheetId. Assign to result to return a structured value.

Example body:

js
// List all tabs and their first rowconst meta = await sheets.spreadsheets.get({ spreadsheetId });const headers = {};for (const s of meta.data.sheets) {  const r = await sheets.spreadsheets.values.get({    spreadsheetId,    range: `${s.properties.title}!1:1`,  });  headers[s.properties.title] = r.data.values?.[0] ?? [];}result = headers;

The harness wraps the code in an async IIFE, so top-level await works directly. Errors are reported with stack trace and non-zero exit code. The temp file is removed in every path.

Provided tools

ToolPurpose
auth_statusWhere the server looks for credentials/token and whether they exist.
resolve_urlExtract spreadsheetId + gid from a Google Sheets URL.
list_spreadsheetsList spreadsheets in the user's Drive (recent-first).
search_spreadsheetsSearch spreadsheets by name substring or full-text content.
get_spreadsheetSpreadsheet metadata (tabs, gridProperties).
get_valuesRead one A1 range.
batch_get_valuesRead multiple ranges.
update_valuesWrite a 2D array to a range.
batch_update_valuesWrite multiple ranges in one call.
append_valuesAppend rows to the end of a table.
clear_valuesClear one or more ranges.
batch_updateStructural changes (raw Sheets API Request[]) — escape hatch for any Request type not covered by a dedicated tool.
create_spreadsheetCreate a new spreadsheet owned by the user.
add_sheet / delete_sheet / duplicate_sheet / rename_sheetManage tabs (accept sheet_id gid or sheet_name).
insert_rows / insert_columns / delete_rows / delete_columnsManage rows/columns by 0-based index ranges.
merge_cells / unmerge_cellsMerge ranges (MERGE_ALL / MERGE_COLUMNS / MERGE_ROWS).
format_cellsApply a partial CellFormat to a range (background, textFormat, alignment, numberFormat, ...).
set_bordersSet borders on a range (top/bottom/left/right/innerHorizontal/innerVertical).
run_sheets_scriptRun arbitrary Node code with pre-authenticated sheets/drive/auth/spreadsheetId.

Notes

  • The OAuth flow listens on http://localhost:3456 during initial authorization. Make sure that port is free.
  • Scopes requested: https://www.googleapis.com/auth/spreadsheets and https://www.googleapis.com/auth/drive.
  • run_sheets_script runs a fresh node process per call. It re-uses the same ~/.mcp-google-sheets/ credentials and token. There's a configurable timeout (default 2 min, max 10 min).

來源:README.md,提交 e24e657

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分