Google Drive 服务器
该 MCP 服务器与 Google Drive 集成,允许列出、读取和搜索文件,以及读取和写入 Google Sheets 的能力。
该项目包含最初由 Anthropic、PBC 开发的代码,根据此 repo的 MIT 许可证获得许可。
成分
工具
gdrive_search
描述:在 Google Drive 中搜索文件。
输入:
query(字符串):搜索查询。pageToken(字符串,可选):下一页结果的令牌。pageSize(数字,可选):每页的结果数(最多 100)。
输出:返回匹配文件的文件名和 MIME 类型。
gdrive_read_file
描述:从 Google Drive 读取文件内容。
输入:
fileId(字符串):要读取的文件的 ID。
输出:返回指定文件的内容。
gsheets_read
描述:从 Google 电子表格中读取数据,并提供灵活的范围和格式选项。
输入:
spreadsheetId(字符串):要读取的电子表格的 ID。ranges(字符串数组,可选):可选的 A1 符号范围数组(例如,['Sheet1!A1:B10'])。如果未提供,则读取整个工作表。sheetId(数字,可选):需要读取的具体工作表 ID。如果未指定范围,则读取第一个工作表。
输出:从电子表格返回指定的数据。
gsheets_update_cell
描述:更新 Google 电子表格中的单元格值。
输入:
fileId(字符串):电子表格的 ID。range(字符串):A1 格式的单元格范围(例如,'Sheet1!A1')。value(字符串):新的单元格值。
输出:确认指定单元格中的更新值。
资源
该服务器提供对 Google Drive 文件的访问:
文件(
gdrive:///<file_id>)支持所有文件类型
Google Workspace 文件会自动导出:
文档 → Markdown
表格 → CSV
演示文稿 → 纯文本
图纸 → PNG
其他文件以其原始格式提供
入门
配置 OAuth 同意屏幕(“内部”适合测试)
添加 OAuth 范围
https://www.googleapis.com/auth/drive.readonly,https://www.googleapis.com/auth/spreadsheets为了允许与工作表和文档进行交互,您还需要在工作区的“启用 API 和服务”部分中启用Google Sheets API和Google Docs API 。
为应用程序类型“桌面应用程序”创建 OAuth 客户端 ID
下载客户端 OAuth 密钥的 JSON 文件
将密钥文件重命名为
gcp-oauth.keys.json并将其放入使用GDRIVE_CREDS_DIR指定的路径(即/Users/username/.config/mcp-gdrive)记下您的 OAuth 客户端 ID 和客户端密钥。它们必须与您的配置目录一起作为环境变量提供。
您还需要在项目中设置一个包含以下字段的 .env 文件。您可以在 Google Cloud Console 的“凭据”部分找到客户端 ID 和客户端密钥。
确保使用npm run build或npm run watch构建服务器。
验证
接下来,您需要运行node ./dist/index.js来触发身份验证步骤
系统将提示您使用浏览器进行身份验证。您必须使用与您的 Google Cloud 项目位于同一组织的帐号进行身份验证。
您的 OAuth 令牌保存在GDRIVE_CREDS_DIR环境变量指定的目录中。

与桌面应用程序一起使用
要将此服务器与桌面应用程序集成,请将以下内容添加到应用程序的服务器配置中:
执照
此 MCP 服务器采用 MIT 许可证。这意味着您可以自由使用、修改和分发该软件,但须遵守 MIT 许可证的条款和条件。更多详情,请参阅项目仓库中的 LICENSE 文件。
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
与 Google Drive 集成,支持列出、搜索和读取文件,以及读取和写入 Google Sheets。
Related Resources
Related MCP Servers
- -security-license-qualityEnables integration with Google Drive for listing, reading, and searching over files, supporting various file types with automatic export for Google Workspace files.Last updated -63452MIT License
- -security-license-qualityIntegrates with Google Tasks to allow listing, reading, searching, creating, updating, and deleting tasks.Last updated -87MIT License
- -security-license-qualityIntegrates with Google Drive to enable listing, reading, and searching over files, with automatic export of Google Workspace documents to appropriate formats.Last updated -634
- -security-license-qualityThis MCP server integrates with Google Drive to allow listing, reading, and searching files, as well as the ability to read and write to Google Sheets.Last updated -1962MIT License
Appeared in Searches
- MCP server for reading and analyzing multi-sheet Google Spreadsheets
- A server for managing or integrating Excel with MCP systems
- Google Drive and MCP (possible topics: integration, management, or related tools)
- Excel Spreadsheet Software or Related Resources
- A platform for creating and editing documents online