gdrive-mcp

gdrive-mcp

A local, read-only MCP server for searching your Google Drive.

Category
访问服务器

README

gdrive-mcp

A local, read-only MCP server for searching your Google Drive.

Tools exposed:

Tool What it does
search_drive_by_name Fuzzy, typo-tolerant search over file/folder names (primary tool).
search_drive_by_content Full-text search inside file contents (Docs, PDFs, …).
list_drive_folder List the direct children of a folder by ID (root = My Drive).

It runs locally over stdio, authenticates once with your Google account via a browser, and caches the token in ~/.gdrive-mcp/token.json. The only Google scope requested is drive.readonly — it cannot modify or delete anything.

Fuzzy search note: Google Drive's API only supports substring matching, so this server pulls a candidate pool (substring matches + recent files) and re-ranks them client-side with Fuse.js for typo tolerance.


1. Provision the Google OAuth app (one time, ~5 min)

You need a Google Cloud project with the Drive API enabled and an OAuth client.

  1. Go to https://console.cloud.google.com/ and create a new project (e.g. "gdrive-mcp"). Select it.
  2. Enable the Drive API: APIs & Services → Library → search "Google Drive API" → Enable.
  3. Configure the OAuth consent screen: APIs & Services → OAuth consent screen.
    • User type: External (unless you're on Google Workspace and want Internal).
    • Fill in app name, your support email, developer email. Save.
    • Scopes: you can skip adding scopes here (the app requests drive.readonly at runtime).
    • Test users: add your own Google account (lio.lunesu@defang.io). While the app is in "Testing" status this is required, and the token works indefinitely for test users.
  4. Create credentials: APIs & Services → Credentials → Create CredentialsOAuth client ID.
    • Application type: Desktop app.
    • Name it, Create, then Download JSON.
  5. Save that file as ~/.gdrive-mcp/credentials.json:
    mkdir -p ~/.gdrive-mcp
    mv ~/Downloads/client_secret_*.json ~/.gdrive-mcp/credentials.json
    
    (Or put it anywhere and set GOOGLE_CREDENTIALS_PATH to its path.)

2. Build & log in

Node is provided by Nix + direnv — no system Node needed. From the project dir:

direnv allow          # first time only; loads node from flake.nix
npm install
npm run login         # builds, opens browser, caches token to ~/.gdrive-mcp/token.json

(Without direnv you can run anything via nix develop -c <cmd>, e.g. nix develop -c npm run login.)

A browser tab opens asking you to grant read-only Drive access. Approve it; the tab says "Authorized" and the token is saved. You only do this once (it auto-refreshes).

Google may warn the app is "unverified" since it's your own test app — click Advanced → Go to … (unsafe) to continue. That's expected for a personal app.


3. Register with your MCP client

Because Node comes from Nix/direnv (not your system PATH), launch the server with direnv exec so it picks up the flake's Node regardless of how the MCP client's own environment is set up.

Claude Code:

claude mcp add gdrive -- direnv exec /Users/llunesu/repos/gdrivemcp node /Users/llunesu/repos/gdrivemcp/dist/index.js

Claude Desktop / generic (claude_desktop_config.json or equivalent):

{
  "mcpServers": {
    "gdrive": {
      "command": "direnv",
      "args": [
        "exec",
        "/Users/llunesu/repos/gdrivemcp",
        "node",
        "/Users/llunesu/repos/gdrivemcp/dist/index.js"
      ]
    }
  }
}

(If you have a system Node and don't care about pinning, "command": "node" with just the script path also works.)

If you stored credentials somewhere other than ~/.gdrive-mcp/credentials.json, add "env": { "GOOGLE_CREDENTIALS_PATH": "/path/to/credentials.json" }.


Development

npm run dev     # tsc --watch
npm run build   # one-off compile to dist/

Notes & limits

  • Read-only by design — scope is drive.readonly, no write methods are called.
  • Searches My Drive for the signed-in user (not Shared Drives; flip includeItemsFromAllDrives/corpora in src/drive.ts if you need those).
  • Fuzzy search fetches up to ~500 candidate files per query to rank locally; for very large Drives you may want to tighten the caps in searchByName.
  • Reading/exporting file content is intentionally not included — these tools find and list files only.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选