google-drive-mcp

MCPAI代理

提供方 feamster

AI代理 stdio · 本地进程 OAuth 授权 社区 / 第三方 Claude DesktopClaudeZed
查看接入方式

This MCP server integrates Google Drive, Docs, and Sheets with Claude Code, enabling file search and management, document content editing, and spreadsheet data operations for automating cloud office workflows via natural language instructions.

一句话选型结论

按资料字段整理

google-drive-mcp 属于AI代理类 MCP 服务器,stdio · 本地进程,OAuth 授权,可直接接入 Claude Desktop、Claude、Zed,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类AI代理 传输方式stdio · 本地进程 鉴权OAuth 授权 部署方式本地部署
GitHub 星标 0 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

AI代理
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

Local Deployment MCP Server Google Drive Python Document Editing Spreadsheet Processing File Management Claude Code Office Automation Google API

支持客户端

适用场景

Local DeploymentMCP ServerGoogle Drive

安装与配置

stdio · 本地进程 OAuth 授权
客户端在本机拉起子进程,数据不出本机
python -m google_drive_mcp.server

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 python,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
给代理接外部能力

让代理在任务中途调用搜索、数据库等真实工具。

多步任务编排

把一串操作拆成步骤,由代理按顺序执行。

自动化重复流程

把固定流程交给代理跑,减少手工操作。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已适配 Claude Desktop、Claude、Zed,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 使用前要准备好OAuth 授权对应的凭据,并按最小权限配置。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在AI代理场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop、Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 不方便管理密钥或第三方授权的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
google-drive-mcp当前 未标注 stdio · 本地进程 本地部署 有 2026-11-07
Filesystem 560c4363 13 未标注 本地部署 无 2026-05-17
Server Everything (everything) 11 stdio · 本地进程 本地部署 有 2026-05-17
Time 7365cb6d 2 SSE · 服务端推送 远程部署 有 2026-05-18
Everything Claude Code 未标注 stdio · 本地进程 本地部署 有 2026-05-17
Openmemory 557e1585 未标注 stdio · 本地进程 本地部署 有 2026-05-17

服务器档案

AI代理
字段来自项目仓库与公开索引,中文说明由本站标注
提供方feamster上游标注的维护方 feamster
分类AI代理本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式OAuth 授权远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · python本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验2026-11-07上游最后核验时间

详细介绍

15.1 KB
来自项目仓库与上游目录的原文,未做删改

Google Drive MCP Server

A custom Model Context Protocol (MCP) server for Google Drive, Docs, and Sheets. Built for powerful document editing and file management with Claude Code.

Author: Nick Feamster

Quick setup / update (any Mac)

This server is installed and registered for Claude Code and Claude Desktop by
setup-mcp.sh in the dotfiles repo,
along with all the other MCP servers:```bash
cd ~/dotfiles && git pull && ./setup-mcp.sh


Then restart Claude Code and Claude Desktop. (More detail, including upgrading an older Mac: the
laptop-setup README.)
The script clones or pulls every server repo into
`~/src`, builds each environment from its `uv.lock`, writes the config, and checks that each server
starts. It's safe to re-run anytime.

After that, a plain `git pull` in this repo is enough: the server launches with `uv run --frozen`,
which installs any changed dependencies on the next start. Credentials live in `~/.mcp-auth`
(synced from Box with `unison mcp_auth`).

## Features

### Drive Operations
- List files with filtering and sorting
- Search files by content or name
- Get file metadata
- List documents and spreadsheets

### Document Operations
- Get full document structure and content
- Extract plain text from documents
- Create new documents
- Insert, append, and replace text
- Delete content ranges
- Apply text formatting (bold, italic, underline, font size/family)
- Batch update documents with custom requests

### Spreadsheet Operations
- Get spreadsheet metadata and structure
- Read cell values from ranges
- Update cell values
- Create new spreadsheets

## Prerequisites

- Python 3.10+
- Box Drive sync (for credential storage)
- A Google Cloud project with OAuth credentials
- Claude Code installed

## Architecture Overview

This MCP server uses a distributed credential storage approach:

1. **Code Repository** (`~/src/google-drive-mcp/`) - Cloned from GitHub
2. **Credentials Storage** (`~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/`) - OAuth credentials in Box (synced across machines)
3. **MCP Configuration** (`~/.claude/.mcp.json`) - Can be managed via dotfiles repo

This allows:
- Code updates via git pull
- Automatic credential sync via Box
- Easy setup on new machines

## Google Cloud Setup (One-time)

### 1. Create Google Cloud Project

1. Go to Google Cloud Console
2. Create a new project (or use existing)
3. Enable the following APIs:
    - Google Docs API
    - Google Drive API
    - Google Sheets API

### 2. Configure OAuth Consent Screen

1. Go to "APIs & Services" → "OAuth consent screen"
2. Choose "External" user type
3. Fill in required app info:
    - App name: "Google Drive MCP"
    - Support email: your email
4. Add scopes:
    - `https://www.googleapis.com/auth/documents`
    - `https://www.googleapis.com/auth/drive`
    - `https://www.googleapis.com/auth/spreadsheets`
    - `https://www.googleapis.com/auth/script.external_request`
