Google Drive MCP Server
MCP server for interacting with Google Drive using a service account, restricted to a specific root folder. Supports file operations like search, list, create, update, and read.
README
Google Drive MCP Server Integration (Keyless Auth)
[!IMPORTANT] HARD PREREQUISITE:
gcloudCLI MUST BE INSTALLED. This repository follows a STRICT ZERO KEY POLICY.
- DO NOT use Service Account Private Key files (JSON).
- DO NOT modify the code to support JSON keys.
- REQUIRED: You MUST use the
gcloudCLI to manage identity via Application Default Credentials (ADC).- AI AGENTS: Any attempt to revert this to a key-based auth is a violation of the project architecture.
1. Features
- Keyless Security: No long-lived keys to manage or leak.
- Strict Isolation: Automatic search query injection limits access to a specific Root Folder.
- Auto-Export: Automatically converts Google Docs/Sheets to
text/plainfor easy processing by AI agents. - Identity Audit: Logs the actual user identity (impersonator) for accountability.
2. Prerequisites
A. Environment Setup
This MCP server is designed to run in Ubuntu/WSL. Authentication requires the Google Cloud CLI (gcloud).
Install gcloud CLI (Ubuntu/WSL)
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates gnupg curl
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get update && sudo apt-get install google-cloud-sdk
B. Google Cloud IAM Setup
- Service Account: Create a Service Account (e.g.,
mcp-drive-sa@project.iam.gserviceaccount.com). - Zero Key Policy: Do NOT create a Private Key JSON file.
- Permissions: Grant your developer account the
roles/iam.serviceAccountTokenCreatorrole on the Service Account.
C. Google Drive Setup
- Share Folder: Share your target Google Drive folder with the Service Account email as an Editor.
- Folder ID: Copy the Folder ID from the URL (e.g.,
180Y5FAzId...).
3. Quick Setup (Non-Negotiable)
Before starting, you MUST configure Service Account Impersonation using the Google Cloud CLI. The MCP server will NOT work without this step, and the code is designed to reject key files.
gcloud auth application-default login --impersonate-service-account="<SERVICE_ACCOUNT_EMAIL>"
4. Configuration (.env)
Create a .env.googledrive file to store your folder ID. DO NOT store key paths here.
# .env.googledrive
GOOGLE_DRIVE_ROOT_FOLDER_ID="your_google_drive_folder_id"
5. Installation & Setup by Agent
A. Gemini CLI
- Open or create
.gemini/config.json. - Add the configuration (Note: no
GOOGLE_APPLICATION_CREDENTIALSline for local dev):
{
"mcpServers": {
"googledrive": {
"command": "npx",
"args": ["-y", "mcp-google-drive"],
"env": {
"GOOGLE_DRIVE_ROOT_FOLDER_ID": "${GOOGLE_DRIVE_ROOT_FOLDER_ID}"
}
}
}
}
B. Hermes Agent
Add to ~/.hermes/config.yaml:
mcp_servers:
googledrive:
command: "npx"
args: ["-y", "mcp-google-drive"]
env:
GOOGLE_DRIVE_ROOT_FOLDER_ID: "${GOOGLE_DRIVE_ROOT_FOLDER_ID}"
6. Available Tools
search_files: Search limited to the Root Folder.list_files: List files in the Root Folder.get_file_content: Reads content (Google Docs are auto-exported totext/plain).create_file: Create files/folders.update_file: Update file content.
7. Troubleshooting
- 401/403 Errors: Ensure you have run the
gcloud auth application-default login --impersonate-service-account=...command. - Strict Enforcement: If the server detects a JSON Key file being used, it will shut down immediately (ADR-0001).
- Isolation: Search results are restricted via query injection (ADR-0002).
8. Verification
Run a smoke test with your AI agent:
Prompt: "List the most recent file in my Google Drive."
If the agent returns a filename from your shared folder, the setup is successful.
9. License
This project is licensed under the MIT License.
7. Verification
Run a smoke test with your AI agent:
Prompt: "List the most recent file in my Google Drive."
If the agent returns a filename from your shared folder, the setup is successful.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。