Skip to main content
Glama
ashrafur02-sys

drive-file-browser-mcp

Drive 文件浏览器 MCP

一个 Model Context Protocol (MCP) 服务器,让 AI 助手——Claude Desktop、Claude Code、Cursor、opencode 或任何 MCP 客户端——浏览、搜索和读取 Google Drive 文件夹中的文件

以两种模式运行:

提供的工具

工具

描述

list_files

列出 Drive 文件夹中的文件和子文件夹

search_files

按名称搜索文件(不区分大小写的子字符串)

get_file_info

获取特定文件的元数据(名称、类型、大小、时间戳)

read_file

读取文件内容 — Google Docs 导出为 markdown,Sheets 导出为 CSV,Slides 导出为纯文本;纯文本文件直接返回;二进制文件返回链接

Related MCP server: mcp-google-gdrive

远程部署 (Vercel)

服务器已上线:

https://drive-file-browser-mcp.vercel.app/api/mcp

它使用无状态的 Streamable HTTP 传输,因此适用于任何支持远程 HTTP 服务器的 MCP 客户端。该端点受 Bearer API 密钥保护。

连接客户端

Claude Desktop / Claude Code (claude_desktop_config.json.mcp.json):

{
  "mcpServers": {
    "drive-browser": {
      "type": "http",
      "url": "https://drive-file-browser-mcp.vercel.app/api/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_API_KEY>"
      }
    }
  }
}

任何 HTTP 客户端 — 通过 POST 发送 JSON-RPC,请求头为 Content-Type: application/jsonAccept: application/json, text/event-streamAuthorization: Bearer <YOUR_API_KEY>

curl -X POST https://drive-file-browser-mcp.vercel.app/api/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'

健康检查(无需认证):GET https://drive-file-browser-mcp.vercel.app/api/health

部署您自己的实例

  1. Fork/克隆此仓库,然后:

npm install
npm i -g vercel
vercel login
vercel link --yes
# env vars:
echo "<your-api-key>" | vercel env add MCP_API_KEY production
echo "<your-drive-folder-id>" | vercel env add DRIVE_ROOT_FOLDER_ID production
echo "<service-account-json-contents>" | vercel env add GOOGLE_SERVICE_ACCOUNT_JSON production
vercel deploy --prod --yes
  1. 获取 Google 服务账号 JSON(见下文),并使用其 client_email 共享您的 Drive 文件夹。

环境变量 (Vercel)

变量

描述

GOOGLE_SERVICE_ACCOUNT_JSON

完整的服务账号 JSON 密钥(内联字符串)— 必需,用于 Drive 访问

DRIVE_ROOT_FOLDER_ID

服务器浏览的默认文件夹 ID

MCP_API_KEY

/api/mcp 所需的 Bearer 令牌 — 留空以禁用认证(不推荐)

在 Vercel 仪表板中管理它们:项目 → 设置 → 环境变量。

本地设置 (stdio 模式)

1. 创建 Google 服务账号

  1. 前往 Google Cloud Console 并创建(或选择)一个项目。

  2. 启用 Google Drive API(API 和服务 → 库 → 搜索“Google Drive API” → 启用)。

  3. 前往 API 和服务 → 凭据 → 创建凭据 → 服务账号

  4. 打开服务账号 → 密钥 标签页 → 添加密钥 → 创建新密钥 → JSON。将下载一个 .json 密钥文件。

  5. 共享 Drive 文件夹 给服务账号的邮箱(在 JSON 文件中找到 client_email,形如 xxx@xxx.iam.gserviceaccount.com)— 在 Drive 中右键单击文件夹 → 共享 → 输入该邮箱 → 查看者。

2. 安装和构建

git clone https://github.com/ashrafur02-sys/drive-file-browser-mcp.git
cd drive-file-browser-mcp
npm install
npm run build

3. 配置

设置环境变量(或将 .env.example 复制为 .env — 注意:.env 文件不会自动加载;请在 MCP 客户端配置中设置真实的环境变量,或将 GOOGLE_SERVICE_ACCOUNT_JSON 指向文件路径):

变量

描述

GOOGLE_SERVICE_ACCOUNT_JSON

内联服务账号 JSON JSON 密钥文件的路径

DRIVE_ROOT_FOLDER_ID

服务器浏览的默认文件夹 ID(或完整 URL)

与 MCP 客户端一起使用

添加到您客户端的 MCP 配置中:

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "drive-browser": {
      "command": "node",
      "args": ["/absolute/path/to/drive-file-browser-mcp/dist/src/index.js"],
      "env": {
        "GOOGLE_SERVICE_ACCOUNT_JSON": "/absolute/path/to/service-account.json",
        "DRIVE_ROOT_FOLDER_ID": "1TG4ssc_z0FgG2snDapoR_SRu3y16Wxm5"
      }
    }
  }
}

Claude Code / opencode

{
  "mcpServers": {
    "drive-browser": {
      "type": "stdio",
      "command": "node",
      "args": ["/absolute/path/to/drive-file-browser-mcp/dist/src/index.js"],
      "env": {
        "GOOGLE_SERVICE_ACCOUNT_JSON": "/absolute/path/to/service-account.json",
        "DRIVE_ROOT_FOLDER_ID": "1TG4ssc_z0FgG2snDapoR_SRu3y16Wxm5"
      }
    }
  }
}

连接后,您可以向助手询问类似以下内容:

  • 列出 Drive 文件夹中的文件

  • 搜索新闻发布会演示文稿

  • 读取企业沟通文件

  • 获取 ID 为 ... 的文件信息

安全说明

  • 服务器使用 只读 Drive 范围(drive.readonly)。

  • 切勿提交您的服务账号密钥。默认情况下它已被 gitignore。

  • 您将密钥文件提供给任何人,他们就能读取服务账号可见的所有内容 — 请共享仓库,而不是您的密钥。

许可证

MIT

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables AI assistants to list, read, create, and manage files in Google Drive. It features automatic conversion of Google Workspace formats into Markdown, CSV, and plain text for seamless integration with AI workflows.
    35
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    A local MCP server that enables LLMs to securely search and read files within designated Google Drive folders. Supports Google Docs, Google Sheets, PDFs, and plain text with strict folder-scoping via service account authentication.
    4
    MIT

View all related MCP servers

Related MCP Connectors

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.

  • Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ashrafur02-sys/drive-file-browser-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server