5. Add your email as a **Test User** (important!)
6. Save and continue
7. Click **Publish app** on the Audience page. If you
   skip this, the app stays in Testing and Google expires your token every 7 days. See
   runbook/token-expired.md.

### 3. Create OAuth 2.0 Credentials

1. Go to "APIs & Services" → "Credentials"
2. Click "Create Credentials" → "OAuth 2.0 Client ID"
3. Application type: **Desktop app**
4. Name it (e.g., "Google Drive MCP Client")
5. Click "Create"
6. Save the **Client ID** and **Client Secret**

## Two Google accounts

The same server runs once per account. The default token (`tokens/token.json`) is
feamster@gmail.com. `GOOGLE_DRIVE_ACCOUNT=` selects `tokens/token-.json`
instead; `uchicago` is feamster@uchicago.edu, which owns the course documents.```bash
GOOGLE_DRIVE_ACCOUNT=uchicago uv run python -m google_drive_mcp.auth   # sign in once, as feamster@uchicago.edu
claude mcp add -s user google-drive-uchicago -e GOOGLE_DRIVE_ACCOUNT=uchicago -- \
    /opt/homebrew/bin/uv run --frozen -q --directory ~/src/google-drive-mcp python -m google_drive_mcp.server

Claude Code then has google-drive (gmail) and google-drive-uchicago. Course documents
owned by the UChicago account are also shared with feamster@gmail.com as editor, so either
server can edit them.

Credentials Storage in Box

All OAuth credentials are stored in Box for automatic sync across machines.

Directory Structure```

~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/
├── credentials.json # OAuth Client ID and Secret
└── tokens/
└── token.json # OAuth refresh token (auto-generated)


### Create credentials.json

Create the file in Box with your OAuth credentials:```bash
# Create directory structure
mkdir -p ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/tokens

# Create credentials.json (replace with your actual credentials from Google Cloud Console)
cat > ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/credentials.json <<'EOF'
{
  "client_id": "YOUR_CLIENT_ID.apps.googleusercontent.com",
  "client_secret": "YOUR_CLIENT_SECRET"
}
EOF

Important: The credentials.json file contains the OAuth Client ID and Secret from your Google Cloud project. These are the same credentials used across all your machines.

Installation

First Machine Setup

  1. Clone the repository:```bash
    cd ~/src
    git clone https://github.com/feamster/google-drive-mcp.git
    cd google-drive-mcp

2. **Install the package:**```bash
python3 -m pip install -e .
  1. Verify Box credentials exist:```bash
    ls -la ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/

Should show: credentials.json and tokens/ directory


4. **Run authentication:**```bash
python3 -m google_drive_mcp.auth

This will:
- Open a browser for Google authorization
- Ask you to sign in and grant permissions
- Save the refresh token to Box at ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/tokens/token.json

  1. Configure Claude Code:

Add to ~/.claude/.mcp.json:```json
{
"mcpServers": {
"google-drive": {
"command": "python",
"args": ["-m", "google_drive_mcp.server"],
"cwd": "/Users/YOUR_USERNAME/src/google-drive-mcp"
}
}
}


**Note:** If you manage `.mcp.json` via a dotfiles repo, add this configuration there instead.

6. **Restart Claude Code**

### New Machine Setup

When setting up on a new machine (assuming Box is already synced):

1. **Clone the repository:**```bash
cd ~/src
git clone https://github.com/feamster/google-drive-mcp.git
cd google-drive-mcp
  1. Install the package:```bash
    python3 -m pip install -e .

3. **Verify Box is synced with credentials:**```bash
ls -la ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/
# Should show: credentials.json and tokens/token.json

If the token exists in Box, you're done! The server will use it automatically.

If the token is missing (first-time Box sync), run authentication:```bash
python3 -m google_drive_mcp.auth


4. **Configure Claude Code** (if not using dotfiles):

