Google Drive MCP 服务器
为 AI 模型提供与 Google Drive 集成的 Model Context Protocol (MCP) 服务器。
快速入门
前置条件
- 安装 Node.js(v16 或更高版本)
- 准备 Google Cloud 项目和 OAuth 凭证
设置步骤
- 创建 Google Cloud 项目并启用 Google Drive API。
- 配置 OAuth 同意屏幕,添加
https://www.googleapis.com/auth/drive.readonly
范围。 - 创建 OAuth 客户端 ID 并下载 JSON 凭证文件。
- 将凭证文件保存为
credentials/gcp-oauth.keys.json
。
安装与运行
# 克隆仓库
git clone https://github.com/felores/gdrive-mcp-server.git
cd gdrive-mcp-server
# 安装依赖
npm install
# 构建项目
npm run build
# 执行身份验证
node dist/index.js auth
完成身份验证后,启动服务器:
node dist/index.js
使用示例
- 搜索文件:调用
gdrive_search({ query: "关键词" })
- 读取文件:调用
gdrive_read_file({ file_id: "文件ID" })