使用说明
谷歌文档mcp Docker服务器
运行 @a-bonus/google-docs-mcp
Docker中的MCP服务器,并将其作为SSE端点公开,因此Claude.ai(或任何
MCP兼容客户端)可以连接到它。
堆栈: node:20-slim + @a-bonus/google-docs-mcp + supergateway (stdio→ SSE大桥)
先决条件
- Docker桌面正在运行
- Google Cloud项目 谷歌文档API, 谷歌网页API,以及 Google Drive API 启用,加上OAuth 2.0桌面客户端ID+密钥。 请参阅 上游README 获取分步说明。
node/npx在您的主机上可用(仅用于一次性身份验证步骤)。
设置
1.配置凭据
cp .env.example .env
# Edit .env and fill in GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET
2.授权(一次性,在主机上运行)
Auth打开您的浏览器以获取Google OAuth流,并将刷新令牌保存到
~/.config/google-docs-mcp/token.json。此目录已装载到
容器,所以你只需要做一次。
source .env
GOOGLE_CLIENT_ID="$GOOGLE_CLIENT_ID" \
GOOGLE_CLIENT_SECRET="$GOOGLE_CLIENT_SECRET" \
npx -y @a-bonus/google-docs-mcp auth
验证令牌是否已写入:
cat ~/.config/google-docs-mcp/token.json
3.塑造形象
docker compose build
4.启动服务器
docker compose up -d
SSE端点现在可在以下位置使用:
http://localhost:8080/sse
5.在Claude.ai中连接
Claude.ai要求远程MCP服务器使用HTTPS。使用 吸烟 要获取公共HTTPS隧道:
ngrok http 8080
# Use the https://xxxx.ngrok-free.app/sse URL in Claude.ai Settings → Integrations
有用的命令
# View logs
docker compose logs -f
# Stop the server
docker compose down
# Rebuild after a version bump
docker compose build --no-cache && docker compose up -d
# Re-authorise (delete old token first if needed)
rm ~/.config/google-docs-mcp/token.json
GOOGLE_CLIENT_ID="..." GOOGLE_CLIENT_SECRET="..." npx -y @a-bonus/google-docs-mcp auth
运作原理
Claude.ai ──SSE──► supergateway (port 8080) ──stdio──► google-docs-mcp
(inside Docker container)
supergateway 将基于stdio的MCP服务器桥接到HTTP/SSE端点。
OAuth令牌存储在您的主机上 ~/.config/google-docs-mcp/token.json
并以读写方式挂载,以便服务器可以自动刷新。