Add to `~/.claude/.mcp.json` (adjust username):```json
{
  "mcpServers": {
    "google-drive": {
      "command": "python",
      "args": ["-m", "google_drive_mcp.server"],
      "cwd": "/Users/YOUR_USERNAME/src/google-drive-mcp"
    }
  }
}
  1. Restart Claude Code

Testing

Test the server before using it with Claude Code:```bash
cd ~/src/google-drive-mcp
python3 test_server.py


This will:
- Initialize the DocsClient
- List your recent Google Docs and Sheets
- Read content from your first document
- Verify all capabilities are working

Expected output:```
Testing Google Drive MCP Server
==================================================

1. Initializing DocsClient...
   ✓ Client initialized successfully

2. Listing recent Google Docs...
   ✓ Found 5 documents
   ...

All tests passed! ✓

Available Tools (18 total)

Drive Tools (5)

  • list_files(query?, maxResults?, orderBy?) - List files with optional filtering and sorting
  • list_documents(maxResults?) - List Google Docs documents
  • list_spreadsheets(maxResults?) - List Google Sheets spreadsheets
  • search_files(searchTerm, maxResults?) - Search for files by name or content
  • get_file_metadata(fileId) - Get metadata for a specific file

Document Tools (9)

  • get_document(documentId) - Get full document structure and content
  • get_document_text(documentId) - Get plain text content from a document
  • create_document(title) - Create a new Google Docs document
  • insert_text(documentId, text, index?) - Insert text at a specific index
  • append_text(documentId, text) - Append text to the end of a document
  • replace_all_text(documentId, findText, replaceText, matchCase?) - Replace all occurrences of text
  • delete_content_range(documentId, startIndex, endIndex) - Delete content in a specific range
  • format_text(documentId, startIndex, endIndex, bold?, italic?, underline?, fontSize?, fontFamily?) - Apply formatting to a text range
  • batch_update_document(documentId, requests) - Execute batch updates (advanced - requires knowledge of Docs API)

Spreadsheet Tools (4)

  • get_spreadsheet(spreadsheetId) - Get spreadsheet metadata and structure
  • get_sheet_values(spreadsheetId, range) - Get values from a spreadsheet range (A1 notation)
  • update_sheet_values(spreadsheetId, range, values) - Update values in a spreadsheet range
  • create_spreadsheet(title) - Create a new Google Sheets spreadsheet

Usage Examples

List Recent Documents```

Claude: "List my 10 most recent Google Docs"


### Read a Document```
Claude: "Read the content of document ID 1Bdjo1UJSoxUMyr__zaaNU8Dgmlkmtoq3tRCdGcQLM0k"

Edit a Document```

Claude: "In document 1Bdjo1UJSoxUMyr__zaaNU8Dgmlkmtoq3tRCdGcQLM0k, replace all instances of 'old text' with 'new text'"


### Format Text```
Claude: "Make the first paragraph of document XYZ bold and increase font size to 14pt"

Create a New Document```

Claude: "Create a new Google Doc titled 'Meeting Notes' and add an agenda with 3 bullet points"


### Work with Spreadsheets```
Claude: "Read cells A1:D10 from spreadsheet 1IkXxxTBw7onokE0ZEH4RAVrFZBQQOtOEb2F9U6xZ_DE"
Claude: "Update cell A1 in that spreadsheet to say 'Total Revenue'"

Development

