google-drive-cowork-mcp
Enables Claude to create and edit Google Docs, Sheets, and Slides via MCP, running locally with 22 tools.
README
google-drive-cowork-plugin
MCP server that lets Claude Cowork create and edit Google Docs, Sheets, and Slides. Runs as a local stdio process — no hosted backend.
What it does
22 tools exposed over the Model Context Protocol:
Google Docs (9 tools)
| Tool | Purpose |
|---|---|
create_google_doc |
Create a new doc (with dedup) |
get_google_doc |
Read structure or full text |
append_text |
Append text with optional heading style |
replace_text |
Global find/replace |
replace_section |
Rewrite one section by heading |
insert_heading |
Add a heading after a section or at end |
insert_table |
Insert a table with optional pre-fill data |
share_doc |
Share with email recipients |
move_doc |
Move to a Drive folder |
Google Sheets (7 tools)
| Tool | Purpose |
|---|---|
sheets_create |
Create a new spreadsheet |
sheets_get |
Read metadata, tabs, named ranges |
sheets_read |
Read cell values from a range |
sheets_write |
Write values (atomic batch) |
sheets_format |
Apply formatting via batchUpdate |
sheets_manage_tabs |
Add, rename, delete, freeze tabs |
sheets_create_chart |
Create embedded charts |
Google Slides (6 tools)
| Tool | Purpose |
|---|---|
slides_create |
Create a new presentation |
slides_get |
Read presentation structure |
slides_get_content |
Read text from a specific slide |
slides_add_slide |
Add slide with layout |
slides_update |
Apply batchUpdate requests |
slides_insert_image |
Insert image from URL |
Install
Two paths, same plugin. Pick the one that matches how you use Claude.
Path 1: Claude Code
claude plugin marketplace add https://github.com/sashakang/google-drive-cowork-plugin
claude plugin install google-drive-cowork-mcp
Then follow CONNECTORS.md to set up GCP credentials and authenticate.
Path 2: Cowork (via Claude Code)
Cowork can't install MCP plugins directly. Use Claude Code to set it up once, then Cowork picks it up on restart.
git clone https://github.com/sashakang/google-drive-cowork-plugin.git
cd google-drive-cowork-plugin
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
Then follow CONNECTORS.md to set up GCP credentials, authenticate, and add the MCP server to your Claude Desktop config. Restart Claude — the 22 tools will be available in Cowork.
Architecture
Claude Cowork / Claude Code
└─ MCP (stdio transport)
└─ python3 -m server.main
├─ Google Docs API v1 (document operations)
├─ Google Drive API v3 (folders, sharing)
├─ Google Sheets API v4 (spreadsheet operations)
└─ Google Slides API v1 (presentation operations)
All state lives in ~/.config/gdocs-mcp/:
| File | Purpose |
|---|---|
client_secret.json |
OAuth client (from GCP Console) |
credentials.json |
Refresh token (auto-generated) |
config.json |
Optional folder/domain allowlists |
audit.log |
Append-only JSONL operation log |
Safety
- Read-before-write — all write tools require a prior read call (server-enforced, 5 min window)
- Prompt injection mitigation — returned doc content is prefixed with a machine-readable warning banner
- Folder and domain allowlists — restrict where docs can be moved and who they can be shared with
- Create deduplication — same title within 30s returns the cached doc
- Typed errors with recovery hints — every error includes an LLM-actionable
recoveryfield - Audit trail — all operations logged to JSONL (no doc content stored)
- Timeout — 60s per tool call; returns a clear error on timeout
- Thread-safe caches — locking around all shared state
Optional: Docker
docker build -t gdocs-mcp .
docker run -v ~/.config/gdocs-mcp:/root/.config/gdocs-mcp gdocs-mcp
Configuration
Create ~/.config/gdocs-mcp/config.json to restrict operations:
{
"allowed_folder_ids": ["1ABC...xyz"],
"allowed_sharing_domains": ["yourcompany.com"]
}
Empty arrays (or no file) means allow all.
Troubleshooting
"Server disconnected" in Claude:
Check the MCP log at ~/Library/Logs/Claude/mcp-server-google-docs.log. Common causes:
- Wrong Python (must use venv): use the
bash -cconfig shown in CONNECTORS.md TypeError: Server.run() missing ... initialization_options: updatemcppackage in venv
"Credential scopes outdated":
The server needs 4 scopes (docs, drive, sheets, presentations). Re-run python3 -m server.auth --setup to re-authorize.
"redirect_uri_mismatch":
Your OAuth client must be a Desktop type (not Web). The redirect_uris should be ["http://localhost"].
"externally-managed-environment":
You're using Homebrew Python without a venv. Activate the venv first: source .venv/bin/activate.
Auth flow hangs / no browser opens: The auth command starts a local HTTP server and waits for a callback. If the browser didn't open automatically, copy the URL from the terminal and open it manually. You'll see "Waiting for browser authorization..." in the terminal while it waits.
Project structure
server/
main.py — MCP server, tool routing, dispatch
docs_api.py — Google Docs API client
drive_api.py — Google Drive API client
sheets_api.py — Google Sheets API client
slides_api.py — Google Slides API client
workspace_client.py — Base class for all API clients
auth.py — OAuth 2.0 credential management
config.py — Policy enforcement (allowlists, TTL cache)
errors.py — Typed exceptions + shared HTTP error handler
paths.py — Centralized path constants
tools/
docs.py — Docs tool definitions and dispatch
sheets.py — Sheets tool definitions and dispatch
slides.py — Slides tool definitions and dispatch
skills/
google-docs/SKILL.md — LLM skill definition
commands/
create-doc.md — /create-doc slash command
replace-section.md — /replace-section slash command
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。