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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.