Project Structure```

google-drive-mcp/
├── google_drive_mcp/
│ ├── init.py # Package initialization
│ ├── auth.py # OAuth2 authentication with Box integration
│ ├── docs_client.py # Google API client (Drive, Docs, Sheets)
│ └── server.py # MCP server implementation
├── test_server.py # Testing script
├── setup.py # Package setup
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
└── README.md # This file


### Adding New Features

The client (`docs_client.py`) can be extended with additional Google API methods. The server (`server.py`) exposes these as MCP tools.

**Steps to add a new tool:**

1. Add method to `DocsClient` class in `google_drive_mcp/docs_client.py`:```python
def my_new_feature(self, document_id: str, param: str) -> Dict[str, Any]:
    """Description of what this does."""
    # Implementation using Google API
    ...
  1. Add tool definition to TOOLS list in google_drive_mcp/server.py:```python
    Tool(
    name="my_new_feature",
    description="Brief description for Claude",
    inputSchema={
    "type": "object",
    "properties": {
    "documentId": {"type": "string", "description": "Document ID"},
    "param": {"type": "string", "description": "Parameter description"}
    },
    "required": ["documentId", "param"]
    }
    )

3. Add handler in `call_tool()` function in `google_drive_mcp/server.py`:```python
elif name == "my_new_feature":
    result = docs.my_new_feature(
        document_id=arguments["documentId"],
        param=arguments["param"]
    )
    return [TextContent(type="text", text=json.dumps(result, indent=2))]
  1. Test and commit:```bash
    python3 test_server.py # Verify it works
    git add .
    git commit -m "Add my_new_feature capability"
    git push

### Planned Features

Features to add (based on comparison with other MCP servers):

**Priority 1:**
- [ ] Comments system (list, create, reply, resolve, delete)
- [ ] Image insertion (from URLs or files)
- [ ] Tables and page breaks
- [ ] Advanced text formatting (colors, links, alignment, spacing)
- [ ] File management (move, copy, rename, delete, folders)

**Priority 2:**
- [ ] Markdown conversion and round-trip
- [ ] Sheets formatting (cell colors, alignment, freeze panes, dropdowns)
- [ ] Template support
- [ ] Multi-tab document support

## Troubleshooting

### Authentication Issues

**Problem:** Server stops loading with `invalid_grant: Token has been expired or revoked`

**Solution:** See runbook/token-expired.md. In short: run
`uv run python -m google_drive_mcp.auth`, then reconnect the server. If the app's consent screen is
still in **Testing**, Google expires the token every 7 days. Publishing the app stops that.

**Problem:** "No valid credentials found"

**Solution:**
1. Verify Box is synced: `ls ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/`
2. Check credentials.json exists and is valid JSON
3. Ensure your email is listed as a Test User in OAuth consent screen
4. Verify all required APIs are enabled in Google Cloud Console
5. Re-run authentication: `python3 -m google_drive_mcp.auth`

### Token Not Found```bash
# Verify Box is synced
ls ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/tokens/

# Check token contents (should have refresh_token)
cat ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/tokens/token.json

# Re-authenticate if needed
python3 -m google_drive_mcp.auth

MCP Server Not Loading

  1. Check Claude Code logs for errors
  2. Verify the cwd path in .mcp.json matches your username:bash whoami # Check your username cat ~/.claude/.mcp.json | grep google-drive
  3. Test the server manually:bash cd ~/src/google-drive-mcp python3 -m google_drive_mcp.server # Should start without errors (use Ctrl+C to exit)
  4. Verify package is installed:bash python3 -c "import google_drive_mcp; print(google_drive_mcp.__version__)" # Should print: 0.1.0

Box Sync Issues

Problem: Credentials or tokens not syncing

Solution:
1. Verify Box is running and synced
2. Check Box preferences for selective sync settings
3. Manually verify file exists on Box.com web interface
4. Force sync by touching the file: touch ~/Library/CloudStorage/Box-Box/mcp-auth/google-drive-mcp/tokens/token.json

Dotfiles Repo Integration

If you manage your Claude Code configuration via a dotfiles repo:

  1. Add .mcp.json to your dotfiles repo
  2. Symlink it: ln -s ~/dotfiles/.claude/.mcp.json ~/.claude/.mcp.json
  3. Commit and push the configuration
  4. On new machines, your dotfiles setup script should handle the symlink

Resources

  • Google Docs API Reference
  • Google Drive API Reference
  • Google Sheets API Reference
  • Claude Code MCP Documentation
  • Google Cloud Console
  • MCP Protocol Specification

License

MIT

Support

For issues or questions:
1. Check the Troubleshooting section above
2. Review Google API documentation
3. Test with test_server.py to isolate the problem
4. Check Claude Code logs for detailed error messages

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
google-drive-mcp 怎么安装?

在客户端按下面的安装命令接入:python -m google_drive_mcp.server。装完在客户端配置里引用同一个包或端点。

google-drive-mcp 怎么在 Claude Desktop、Claude、Zed 里配置?

它的传输方式是stdio · 本地进程,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

google-drive-mcp 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

google-drive-mcp 需要 API Key 吗?

资料标注需要OAuth 授权认证,使用前准备好对应凭据,并按最小权限配置。

google-drive-mcp 支持哪些客户端?

资料标注支持 Claude Desktop、Claude、Zed;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

google-drive-mcp 能提供哪些能力?

资料显示能力标签包括 Local Deployment、MCP Server、Google Drive、Python、Document Editing、Spreadsheet Processing。具体工具清单以官方文档为准。

google-drive-mcp 需要什么运行环境?

运行时为 python;属于本地进程,需要在本机装好运行环境。

google-drive-mcp 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-11-07。