Google Docs MCP Server
Provides tools to list, read, create, update, and delete Google Docs; manage tabs and comments; style text; find and replace; and convert Markdown or uploaded files into styled documents.
Provides tools for Drive file and folder operations, including listing files, searching folders, moving documents, trashing documents, and managing comments and metadata.
Provides tools to list, read, and create Google Slides presentations; add, delete, duplicate, and reorder slides; update and style slide text; manage speaker notes; delete shapes; and convert Markdown to slides.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Google Docs MCP Server
A Model Context Protocol (MCP) server that provides Google Docs and Google Slides read and write operations over stdio transport. Built with FastMCP, packaged as a hardened Podman container.
Features
33 tools for document and presentation lifecycle management: Docs (list, read, create, update, delete, comment, move, folder lookup, markdown-to-doc, file upload, markdown update, tab management, text styling, find-and-replace) and Slides (list, read, create, add/delete/bulk delete/duplicate/reorder slides, update text, text styling, delete shape, speaker notes, markdown-to-slides)
OAuth 2.0 authentication with scopes (
drive,drive.metadata.readonly,documents)Container hardening: read-only filesystem, all capabilities dropped, non-root execution, memory-limited
Two-step delete confirmation via server-side cryptographic nonce
Template-based styling for markdown conversion
Prompt injection mitigation on document reads
Related MCP server: gdoc MCP
Prerequisites
Podman (rootless mode recommended)
Google Cloud project with OAuth 2.0 Desktop credentials (setup instructions)
Claude Code or any MCP-compatible client
Quickstart
You need a credentials.json from Google Cloud Console before starting. See Google OAuth Setup if you don't have one yet.
# 1. Set up config directory and credentials
mkdir -p ~/.config/google-docs-mcp
cp /path/to/your/credentials.json ~/.config/google-docs-mcp/credentials.json
# 2. Authenticate (prints a URL, open it in your browser and grant access)
touch ~/.config/google-docs-mcp/tokens.json
podman run -it --rm -p 8080:8080 \
-v ~/.config/google-docs-mcp/tokens.json:/app/tokens.json:rw \
-v ~/.config/google-docs-mcp/credentials.json:/app/credentials.json:ro \
ghcr.io/ugiordan/google-docs-mcp-server:latest --authAdd to your Claude Code configuration (~/.claude.json):
{
"mcpServers": {
"google-docs": {
"command": "podman",
"args": [
"run", "-i", "--rm",
"--read-only", "--cap-drop=ALL",
"--security-opt=no-new-privileges", "--memory=256m",
"--mount", "type=tmpfs,destination=/tmp",
"-v", "${HOME}/.config/google-docs-mcp/tokens.json:/app/tokens.json:rw",
"-v", "${HOME}/.config/google-docs-mcp/templates.yaml:/app/templates.yaml:ro",
"-v", "${HOME}/.config/google-docs-mcp/credentials.json:/app/credentials.json:ro",
"-v", "${HOME}/uploads:/uploads:ro",
"ghcr.io/ugiordan/google-docs-mcp-server:latest"
]
}
}
}Restart Claude Code. The google-docs MCP server should appear with 33 available tools.
Building from source
If you prefer to build locally instead of using the published image:
git clone https://github.com/ugiordan/google-docs-mcp-server.git
cd google-docs-mcp-server
podman build -t google-docs-mcp:latest -f Containerfile .Then replace ghcr.io/ugiordan/google-docs-mcp-server:latest with localhost/google-docs-mcp:latest in the commands above.
Google OAuth Setup
1. Create a Google Cloud Project
Go to Google Cloud Console
Click the project dropdown at the top and select New Project
Enter a project name (e.g., "Google Docs MCP") and click Create
Make sure the new project is selected in the dropdown
2. Enable APIs
Navigate to APIs & Services > Library
Search for and enable each of these APIs:
Google Docs API: provides document content read/write
Google Drive API: provides file listing, metadata, move, trash, and comment operations
Google Slides API: provides presentation content read/write
3. Configure OAuth Consent Screen
Navigate to APIs & Services > OAuth consent screen
Select External user type (or Internal if using Google Workspace) and click Create
Fill in the required fields: app name, user support email, developer contact email
On the Scopes page, click Add or Remove Scopes and add:
https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.metadata.readonlyhttps://www.googleapis.com/auth/documents
On the Test users page, add your Google account email
Click Save and Continue through the remaining steps
Note: while the app is in "Testing" status, only test users you explicitly added can authenticate. This is fine for personal use. Publishing the app removes that restriction but requires Google verification.
4. Create OAuth 2.0 Client ID
Navigate to APIs & Services > Credentials
Click Create Credentials > OAuth 2.0 Client ID
Select Desktop app as the application type
Give it a name (e.g., "google-docs-mcp")
Click Create
Click Download JSON on the confirmation dialog
Save the file as
~/.config/google-docs-mcp/credentials.json
OAuth Scopes
The server requests three scopes during authentication:
Scope | Access granted |
| Full read/write/delete access to Google Drive files. Required for comment, move, and delete operations on any document. Also covers Google Slides API operations. |
| Read-only access to file metadata (names, IDs, timestamps, folder structure). Cannot read file content through this scope. |
| Read and write access to Google Docs document content and formatting. |
The drive scope grants access to all files in the user's Drive. Container hardening (read-only filesystem, dropped capabilities, non-root, memory limits) provides defense in depth.
Tools
Tool | Description | Parameters |
| List documents, optionally filtered by name query |
|
| Read document text content, comments, and all tabs |
|
| Create a new document |
|
| Append to or replace document content, optionally in a specific tab |
|
| Create a new tab in a document |
|
| Delete a tab from a document |
|
| Rename a tab in a document |
|
| Add a comment, optionally anchored to text |
|
| List all comments with replies, authors, and resolved status |
|
| Reply to an existing comment |
|
| Mark a comment as resolved |
|
| Delete a comment |
|
| Search for a Drive folder by name |
|
| Move a document to a different folder |
|
| Trash a document (two-step nonce confirmation) |
|
| Convert markdown to a styled document |
|
| Upload a file as a Google Doc with formatting preserved |
|
| Replace content of an existing Google Doc with styled markdown |
|
| Style text without replacing content |
|
| Find and replace text without losing comments |
|
Google Slides | ||
| List presentations, optionally filtered by name |
|
| Read all slide content: text, speaker notes, shape IDs, layout info |
|
| Create a new presentation, optionally from a template |
|
| Add a slide at a position with optional layout |
|
| Delete a slide (two-step nonce confirmation) |
|
| Delete multiple slides at once (two-step nonce confirmation) |
|
| Replace text in a shape, preserving font/size/color |
|
| Delete a shape, image, or element from a slide (two-step nonce confirmation) |
|
| Set speaker notes for a slide |
|
| Copy a slide within a presentation |
|
| Move slides to new positions |
|
| Style all text in a shape without replacing content |
|
| Convert markdown to a presentation (slides split on |
|
Delete confirmation
delete_document, delete_slide, delete_slides, and delete_shape require two calls. The first call returns a cryptographic nonce (valid for 30 seconds). The second call must include the nonce to confirm. Nonces are single-use, resource-specific, and stored in-memory. Documents are moved to trash, not permanently deleted. Slides and shapes are deleted immediately on confirmation.
Tabs
read_document returns all tabs when a document has multiple tabs. Each tab includes tab_id, title, and content. Use create_tab, delete_tab, and rename_tab to manage tabs. Use update_document with tab_id to write content to a specific tab.
update_document_markdown supports per-tab updates via the tab_id parameter. When tab_id is specified, it uses paragraph-level diffing to apply only the changes, preserving comment anchors on unchanged text. Without tab_id, it uploads a .docx file which replaces the entire document including all tabs.
Read output wrapping
read_document wraps returned content in <document-content> tags with an untrusted data warning. Tab content is wrapped in <tab-content> tags. This helps MCP clients distinguish document content from system instructions. Comments (with replies, authors, quoted text, and resolved status) are included when present. Comment fetching is best-effort and won't fail the read if unavailable.
Markdown conversion
convert_markdown_to_doc supports optional template-based styling. If templates are configured and no template_name is provided, the tool returns the list of available templates. Without any template configuration, documents are created with default Google Docs styling.
File upload
upload_document converts a file to a Google Doc, preserving formatting. Three modes:
file_path: path to a file mounted at/uploads/inside the container. Best for large files. Drop the file in~/uploads/on the host and pass/uploads/filename.docx. MIME type is detected from the extension.source_file_id: ID of a file already in Google Drive. The server copies and converts it. No file transfer through MCP at all.file_content_base64: base64-encoded file content. Only works for small files (.docx, .pdf, .html, .rtf) since large payloads get truncated by the LLM.
Provide exactly one of these. The MCP config mounts ~/uploads read-only into the container by default.
Styled markdown update
update_document_markdown replaces the content of an existing Google Doc with styled markdown. It reuses the same markdown parsing and template pipeline as convert_markdown_to_doc. When no template_name is specified, the document's existing named styles (heading fonts, body font, sizes, colors, line spacing) are preserved.
When called with a tab_id, the tool uses paragraph-level diffing to only modify changed content. Comments anchored to unchanged text are preserved. When called without tab_id, it uploads a .docx file replacement with best-effort comment save/restore (comments whose quoted text no longer exists in the new content may not be re-anchored).
Templates
Templates let you apply consistent styling when converting markdown to Google Docs and Slides. Create ~/.config/google-docs-mcp/templates.yaml:
templates:
- name: "standard"
doc_id: "1aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789ABC"
default: true
- name: "report"
doc_id: "2xYzAbCdEfGhIjKlMnOpQrStUvWx0123456789DEF"
slides_templates:
- name: "corporate"
presentation_id: "1aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789ABC"
default: trueDocs templates
The doc_id is the ID of a Google Doc whose named styles (heading fonts, body font, sizes, colors, line spacing) will be extracted and applied. Find it in the document URL: docs.google.com/document/d/{doc_id}/edit.
Styles copied: heading fonts (H1-H6), body text font, font sizes, line spacing, text colors. Not copied: complex layouts, columns, page breaks, headers/footers, Apps Script, macros.
Slides templates
The presentation_id is the ID of a Google Slides presentation that serves as the base for new presentations. Find it in the presentation URL: docs.google.com/presentation/d/{presentation_id}/edit.
When a slides template is configured, create_presentation and convert_markdown_to_slides will copy the template presentation (via Drive API files.copy) instead of creating a blank one. The copy inherits the template's theme, master slides, layouts, fonts, and colors. The template itself is never modified.
If a default template is set, it's used automatically. Pass template_name to pick a specific template. Without any slides template configuration, presentations are created blank.
If templates.yaml is missing or empty, all tools work normally with default styling.
Uploading Files
For large files that exceed MCP parameter limits, use --upload to upload directly to Google Drive, then reference the file ID with upload_document's source_file_id parameter.
# Upload and convert to Google Doc in one step
podman run -it --rm \
-v ~/.config/google-docs-mcp/tokens.json:/app/tokens.json:rw \
-v ~/.config/google-docs-mcp/credentials.json:/app/credentials.json:ro \
-v /path/to/file.docx:/tmp/file.docx:ro \
ghcr.io/ugiordan/google-docs-mcp-server:latest --upload /tmp/file.docx --convert
# Upload without conversion (keeps original format in Drive)
podman run -it --rm \
-v ~/.config/google-docs-mcp/tokens.json:/app/tokens.json:rw \
-v ~/.config/google-docs-mcp/credentials.json:/app/credentials.json:ro \
-v /path/to/file.docx:/tmp/file.docx:ro \
ghcr.io/ugiordan/google-docs-mcp-server:latest --upload /tmp/file.docx
# With custom title and folder
podman run -it --rm \
-v ~/.config/google-docs-mcp/tokens.json:/app/tokens.json:rw \
-v ~/.config/google-docs-mcp/credentials.json:/app/credentials.json:ro \
-v /path/to/file.docx:/tmp/file.docx:ro \
ghcr.io/ugiordan/google-docs-mcp-server:latest \
--upload /tmp/file.docx --title "My Document" --folder-id FOLDER_ID --convertThe command prints the file ID, which you can then use with the upload_document MCP tool's source_file_id parameter for further processing.
Supported formats for --convert: .docx, .pdf, .html, .htm, .rtf.
Token Management
# Re-authenticate
podman run -it --rm -p 8080:8080 \
-v ~/.config/google-docs-mcp/tokens.json:/app/tokens.json:rw \
-v ~/.config/google-docs-mcp/credentials.json:/app/credentials.json:ro \
ghcr.io/ugiordan/google-docs-mcp-server:latest --auth
# Revoke access and delete tokens
podman run -it --rm \
-v ~/.config/google-docs-mcp/tokens.json:/app/tokens.json:rw \
-v ~/.config/google-docs-mcp/credentials.json:/app/credentials.json:ro \
ghcr.io/ugiordan/google-docs-mcp-server:latest --revokeTokens are stored at ~/.config/google-docs-mcp/tokens.json with 0600 permissions. They refresh automatically on expiry.
Security
See SECURITY.md for the full security design, including threat model, container hardening rationale, and input validation strategy.
Summary of security measures:
Container: read-only filesystem,
--cap-drop=ALL,--security-opt=no-new-privileges,--memory=256m, non-root (UID 1001), tmpfs for/tmpAuthentication: token file permissions
0600, credentials mounted read-only, container hardening compensates for broaddrivescopeInput validation: document/folder ID regex validation, query sanitization, content size limits (1MB content, 5MB markdown), title/comment length limits
Prompt injection: document content wrapped in delimiter tags with untrusted data warning
Delete safety: server-side cryptographic nonce with 30s TTL, single-use, document-bound
Development
# Install dependencies
uv sync
# Run tests
uv run pytest -v
# Lint and format
uv run ruff check .
uv run black --check .
uv run bandit -r mcp_server/
# Run locally (set env vars for paths)
export GOOGLE_CREDENTIALS_PATH=/path/to/credentials.json
export GOOGLE_TOKEN_PATH=/path/to/tokens.json
export GOOGLE_TEMPLATES_PATH=/path/to/templates.yaml
uv run python main.py
uv run python main.py --auth # authenticate
uv run python main.py --revoke # revoke tokensLimitations
Non-atomic replace:
update_documentin replace mode deletes content then inserts new content viabatchUpdate. A mid-operation failure may leave partial content.Limited host filesystem access: the server runs in a container. File uploads are restricted to the
/uploads/mount point. Mount your upload directory in the MCP config:-v $HOME/uploads:/uploads:ro.In-memory nonces: delete nonces are lost on server restart. If the server restarts between the two delete steps, re-initiate the deletion.
Template style limits: only heading/body fonts, sizes, spacing, and colors are copied. Complex layouts (columns, page breaks, headers/footers) are not supported.
Comment restoration: full-document updates save and restore comments on a best-effort basis. Comments whose quoted text no longer exists in the new content cannot be re-anchored.
Comments have no tab association: the Google Docs Comments API does not return a
tabId. In multi-tab documents, comment-to-tab matching relies on quoted text comparison, which is unreliable if the same text appears in multiple tabs.
Troubleshooting
403 Forbidden on write operations: re-run --auth to refresh tokens. Ensure the Google account has edit access to the target document.
AUTH_REQUIRED error: re-run the --auth flow to obtain fresh tokens.
Container won't start: verify credentials.json and tokens.json exist at ~/.config/google-docs-mcp/. Run --auth if tokens are missing.
Template not found: check that templates.yaml exists, is valid YAML, and the template name matches exactly.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Google Docs MCP Pack — read, create, and edit Google Docs via OAuth. Reuses the google_sheets…
Online office suite for AI agents: edit docs, sheets, slides and PDFs in browser or via MCP.
Convert, create and edit Word, PowerPoint, Excel and PDF documents from any AI agent.
Hosted document tools for agents: extract, parse, classify, convert, OCR, sign, and redact.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides comprehensive interaction with Google Docs, featuring specialized support for document tabs, nested structures, and markdown conversion. It enables users to list, read, create, and perform complex batch updates on documents using Google service accounts.21 PyPI4MIT
- AlicenseBqualityAmaintenanceEnables interaction with Google Docs through typed MCP tools, supporting reading, writing, searching, and managing documents via OAuth integration.22MIT
- AlicenseNot gradedqualityCmaintenanceEnables reading, creating, and editing Google Docs via OAuth. Supports tools for retrieving, inserting, appending, and replacing text in documents.64 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables reading and editing Google Docs via the Docs API, including structure/outline retrieval, text export, section/range/table editing, text replacement, document creation, and raw batch updates, with dry-run previews before destructive changes.MIT