gdoc MCP
This server provides typed MCP tools to interact with Google Docs and Sheets via the gdoc CLI, supporting authentication, file management, content reading/writing, collaboration, and an escape hatch for advanced operations.
Authentication:
connect_googleto authorize a Google account via OAuth.File Discovery:
list_files(list Docs/Sheets in Drive or a folder, filterable by type) andsearch_files(search by name or content, with optional title-only).Reading & Metadata:
read_documentreads a Doc as Markdown or Sheet as a table, with options for tabs, revisions, comments, ranges, and image handling.document_inforetrieves metadata.list_tabsandtable_of_contentsprovide structure, andlist_revisionsshows revision history.Comments: Full comment management:
list_comments,get_comment,add_comment(with quoted text anchors),reply_to_comment,resolve_comment, andreopen_comment.Writing & Editing:
edit_documentreplaces text or table cells (case-sensitive, replace-all).write_documentreplaces an entire document or tab with Markdown.insert_documentinserts at start/end.create_documentcreates a new Doc, optionally from Markdown.add_tabadds a tab.Organization & Sharing:
copy_documentduplicates a document,share_documentshares with email and role (reader/writer/commenter).Escape Hatch:
gdoc_cliruns allowlistedgdocsubcommands for advanced operations not covered by typed tools.
Provides tools for managing Google Documents, including reading, searching, editing, commenting, sharing, and creating documents.
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., "@gdoc MCP find documents about budget planning"
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.
gdoc MCP
Typed MCP tools backed by Luca De Leo's gdoc CLI.
It follows JP Addison's dharma pattern:
the MCP server validates tool inputs, runs the CLI without a shell, returns structured
output, and keeps an allowlisted escape hatch for new CLI features.
Chosen deployment
Use the hosted MCP connector for 80,000 Hours. A Claude owner adds one URL; each staff member clicks Connect and authorizes their own Google account. This is the only option that gives staff the same connector-level experience as native Drive.
The local MCPB remains a fallback for development, personal use, or environments where hosting Google refresh tokens is unacceptable. It is not the planned staff deployment.
Related MCP server: Google Workspace MCP Server
Local fallback
Recipients do not need a terminal, Python, Node, uv, or a separate gdoc install:
Open the
.mcpbbuilt for the right Google profile and Mac architecture.In Claude, ask: “Connect Google Docs using the gdoc tools.”
Claude calls
connect_google; the bundle opens Google's authorization page.Sign into Google and approve access once.
The bundle contains the CLI and the profile's Desktop OAuth client. Google stores no
password in the extension: the browser returns an authorization code, and gdoc saves
the resulting refresh token locally under ~/.config/gdoc/ with mode 0600.
connect_google is separate from Claude's connector-level Connect button. That
button is available to remote MCP connectors; a local MCPB initiates OAuth from its own
tool.
Remote connector
Follow the personal end-to-end test guide to configure Google Cloud, install the Web OAuth credential without exposing it, add the connector to Claude, and verify read and write calls.
A remote connector is installed by URL, not as an .mcpb: Claude reaches it from
Anthropic's infrastructure even when the client is Claude Desktop. After connecting,
use the round-trip challenge to test Markdown
import, native tables, tabs, exact edits and comment threads. See the
update-friction matrix for which releases require a deploy,
a new conversation, renewed Google consent, or connector reinstallation.
The remote service gives Claude Team users the native connector flow: an owner adds
https://gdoc-mcp-alejo.fly.dev/mcp once, then each user clicks Connect and grants
Google access. The deployed endpoint is healthy, but its current personal Desktop OAuth
credential cannot accept a hosted callback. Before testing Connect, create a Google
OAuth client of type Web application with this authorized redirect URI:
https://gdoc-mcp-alejo.fly.dev/oauth/google/callbackThen replace the two staged Fly secrets and redeploy:
flyctl secrets set --app gdoc-mcp-alejo \
GOOGLE_CLIENT_ID='<web-client-id>' \
GOOGLE_CLIENT_SECRET='<web-client-secret>'
flyctl deploy --app gdoc-mcp-alejo --remote-onlyFor 80,000 Hours, deploy a separate organization-owned instance, set
ALLOWED_GOOGLE_DOMAIN=80000hours.org, and use an Internal Web OAuth client owned by
the Workspace organization. Keeping personal and organizational deployments separate
prevents a credential switch from invalidating another profile's stored grants.
The service implements MCP dynamic client registration, S256 PKCE, OAuth resource
indicators, Google identity verification, one-hour MCP access tokens, MCP refresh
tokens, and per-user MCP sessions. Google refresh tokens and MCP credentials are stored
in one AES-256-GCM encrypted file on an encrypted persistent volume. The encryption key
is a deployment secret. A Google token is materialized in a mode-0600 temporary home
directory only while gdoc handles a request, then removed.
The current encrypted file store requires one running machine. Before adding replicas, replace it with a transactional shared database or add cross-process locking.
Private build profiles
OAuth client files identify their owning Google Cloud project and must not be committed or attached to a public release. Build profile bundles locally:
npm ci
npm run build:mcpb -- personal \
~/.config/credentials/google-oauth-client-mac-air-2020-personal.json
npm run build:mcpb -- 80000hours \
/path/to/80000hours-google-desktop-oauth-client.jsonOutputs on an Apple Silicon Mac:
dist/gdoc-personal-arm64.mcpb
dist/gdoc-80000hours-arm64.mcpbThe personal profile defaults to alejoacelas@gmail.com. The 80,000 Hours profile
leaves the account open for each employee and sends 80000hours.org as Google's account
chooser hint. The organization OAuth application should use an Internal audience; that,
not the hint, enforces the Workspace domain.
The build fails before creating a bundle if the selected credential file is absent or is not a Google Desktop OAuth client.
Run from source
Developers can use an installed gdoc and any credential source it supports:
npm ci
GDOC_BIN=/absolute/path/to/gdoc npm startThe server exposes typed tools for browser authorization, reading, search, tabs,
revisions, comments, writes, direct and suggested edits, sharing, and document creation.
gdoc_cli passes arguments to an explicit subcommand allowlist without invoking a
shell; auth, config, update, and internal hooks cannot be reached through that raw tool.
Test
npm testThe live deployment can be checked without Google credentials:
curl -fsS https://gdoc-mcp-alejo.fly.dev/health
curl -fsS https://gdoc-mcp-alejo.fly.dev/.well-known/oauth-protected-resource/mcpTests use a fake CLI: they do not open a browser or call Google. The profile build also
validates the manifest and packages a platform-native CLI. After unpacking a built
bundle, a smoke test should list tools and call gdoc_cli with cat --help; this proves
the server can find and execute the bundled binary without accessing Drive.
Platform support
The current builds contain a PyInstaller CLI and are architecture-specific:
arm64: Apple Silicon Macs;x64: Intel Macs when built on an Intel Mac;Windows is not built yet.
MCPB itself supports macOS and Windows. Windows support requires building a Windows
gdoc.exe on Windows and either publishing a separate bundle or adding runtime
OS/architecture selection to one multi-platform bundle.
Security boundaries
Profile OAuth clients are copied only into ignored local build artifacts.
Refresh tokens are created by Google's browser flow; they are never committed or placed in the
.mcpb.Model-provided values go to
execFile, never a shell.The raw CLI tool excludes authentication and administrative commands.
Temporary Markdown files used for writes are mode
0600and removed after use.Remote Google grants and MCP credentials are encrypted at rest; OAuth state and PKCE bind each browser callback to the initiating Claude connection.
The bundled executable is unsigned, so a downloaded bundle may need Gatekeeper approval.
MIT.
Available Tools
22 toolsadd_commentC
Add a document comment, optionally anchored to quoted text.
Inputs: doc (required), text (required), quiet, quote, +1 more.
add_tabC
Add a tab to an existing Google Doc.
Inputs: doc (required), title (required), quiet, account.
connect_googleA
Connect Google Docs by opening Google's authorization page in the user's browser. Use this when gdoc reports that it is not authenticated. The bundled OAuth client is selected automatically; no terminal or copied token is needed.
Inputs: account.
copy_documentC
Duplicate a document with a new title.
Inputs: doc (required), title (required), quiet, account.
create_documentC
Create a Google Doc, optionally initialized from Markdown.
Inputs: title (required), account, content, folder_id, +1 more.
document_infoB
Get document metadata, ownership, modified time, and size.
Inputs: doc (required), quiet, account.
edit_documentC
Replace text or a table cell in a document. Replacement text supports Markdown formatting.
Inputs: doc (required), new_text (required), tab, cell, +8 more.
gdoc_cliA
Run an allowlisted gdoc command for options not covered by typed tools. Arguments are passed directly without a shell.
Inputs: command (required), args.
get_commentC
Get one comment thread with full detail.
Inputs: doc (required), comment_id (required), quiet, account.
insert_documentC
Insert Markdown at the start or end of a document tab.
Inputs: doc (required), content (required), tab, force, +4 more.
list_commentsC
List open comments, optionally including resolved threads.
Inputs: doc (required), quiet, account, include_resolved.
list_filesC
List Google Docs or Sheets in Drive or a folder.
Inputs: type, account, folder_id.
list_revisionsB
List retained revisions for a document.
Inputs: doc (required), limit, quiet, account.
list_tabsB
List document tabs or spreadsheet worksheets.
Inputs: doc (required), quiet, account.
read_documentB
Read a Google Doc as Markdown or a Sheet as a table. Can include tabs, revisions, and inline comments.
Inputs: doc (required), tab, quiet, range, +7 more.
reopen_commentB
Reopen a resolved comment.
Inputs: doc (required), comment_id (required), quiet, account.
reply_to_commentC
Reply to a document comment.
Inputs: doc (required), text (required), comment_id (required), quiet, +1 more.
resolve_commentC
Resolve a comment, optionally with a final message.
Inputs: doc (required), comment_id (required), quiet, account, +1 more.
search_filesC
Search Drive files by name or content.
Inputs: query (required), account, title_only.
table_of_contentsC
Extract a document heading outline with deep links.
Inputs: doc (required), tab, quiet, account, +2 more.
write_documentC
Replace a whole document or one tab with Markdown.
Inputs: doc (required), content (required), tab, force, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
Each tool targets a specific action (e.g., create, write, insert, edit for content; list, get, add, reply, resolve, reopen for comments) with clear boundaries. No two tools have overlapping purposes.
Most tools follow verb_noun pattern in snake_case (e.g., create_document, list_comments). A few like document_info and table_of_contents are noun_noun, but overall consistent and intuitive.
22 tools cover a wide range of document and comment operations without being excessive. Each tool serves a distinct purpose, well-scoped for a Google Docs integration.
Covers most CRUD operations and commenting lifecycle, but missing a delete_document tool. Also lacks undo or restore revision functionality, leaving a notable gap for basic document management.
Maintenance
Related MCP Connectors
Google Docs MCP Pack — read, create, and edit Google Docs via OAuth. Reuses the google_sheets…
Provides tools for searching Google Workspace documentation and much more.
Search, read and cite documents. Add, replace and delete files with write access. OAuth required.
Online office suite for AI agents: edit docs, sheets, slides and PDFs in browser or via MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Claude to interact with collaborative Docs instances, providing document management, content editing, access control, and AI-powered transformations via MCP.1MIT
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Gmail and Google Docs via MCP, including email search, read, send, and document read/create operations.-
- AlicenseNot gradedqualityCmaintenanceProvides read/write access to Google Sheets and Google Docs through MCP tools, enabling operations like reading sheets, appending rows, and editing documents.MIT
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Google Workspace (Drive, Docs, Sheets, Gmail) via MCP tools, using OAuth credentials stored locally or inline.-