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
- 其他文件以其原始格式提供
入门
- 创建新的 Google Cloud 项目
- 启用 Google Drive API
- 配置 OAuth 同意屏幕(“内部”适合测试)
- 添加 OAuth 范围
https://www.googleapis.com/auth/drive.readonly
,https://www.googleapis.com/auth/spreadsheets
- 为应用程序类型“桌面应用程序”创建 OAuth 客户端 ID
- 下载客户端 OAuth 密钥的 JSON 文件
- 将密钥文件重命名为
gcp-oauth.keys.json
并将其放入使用GDRIVE_CREDS_DIR
指定的路径(即/Users/username/.config/mcp-gdrive
) - 记下您的 OAuth 客户端 ID 和客户端密钥。它们必须与您的配置目录一起作为环境变量提供。
确保使用npm run build
或npm run watch
构建服务器。
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 drive-mcp:
验证
在向 Google API 发出请求之前,系统会提示您使用浏览器进行身份验证。您必须使用与您的 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.
该 MCP 服务器与 Google Drive 集成,允许列出、读取和搜索文件,以及读取和写入 Google Sheets 的能力。
Related MCP Servers
- -securityAlicense-qualityMCP server to interact with Google produts.Last updated -270PythonMIT License
- -securityAlicense-qualityThis MCP server integrates with Google Drive to allow listing, reading, and searching over files.Last updated -1,97152,814PythonMIT License
- -securityAlicense-qualityIntegrates with Google Drive to enable listing, searching, and reading files, plus reading and writing to Google Sheets.Last updated -9186TypeScriptMIT License
- -securityFlicense-qualityAn MCP server that monitors and provides analytics on weekly report submissions in a Google Sheet, allowing users to check missing submissions, view statistics, and track individual reporting status.Last updated -Python