Lightweight MCP Server for querying, reading, and modifying Google Drive documents and spreadsheets.
- Go to Google Cloud Console
- Create a new project
- Enable Google Drive API, Google Docs API, Google Sheets API
- Create OAuth 2.0 credentials (Desktop app type)
- Save your Client ID and Client Secret
Add to your Claude Desktop config:
{
"mcpServers": {
"google-docs": {
"command": "npx",
"args": ["-y", "mcp-google-docs"],
"env": {
"GOOGLE_CLIENT_ID": "your_client_id",
"GOOGLE_CLIENT_SECRET": "your_client_secret"
}
}
}
}Call auth_login tool, browser will open Google authorization page.
| Tool | Description |
|---|---|
auth_login |
OAuth login |
auth_status |
Check auth status |
gdrive_list |
List files |
gdrive_search |
Search files |
gdrive_info |
Get file info |
gdocs_read |
Read document |
gdocs_insert |
Insert text |
gdocs_append |
Append text |
gdocs_replace |
Find and replace |
gsheets_info |
Get spreadsheet info |
gsheets_read |
Read sheet |
gsheets_update |
Update cells |
gsheets_batch_update |
Batch update |
gsheets_append_row |
Append row |
gsheets_append_rows |
Append multiple rows at once |
gsheets_insert_rows |
Insert empty rows at position |
## Google Docs MCP Rules
### Workflow
1. Run auth_login first if not authenticated
2. Use gdrive_search or gdrive_list to find files
3. Use read/update tools to operate
### Required
- Always read before modifying
- Use batch_update for bulk operations
### Forbidden
- Never guess file IDs, always search first
- Never update more than 100 cells at once轻量级 MCP Server,支持查询、阅读、修改 Google Drive 中的文档和表格。
- 访问 Google Cloud Console
- 创建新项目
- 启用 Google Drive API、Google Docs API、Google Sheets API
- 创建 OAuth 2.0 凭据(桌面应用类型)
- 记录 Client ID 和 Client Secret
在 Claude Desktop 配置文件中添加:
{
"mcpServers": {
"google-docs": {
"command": "npx",
"args": ["-y", "mcp-google-docs"],
"env": {
"GOOGLE_CLIENT_ID": "your_client_id",
"GOOGLE_CLIENT_SECRET": "your_client_secret"
}
}
}
}调用 auth_login 工具,浏览器会弹出 Google 授权页面,授权后即可使用。
| 工具 | 说明 |
|---|---|
auth_login |
OAuth 授权登录 |
auth_status |
检查授权状态 |
gdrive_list |
列出文件 |
gdrive_search |
搜索文件 |
gdrive_info |
获取文件信息 |
gdocs_read |
读取文档 |
gdocs_insert |
插入文本 |
gdocs_append |
追加文本 |
gdocs_replace |
查找替换 |
gsheets_info |
获取表格信息 |
gsheets_read |
读取表格 |
gsheets_update |
更新单元格 |
gsheets_batch_update |
批量更新 |
gsheets_append_row |
追加行 |
gsheets_append_rows |
批量追加多行 |
gsheets_insert_rows |
在指定位置插入空行 |
## Google Docs MCP 使用规则
### 流程
1. 首次使用先调用 auth_login 授权
2. 用 gdrive_search 或 gdrive_list 找到目标文件
3. 用对应的 read/update 工具操作
### 强制
- 修改前必须先读取确认内容
- 批量操作使用 batch_update
### 禁止
- 不要猜测文件ID,必须先搜索
- 不要一次修改超过100个单元格MIT