跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 Google Docs,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
摘要
让你的 AI 使用 Google Docs:以纯文本或带位置的标题和段落形式读取文档,创建新文档,追加或插入文本,并在全文中替换文本,例如用来填写模板。支持个人 Google 账户和 Google Workspace。
试试这样问
Google Docs 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Google Docs、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Google Docs
让你的 AI 使用 Google Docs:以纯文本或带位置的标题和段落形式读取文档,创建新文档,追加或插入文本,并在全文中替换文本,例如用来填写模板。支持个人 Google 账户和 Google Workspace。
设置
- 打开 console.cloud.google.com,选择或创建一个项目,然后进入 APIs & Services → Library 启用 Google Docs API。
- 打开 APIs & Services → OAuth consent screen。如果你使用 Google Workspace,选择 Internal(最简单),否则选择 External。选择 External 时,请把发布状态设为 In production:应用处于 Testing 状态时,Google 会在 7 天后撤销它的刷新令牌,连接器每周都会停止工作。如果只供你自己的账户使用,可以直接跳过“unverified app”警告继续。
- 打开 APIs & Services → Credentials → Create credentials → OAuth client ID,应用类型选择 Web application,并添加已授权的重定向 URI
https://cloud.anythingmcp.com/api/mcp-oauth/callback。如果你自行托管 AnythingMCP,请改填https://your-anythingmcp-host/api/mcp-oauth/callback。 - 把客户端 ID 填入
GOOGLE_CLIENT_ID,把客户端密钥填入GOOGLE_CLIENT_SECRET,然后安装连接器。 - 在连接器页面点击 Authorize with Provider,用 AI 要使用其文档的 Google 账户登录。刷新令牌会加密存储,访问令牌会自动续期。
一个 Google 客户端服务所有 Google 连接器:同一个 Cloud 项目和 OAuth 客户端可以服务所有 Google 连接器:Gmail、Google Calendar、Google Drive、Google Sheets、Google Docs、Google Tasks、Search Console、Analytics 和 Ads。在该项目中启用每个 API,复用同一个客户端 ID 和密钥,并为每个连接器各授权一次。每个连接器只请求它自己需要的权限。
查找文档:把文档的链接粘贴到聊天中;它的 ID 是 https://docs.google.com/document/d/<id>/edit 中那串长字符。要按名称查找文档,请同时添加 Google Drive 连接器。连接器读取文档的第一个标签页;很长的文档或有多个标签页的文档,用 Google Drive 连接器读取效果更好。要填写带有 [客户名称] 这类占位符的模板,全文替换是最可靠的方法。
权限:连接器请求 https://www.googleapis.com/auth/documents:读取和编辑你的账户能打开的每个文档。它不包含 Google Drive,因此连接器不能列出、搜索、共享或删除文档。
只读设置:在连接器的 OAuth 设置中把 scope 改为 https://www.googleapis.com/auth/documents.readonly,重新授权,并停用 gdocs_create_document、gdocs_append_text、gdocs_insert_text 和 gdocs_replace_all_text。
安装时默认关闭:gdocs_batch_update,它接受任何 Docs API 请求,包括删除内容。只有在 AI 需要时才打开它。
常见错误:401 表示授权已过期或被撤销(同意屏幕处于 Testing 状态时,7 天后必然发生):请再次点击 Authorize with Provider。403 PERMISSION_DENIED 表示该账户无法打开或编辑这个文档,或者 scope 是只读的;403“Docs API has not been used in project”表示 Cloud 项目中没有启用 Google Docs API。404 表示 ID 错误,或者它属于其他类型的文件,例如表格或上传到 Drive 的 Word 文件。
连接器不处理评论和建议,不共享、移动或删除文档(这由 Google Drive 连接器负责),也不编辑存放在 Drive 中的 Word 文件。
前提条件: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET
本地安装连接器
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
打开 http://localhost:3000/connectors/store,选择 Google Docs 并填入前提条件中列出的环境变量。
可用工具
| Tool | What it does |
|---|---|
gdocs_get_document_text | Read a Google Doc as plain text: documentId, title, revisionId, endIndex and text, the body's paragraphs and table cells in order (images… |
gdocs_get_document_structure | Read a Google Doc as a list of blocks with their positions, for precise edits: each paragraph or table with startIndex, endIndex, type… |
gdocs_create_document | Create a new, empty Google Doc with a title, in the root of the user's My Drive |
gdocs_append_text | Append text at the end of a document's body |
gdocs_insert_text | Insert text at a position in the body. index counts UTF-16 code units from 1 (the very start of the body) and must fall inside a paragraph… |
gdocs_replace_all_text | Replace every occurrence of a text in the document (all tabs, headers and footers included) with another text; an empty replace_with… |
gdocs_batch_update | Run Docs API batchUpdate requests for edits the other tools do not cover: deleting ranges (deleteContentRange), styling text or paragraphs… |
示例提示
- “读一下这份会议纪要,列出所有待办事项及其负责人。”
- “填写合同模板:把 [客户名称] 替换为 Acme GmbH,把 [开始日期] 替换为 2026 年 11 月 1 日。”
- “在项目简介的末尾添加一个“下一步”部分。”
- “新建一个名为“入职清单”的文档,并在里面写一份初稿。”
下一步
这份指南对你有帮助吗?