gdocs
Enables Claude Code to read Google Docs and their comment threads, then write corrections and replies back into the same document at the same URL.
README
gdocs — Google Docs review loop for Claude Code
An MCP server that lets Claude Code read a Google Doc and its comment threads, then write corrections back into the same Doc at the same URL.
Built for the loop where Markdown in a repo is the source of truth and Google Docs is only the review surface. It removes the copy-paste round trip: no pasting the draft into Docs, no pasting reviewer comments back into the terminal.
Installed at user scope, so it works in every project.
Requirements
- Node 18+
- The
claudeCLI - A Google account, and about 10 minutes in Google Cloud Console
Install
git clone https://github.com/uma-victor1/gdocs-mcp.git
cd gdocs-mcp
./install.sh
That installs dependencies, verifies the server starts, and registers it with Claude Code at user scope. Then do the two credential steps below yourself.
1. Google Cloud, once
- Create a project: https://console.cloud.google.com/projectcreate
- Enable Google Docs API and Google Drive API (APIs & Services > Library)
- OAuth consent screen: user type External is fine for a personal account. Under Audience, add your own address as a test user — skipping this is the most common reason consent fails.
- Credentials > Create credentials > OAuth client ID > Desktop app > Download JSON
- Save it as
~/.config/gdocs-mcp/credentials.json
Credentials live outside any repo on purpose, so git add -A can never commit them.
2. Authorise, once
npm run auth
Google warns that the app is unverified. Expected for an app with one user:
Advanced > Go to ... (unsafe). The refresh token lands in
~/.config/gdocs-mcp/token.json, mode 0600.
Restart Claude Code, then confirm with claude mcp list.
The 7-day re-auth, and why
While the consent screen sits in Testing, Google expires the refresh token
every 7 days. That is documented behaviour for external apps in testing, not a
bug, and there is no way around it for this scope set:
auth/drive is a restricted scope, and publishing to production with a
restricted scope requires a CASA security assessment — not worth it for a
one-person tool.
So roughly once a week a tool call will fail with "Authorisation expired". Fix:
npm run auth
Fifteen seconds. If you have a Google Workspace account, you can avoid it entirely: create the Cloud project under that organisation and set the consent screen user type to Internal. Internal apps have no 7-day expiry and no test user list.
Tools
| Tool | Effect |
|---|---|
find_doc |
Search Drive for Docs by title |
read_doc |
Body as Markdown + comment threads, each with its anchor text |
read_comments |
Comment threads only — the cheap "any new feedback?" check |
replace_text |
Exact find-and-replace in place; keeps comment anchors |
append_text |
Add a styled paragraph at the end (heading level, point size, colour, bold/italic); appends only, keeps anchors |
push_markdown |
Replace the whole body from a local file; requires confirm: true |
reply_comment |
Post a reply on a thread |
resolve_comment |
Resolve a thread with a closing note |
create_doc |
New Doc from a Markdown file — once per article |
All tools accept a Doc URL or a bare fileId.
The comment-anchor tradeoff
Google anchors each comment to a span of text. Rewrite that span and the thread detaches or auto-resolves. So:
- Small fixes →
replace_text. Anchors survive; reviewers keep their context. - Structural rewrites →
push_markdown. Faster, but expect thread loss. It reports how many open threads existed beforehand, so the damage is visible rather than silent. - Adding rather than changing →
append_text. It only ever inserts at the end, so no existing span moves and no anchor breaks. - Reply before you rewrite.
reply_commentleaves a record of what changed and why.
Why this and not an off-the-shelf server
An MCP server holding a Docs OAuth token can read and rewrite every document in the account. There is no first-party Google or Anthropic Docs MCP; every published one is a third-party package from an individual publisher. This is ~250 lines on Anthropic's MCP SDK and Google's own client library — small enough to read before you trust it.
Read-only mode
claude mcp remove gdocs -s user
claude mcp add gdocs -s user -e GDOCS_MCP_READONLY=1 -- node "$PWD/server.mjs"
Reads keep working; every write tool refuses. Useful when someone else owns the Doc.
Troubleshooting
| Symptom | Fix |
|---|---|
| "Not authorised yet" | Run npm run auth |
Error 403: access_denied, "has not completed the Google verification process" |
The signed-in address is not an approved tester. Add it under OAuth consent screen > Audience > Test users, save, retry |
| "Authorisation expired" after about a week | Expected in Testing mode. Run npm run auth |
accessNotConfigured |
Enable the Docs API and Drive API on this Cloud project |
| "no refresh token" | Revoke at https://myaccount.google.com/permissions, re-run npm run auth |
| Server missing in Claude Code | claude mcp list; re-run ./install.sh; restart Claude Code |
| Doc exports as plain text | The Doc has content Google can't render as Markdown; content is still returned |
Verify the server independently at any time with npm run smoke.
To exercise a single tool without going through Claude Code:
node call.mjs read_comments '{"doc":"https://docs.google.com/document/d/FILEID/edit"}'
Revoking access
https://myaccount.google.com/permissions, then delete ~/.config/gdocs-mcp/token.json.
Layout
server.mjs the nine tools
google.mjs auth + Drive/Docs clients; credential paths
auth.mjs one-time interactive OAuth (npm run auth)
smoke.mjs starts the server, lists tools (npm run smoke)
call.mjs invoke one tool from the shell, for debugging
install.sh deps, verify, register at user scope
docs/guide.html the setup walkthrough as a standalone page
License
MIT. See LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。