跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 Google Drive,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
摘要
让你的 AI 在 Google Drive 中工作:在“我的云端硬盘”和共享云端硬盘中搜索文件和文件夹,以文本形式读取 Google Docs、Sheets 和 Slides,查看详情、评论和有权访问的人,创建文件夹和文本文件(或用文本新建 Docs 和 Sheets),复制、重命名、移动、共享和移到回收站。支持个人 Google 账户和 Google Workspace。
试试这样问
Google Drive 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Google Drive、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Google Drive + Gemini
让你的 AI 在 Google Drive 中工作:在“我的云端硬盘”和共享云端硬盘中搜索文件和文件夹,以文本形式读取 Google Docs、Sheets 和 Slides,查看详情、评论和有权访问的人,创建文件夹和文本文件(或用文本新建 Docs 和 Sheets),复制、重命名、移动、共享和移到回收站。支持个人 Google 账户和 Google Workspace。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET
步骤 1 — 获取凭证
- 打开 console.cloud.google.com,选择或创建一个项目,然后进入 APIs & Services → Library 启用 Google Drive API。
- 打开 APIs & Services → OAuth consent screen。如果你使用 Google Workspace,选择 Internal(最简单),否则选择 External。选择 External 时,请把发布状态设为 In production:应用处于 Testing 状态时,Google 会在 7 天后撤销它的刷新令牌,连接器每周都会停止工作。如果只供你自己的账户使用,可以直接跳过“unverified app”警告继续。
- 打开 APIs & Services → Credentials → Create credentials → OAuth client ID,应用类型选择 Web application,并添加已授权的重定向 URI
https://cloud.anythingmcp.com/api/mcp-oauth/callback。如果你自行托管 AnythingMCP,请改填https://your-anythingmcp-host/api/mcp-oauth/callback。 - 把客户端 ID 填入
GOOGLE_CLIENT_ID,把客户端密钥填入GOOGLE_CLIENT_SECRET,然后安装连接器。 - 在连接器页面点击 Authorize with Provider,用 AI 要使用其 Drive 的 Google 账户登录。刷新令牌会加密存储,访问令牌会自动续期。
一个 Google 客户端服务所有 Google 连接器:同一个 Cloud 项目和 OAuth 客户端可以服务所有 Google 连接器:Gmail、Google Calendar、Google Drive、Google Sheets、Google Docs、Google Tasks、Search Console、Analytics 和 Ads。在该项目中启用每个 API,复用同一个客户端 ID 和密钥,并为每个连接器各授权一次。每个连接器只请求它自己需要的权限。
Google 验证:Google 把完整的 Drive 访问权限列为受限(restricted)权限。Internal 应用只供拥有该 Cloud 项目的 Workspace 组织内的账户使用,无需验证。供其他人使用的 External 应用会显示“Google hasn't verified this app”警告,并且在通过 Google 验证之前最多只能有 100 个用户;对于受限权限,验证还包括安全评估。如果只供你自己的账户使用,处于 In production 状态的 External 应用在跳过警告后即可使用。
读取文件:Google Docs、Sheets 和 Slides 会以文本形式读取(表格只读取第一个工作表;要读取任意范围请使用 Google Sheets 连接器)。PDF、Word 文档或图片等上传的文件无法通过这个连接器读取或下载,AI 会改为给你它们的链接。
权限:连接器请求 https://www.googleapis.com/auth/drive,因为搜索和读取不是它自己创建的文件需要完整的 Drive 访问权限。drive.file 等更窄的权限只能看到应用自己创建的文件。
只读设置:在连接器的 OAuth 设置中把 scope 改为 https://www.googleapis.com/auth/drive.readonly,重新授权,并停用 gdrive_create_folder、gdrive_create_text_file、gdrive_copy_file、gdrive_update_file、gdrive_share_file 和 gdrive_trash_file。
安装时默认关闭:gdrive_share_file 和 gdrive_trash_file。共享是有意关闭的:共享会让其他人访问你的文件,而 AI 读取的文档里可能含有要求它共享内容的文字。只有在 AI 确实需要时才打开某个工具。移到回收站的项目可在 30 天内从 Drive 回收站恢复,这个连接器不会永久删除任何文件。
常见错误:401 表示授权已过期或被撤销(同意屏幕处于 Testing 状态时,7 天后必然发生):请再次点击 Authorize with Provider。403 accessNotConfigured 表示 Cloud 项目中没有启用 Google Drive API。403 insufficientPermissions 表示 scope 不允许该调用(在只读设置下尝试写入);403 insufficientFilePermissions 表示你的账户无权修改该文件。404 notFound 表示 ID 错误,或此账户看不到该文件。
连接器不上传或下载二进制文件,从不永久删除,不能撤销任何人的访问权限,也不处理修订版本、标签或 Drive 活动记录。
步骤 2 — 安装 adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
步骤 3 — 在 Gemini 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
Gemini CLI 从 ~/.gemini/settings.json(Windows 上为 %USERPROFILE%\.gemini\settings.json)读取 MCP 服务器。添加:
{
"mcpServers": {
"anythingmcp": {
"httpUrl": "https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID",
"headers": { "X-API-Key": "YOUR_MCP_API_KEY" }
}
}
}
- 在 AnythingMCP 的 MCP Servers → 你的服务器 → API keys 中创建 MCP API 密钥,并用它替换
YOUR_MCP_API_KEY。 - 保存文件并重启
gemini。 - 在 Gemini CLI 中运行
/mcp(或在终端运行gemini mcp list),anythingmcp应显示为已连接。 - 开始输入提示,Gemini CLI 现在可以调用
Google Drive的工具。
可用工具
| Tool | What it does |
|---|---|
gdrive_about | Who is signed in and how much storage is used: user name, email and permissionId, storage limit and usage in bytes (Drive, Gmail and Photos… |
gdrive_search_files | Search or list files and folders in My Drive, files shared with the user and shared drives, with Drive's query language, e.g. "name… |
gdrive_get_file | Get one file's or folder's metadata: name, mimeType, parents, owners, last modifier, dates, size, webViewLink, what the user may do with it… |
gdrive_export_file | Read the content of a Google Doc, Sheet or Slides file as text: Docs as text/plain, text/markdown or text/html, Sheets as text/csv or… |
gdrive_create_folder | Create a folder, at the root of My Drive or inside the given parent folder or shared drive |
gdrive_create_text_file | Create a file from text in one call: a plain file (.txt, .md, .csv, .html, .json), or a Google Doc converted from plain text, Markdown or… |
gdrive_copy_file | Copy a file (not a folder), optionally with a new name and into other folders |
gdrive_update_file | Rename, move, describe or star a file or folder |
gdrive_trash_file | Move a file or folder to the trash (a folder takes its contents along) |
gdrive_list_permissions | List who has access to a file or folder: each permission's id, type (user, group, domain, anyone), role (owner, organizer, fileOrganizer… |
gdrive_share_file | Share a file or folder: give a person or group (type user/group + email_address), a whole domain (type domain + domain) or anyone with the… |
gdrive_list_comments | List the comments on a file (Docs, Sheets, Slides, PDFs...): author, text, the quoted passage, created and modified time, resolved state… |
gdrive_list_shared_drives | List the shared drives the user is a member of, with id and name |
示例提示
- “找出最近两周修改过的 Acme 项目相关文档,并总结它们的内容。”
- “谁有权访问“合同 2026”文件夹?”
- “新建一个“第四季度报告”文件夹,并把这份总结以 Google 文档的形式保存在里面。”
- “读取提案草稿上的评论,列出还没有解决的问题。”
FAQ
Gemini CLI 从哪里读取 MCP 服务器? 用户级配置位于 ~/.gemini/settings.json,项目级配置位于项目内的 .gemini/settings.json。gemini mcp list 会列出每个服务器及其连接状态。
下一步
这份指南对你有帮助吗?