gworkspace-mcp
Enables AI agents to interact with Google Sheets and Google Docs through Google APIs, including reading, writing, formatting, and managing spreadsheet and document content on the user's behalf.
Provides tools to describe, read, search, insert, replace, delete, format, and create Google Docs, including tables, paragraph styles, and index-safe editing.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gworkspace-mcp update B2 on my budget sheet to 250, then show me the formulas in row 1"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gworkspace-mcp
A Google Sheets and Docs MCP server with full API coverage, over stdio, acting as you.
The first-party Google MCP connectors can read an approximation of a file and cannot write to one. This server closes that gap: range reads including formulas, in-place cell writes, the whole Sheets structural surface, and index-safe editing of Google Docs.
Quickstart · Tools · Safety · Configuration ·
GCP setup: docs/setup-gcp.md · Design: docs/design.md ·
Known gaps: docs/open-tasks.md
Naming. The project was called
gsheets-mcpbefore it gained Docs support. Environment variables (GSHEETS_*), the config directory (~/.config/gsheets-mcp/) and the Keychain service (gsheets-mcp) keep the old name so existing installs keep working.
Prerequisites
Need | Notes |
Node.js 22+ |
|
A Google account | Personal Gmail or Workspace |
A Google Cloud project you control | Free; used only to own the OAuth client. Walkthrough: |
An MCP client | Claude Code, Claude Desktop, or any stdio MCP client |
Platform support
OS | Refresh-token storage | Login browser | Status |
macOS | Keychain (service | opens automatically | used daily |
Linux |
| open the printed URL yourself | should work, not tested |
Windows | same file store; POSIX file modes are not enforced | open the printed URL yourself | not tested |
Related MCP server: Google Docs & Gmail MCP Server
Quickstart
1. Create an OAuth client (one time, ~10 minutes)
Follow docs/setup-gcp.md. In short: enable the Sheets, Docs and Drive APIs,
set the consent screen to External, add the scopes, add yourself as a test user, create a
Desktop app client, and save its JSON:
mkdir -p ~/.config/gsheets-mcp && chmod 700 ~/.config/gsheets-mcp
mv ~/Downloads/client_secret_*.json ~/.config/gsheets-mcp/client.json
chmod 600 ~/.config/gsheets-mcp/client.jsonOr set GSHEETS_CLIENT_ID and GSHEETS_CLIENT_SECRET instead of the file.
2. Install and build
git clone https://github.com/ctschak/gworkspace-mcp.git
cd gworkspace-mcp
npm install
npm run build3. Create a profile
A profile is a config/<name>.env file saying which account an instance acts as and what it may
touch. It holds no credentials.
cp config/example.env config/work.env # edit: GSHEETS_DEFAULT_ACCOUNT=you@example.comOnly config/example.env is tracked by git; every other *.env is ignored. Details and precedence:
config/README.md. Profiles are optional — without one, the server uses the
only (or default) authorised account.
4. Authorise
node dist/cli.js login --profile work # browser consent, once per account
node dist/cli.js accounts # confirmGoogle shows "Google hasn't verified this app" — expected for your own unverified client. Choose Advanced → Go to … (unsafe) and grant.
5. Register with your MCP client
Claude Code — one instance per profile, so the account follows from the tool you reach for:
claude mcp add -s user gws-work -- node "$(pwd)/dist/index.js" --profile workClaude Desktop / other stdio clients — add to the client's MCP config (Claude Desktop:
claude_desktop_config.json), using an absolute path:
{
"mcpServers": {
"gws-work": {
"command": "node",
"args": ["/absolute/path/to/gworkspace-mcp/dist/index.js", "--profile", "work"]
}
}
}Restart the client so it connects.
6. First call
Ask your agent to run sheets_describe (or docs_describe) on a spreadsheet (or document) URL you
own. It returns the tabs and used ranges (or the outline) without any cell data.
Recommended shape
A read-only profile for daily use and a read-write one enabled deliberately — GSHEETS_READ_ONLY=1
in the first, GSHEETS_ALLOWED_IDS in the second. See config/README.md.
Re-authorisation and token lifetime
Disclaimer — token lifetime is Google's policy, not this project's. The figures below are Google's published rules, checked against Google's OAuth 2.0 docs on 2026-11-29. Google can change them without notice, and observed lifetimes vary (tokens have been seen surviving past 7 days and dying sooner). Plan for re-authorisation at any time; do not build unattended automation on a user refresh token from a Testing app.
Why your client stays in Testing
Publishing an OAuth app to production requires a homepage and a privacy-policy URL on a domain you're
authorised for, because spreadsheets is a sensitive scope. That's a poor trade for a local tool,
so your client stays in Testing. Google's rule for that state: an External app in Testing is
issued refresh tokens that expire in 7 days, unless it requests only openid / email /
profile — this server also needs spreadsheets, documents and drive.file, so the rule applies.
When you will need to log in again
Scenario | What you see | Fix |
7-day expiry (External + Testing app) — the common one |
|
|
You revoked access at myaccount.google.com/permissions | same | same |
Token unused for 6 months | same | same |
More than 100 refresh tokens for one account on one OAuth client (e.g. logging in repeatedly, many machines) — Google silently invalidates the oldest | same, on the older machine/profile | log in again there; avoid needless re-logins |
Workspace account: admin set a Google Cloud session length (can be 1–24 h) | same (Google's underlying subtype is | log in again; ask the admin about session policy if it recurs |
Workspace admin marks Sheets/Docs/Drive as Restricted |
| admin must allow the app; re-login won't help |
Time-based access granted at consent has expired |
| log in again |
A scope was added (e.g. | Google 403 | log in again — the new scope is requested at login |
OAuth client deleted, recreated, or its secret reset | an OAuth client error at login or on calls ( | install the new |
New machine, Keychain entry removed, or |
|
|
Password changes do not revoke this server's tokens — per Google that applies only to tokens holding Gmail scopes, which this server never requests.
The expiry message always says "Expected roughly weekly": the server sees only invalid_grant and
cannot tell which of the causes above fired. If re-authorising doesn't fix it, work down the table.
Which accounts are dead, and how to add a new account: the
gworkspace-auth skill, usable by Claude Code or as a
checklist.
Tools
Tool | Purpose |
| Start here. Tabs with |
| Authorised accounts, active default, granted scopes, write configuration. |
| Several A1 ranges in one call. |
| Per-cell detail values cannot express: formulas, notes, data validation, effective formatting, hyperlinks. |
| Batch writes to A1 ranges. |
| Append rows below a table's last populated row. |
| Clear values, retain formatting. |
| Scoped find/replace, optional regex, returns occurrences changed. |
| New spreadsheet with tabs. |
| Add, delete, duplicate, rename, reorder, hide/show, resize. |
| Number formats, fonts, colours, borders, alignment, wrapping, merges, freezes, column/row sizing. |
| Data validation, conditional formatting, basic filters, sorting. |
| Named ranges; protected ranges. |
| Escape hatch. Literal Sheets v4 |
Docs
Tool | Purpose |
| Start here. Outline without the full text: heading tree with index ranges, table positions, body length, named styles, tabs. |
| Document text, sliceable by index range and capped. |
| Locate exact text, return its index ranges. The safe way to get indices — measured now, not guessed, and matches spanning formatting boundaries are handled. |
| Insert at an index, at the end, or before/after existing text. |
| Find and replace. Carries no indices, so immune to drift — the safest way to change wording. |
| Delete index ranges. |
| Text styling, links, paragraph named styles (headings), alignment, spacing, bullets. |
| Insert a table, optionally populated. |
| New document with optional initial text. |
| Escape hatch. Literal Docs v1 |
Docs indices shift under you
A document is one flat run of characters, addressed by absolute offset. Inserting 5 characters at
index 10 invalidates every index after it — and within a single batchUpdate the requests apply in
order, so request #2 sees a document you never measured.
Three defences, so this mostly does not need thinking about:
Every batch is reordered back-to-front before sending, so an edit only disturbs text after itself. Stable, so same-index requests keep your order. The response says when reordering happened.
docs_findmeasures indices immediately before use.docs_replace_textcarries no indices at all. Prefer it for wording changes.
Never reuse an index across separate calls. Batch instead, or re-run docs_find.
Every mutating tool takes dryRun: true, which returns the exact request it would send plus an
impact summary and sends nothing.
Workflow
sheets_describe first, always. It supplies the sheetIds that structural edits need and the used
range that keeps a read from asking for A:ZZ and paying for empty cells.
Safety
Control | Effect |
| Registers only the 7 discovery and read tools: |
| Comma-separated spreadsheet and document ids; writes to anything else are refused. Reads are unaffected. |
| Returns the request instead of sending it. |
| One JSON line per write: time, account, tool, file id, ranges, cell count. |
Google's own version history is the undo mechanism. The audit log is how you find which revision.
What is stored where, and how to report a vulnerability: SECURITY.md.
Configuration
Set these in a config/<name>.env profile, or pass them with --env at registration. A real
environment variable always wins over a profile file.
Variable | Effect |
| Profile to load, same as |
| Where profiles live. Defaults to |
| OAuth client, instead of |
| Alternative path to the client JSON. |
| Account to act as when a tool call does not name one. |
| Write allowlist. |
| Same as |
| Alternative audit log path. |
| Skip the Keychain and use the 0600 file store. |
| Reserved: adds the |
Scopes
Scope | Why |
| Read and write a spreadsheet whose id you already have |
| Read and write a document whose id you already have |
| Identity only, no data access — returns the consenting account's email so credentials cannot be filed under the wrong account |
| Per-file, and reaches only files this OAuth client created. Present so the live test suite can delete its own scratch spreadsheets; it cannot list, read or touch anything else in your Drive |
drive.readonly is not requested and never will be — it would grant read of every file you own
to buy a filename lookup. Pass a spreadsheet URL or id, or use the Google Drive MCP to find one.
The Sheets, Docs and Drive APIs must all be enabled on the project that owns the OAuth client —
its number is your client id's prefix. See docs/setup-gcp.md.
Development
npm run typecheck
npm run build # tests run against dist/, so build first
npm test # unit, no network
node dist/cli.js profiles # what is configured locallyLive smoke tests create a scratch spreadsheet, exercise every tool against it, and delete it. They never touch an existing spreadsheet, and run only when asked:
GSHEETS_LIVE_TEST=1 node --test test/live.test.js # Sheets
GSHEETS_LIVE_TEST=1 node --test test/live-docs.test.js # DocsBoth create a scratch file, exercise every tool against it, and delete it via drive.file.
No real spreadsheet ids or sheet content belong in this repo. Fixtures are synthetic.
Contributing: CONTRIBUTING.md. Agents working in this repo: CLAUDE.md.
License
Available Tools
24 toolsdocs_batch_update_rawRaw Docs batchUpdateA
Send literal Docs API v1 Request objects. Covers the whole API, including inline images, headers and footers, footnotes, bookmarks and positioned objects, which the grouped tools do not wrap. Indices are document-wide and end-exclusive; requests are reordered back-to-front automatically. Use dryRun first.
Inputs: document (required), requests (required), tab, dryRun, +1 more.
docs_createCreate a documentB
Create a new Google Doc with a title and optional initial text. Returns its id and URL.
Inputs: title (required), text, dryRun, account.
docs_deleteDelete content rangesA
Delete index ranges, end-exclusive. Get the ranges from docs_find. Applied back-to-front. Supports dryRun.
Inputs: ranges (required), document (required), tab, dryRun, +1 more.
docs_describeDescribe a documentA
Outline of a Google Doc without its full text: title, heading tree with index ranges, table positions, body length, named styles, tabs. Call this first to see the shape of a document before reading or editing it.
Inputs: document (required), tab, account.
docs_findFind text and get its index rangesA
Locate exact text and return document index ranges for each match. This is the safe way to obtain indices for docs_format or docs_delete — they are measured now rather than guessed, and matches spanning formatting boundaries are handled. Indices are valid only until the next edit.
Inputs: text (required), document (required), tab, limit, +1 more.
docs_formatFormat text and paragraphsA
Bold/italic/underline, font, size, colours, links; paragraph named styles (headings), alignment, spacing; bullets and numbering. Uses a precise field mask, so styling you do not mention is left alone. Supports dryRun.
Inputs: document (required), operations (required), tab, dryRun, +1 more.
docs_insertInsert textA
Insert text at an index, at the end of the body, or before/after existing text. Several insertions are applied back-to-front in one batch so earlier ones cannot shift the indices later ones rely on. Supports dryRun.
Inputs: document (required), insertions (required), tab, dryRun, +1 more.
docs_readRead document textA
Plain text of a document, optionally sliced by index range and capped. Set withIndices to get per-run index boundaries for targeting edits.
Inputs: document (required), tab, account, endIndex, +3 more.
docs_replace_textReplace textA
Find and replace text throughout a document. Carries no indices, so it is immune to index drift and is the safest way to change wording. Supports dryRun.
Inputs: document (required), replacements (required), tab, dryRun, +1 more.
docs_tableInsert a tableB
Insert a table, optionally populating its cells. Populating costs a second round trip, because cell indices do not exist until the table does. Supports dryRun.
Inputs: rows (required), columns (required), document (required), tab, +4 more.
sheets_accountsList authorised accountsB
Google accounts this server can act as, the active default, granted scopes, and write configuration.
Inputs: no named parameters.
sheets_appendAppend rowsB
Append rows below the last populated row of a table. Supports dryRun.
Inputs: range (required), values (required), spreadsheet (required), dryRun, +3 more.
sheets_batch_update_rawRaw batchUpdateA
Send literal Sheets API v4 Request objects. Covers the entire API, including charts, pivot tables, slicers and developer metadata, which the grouped tools do not wrap. GridRange indices are zero-based and end-exclusive. Take sheetId values from sheets_describe, and run with dryRun first when the request shape is not obvious.
Inputs: requests (required), spreadsheet (required), dryRun, account, +1 more.
sheets_clearClear rangesB
Clear values from A1 ranges, leaving formatting intact. Supports dryRun.
Inputs: ranges (required), spreadsheet (required), dryRun, account.
sheets_createCreate a spreadsheetB
Create a new spreadsheet with the given title and tabs. Returns its id and URL.
Inputs: title (required), tabs, dryRun, account.
sheets_data_toolsValidation, conditional formatting, filters, sortingC
Data validation rules, conditional formatting, basic filters and range sorting. Supports dryRun.
Inputs: operations (required), spreadsheet (required), dryRun, account.
sheets_describeDescribe a spreadsheetA
Structure of a spreadsheet with no cell data: tabs with sheetId, index, allocated and USED ranges, frozen rows/columns, named ranges, protected ranges, and chart/conditional-format counts. Call this before any read or structural edit — the used range is what lets a read target A1:G412 instead of A:ZZ.
Inputs: spreadsheet (required), account, maxProbeCells, includeUsedRanges.
sheets_find_replaceFind and replaceA
Find and replace across a range, a tab, or every tab. Optional regex, case and whole-cell matching. Returns the number of occurrences changed. Supports dryRun.
Inputs: find (required), replacement (required), spreadsheet (required), range, +7 more.
sheets_formatFormat cellsB
Number formats, fonts, colours, borders, alignment, wrapping, merges, frozen panes, and column/row sizing. Uses a precise field mask, so formatting you do not mention is left alone. Supports dryRun.
Inputs: operations (required), spreadsheet (required), dryRun, account.
sheets_inspectInspect cell detailC
Per-cell detail values cannot express: formulas, notes, data validation rules, effective formatting, hyperlinks. Keep the range small — the payload per cell is large.
Inputs: range (required), spreadsheet (required), account, include.
sheets_manage_tabsManage tabsC
Add, delete, duplicate, rename, reorder, hide/show or resize tabs. Supports dryRun.
Inputs: operations (required), spreadsheet (required), dryRun, account.
sheets_named_rangesNamed and protected rangesB
Create, update and delete named ranges; protect and unprotect ranges or whole tabs. Supports dryRun.
Inputs: operations (required), spreadsheet (required), dryRun, account.
sheets_readRead rangesA
Read one or more A1 ranges in a single call. valueRender FORMULA returns formula text rather than results. Output is TSV by default and capped; a truncated range reports nextRange to continue from.
Inputs: ranges (required), spreadsheet (required), format, account, +3 more.
sheets_writeWrite cellsC
Write values to one or more A1 ranges in a single batch. valueInput USER_ENTERED (default) parses input as if typed, so formulas and dates work; RAW stores literal text. Supports dryRun.
Inputs: updates (required), spreadsheet (required), dryRun, account, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 24 tools
Most tools target a clearly distinct resource+action, and the docs/sheets prefix plus explicit guidance (describe before read, find before format/delete) keeps selection predictable. The main soft spots are the catch-all groupings — sheets_data_tools vs sheets_format vs sheets_named_ranges, and sheets_write vs sheets_append vs the two *_batch_update_raw escape hatches — where an agent must read descriptions carefully to know which wrapper owns a given operation.
Every tool follows the same snake_case prefix_action pattern (docs_*, sheets_*), with consistent verb placement and parallel operations across the two surfaces (describe/read/format/create/batch_update_raw). Minor outliers like sheets_accounts and sheets_data_tools are still readable and clearly namespaced.
24 tools is on the heavy side but is defensible for two large Google APIs, with grouped wrappers and a raw escape hatch rather than one tool per API endpoint. A few grouped tools (sheets_data_tools, sheets_named_ranges) could plausibly be merged, so it is slightly over the ideal band rather than badly scoped.
Both domains have full lifecycle coverage: create/read/describe, insert/append/write, find, replace, delete/clear, format, and structural edits, plus *_batch_update_raw to reach anything unwrapped. No obvious dead ends for document or spreadsheet editing workflows.
Maintenance
Related MCP Connectors
Create and improve live, shared interactive documents with your agent.
Online office suite for AI agents: edit docs, sheets, slides and PDFs in browser or via MCP.
Connect AI assistants to Google Sheets through controlled tools for reading and updating rows.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables Claude to read and edit individual cells and ranges in Google Sheets via a local stdio server, authenticating as the user with a one-time Google sign-in.MIT
- AlicenseAqualityDmaintenanceEnables AI agents to create and edit Google Docs and draft Gmail emails through natural language.7ISC
- AlicenseAqualityDmaintenanceEnables an AI agent to run local tools on the user's own machine via stdio, including command execution, workspace file read/write, and system status checks.52MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to use an approved session to inspect capabilities, manage projects and memories, perform bounded reads, and make journaled changes through a stdio interface.131 npmMIT