摘要
让你的 AI 在 Google Drive 中工作:在“我的云端硬盘”和共享云端硬盘中搜索文件和文件夹,以文本形式读取 Google Docs、Sheets 和 Slides,查看详情、评论和有权访问的人,创建文件夹和文本文件(或用文本新建 Docs 和 Sheets),复制、重命名、移动、共享和移到回收站。支持个人 Google 账户和 Google Workspace。
引导式设置
2 分钟将 Google Drive 连接到 Microsoft Copilot
开始 AnythingMCP Cloud 免费试用,在引导式设置中连接 Google Drive,再把你的 MCP URL 添加到 Microsoft Copilot。无需代码,也无需自行运行服务器。
无需信用卡 · 7 天试用 · 提供自托管方案
试试这样问
Google Drive 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Google Drive、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Google Drive + Microsoft Copilot
让你的 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 — 在 Microsoft Copilot 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
Microsoft Copilot 通过在 Copilot Studio 中构建的智能体使用 MCP 服务器:把 AnythingMCP 作为工具添加到智能体,然后把智能体发布到 Microsoft 365 Copilot 和 Teams。Copilot Studio 从 Microsoft 的云端通过 Streamable HTTP 连接,AnythingMCP 支持这种方式。
- 在 Copilot Studio 中打开你的智能体(或新建一个),进入 Tools,选择 Add a tool → New tool → Model Context Protocol。
- 填写 Server name(例如
AnythingMCP)、说明连接器用途的 Server description,以及 Server URLhttps://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID。Copilot Studio 根据描述决定何时调用该服务器。 - 身份验证选择 API key,把 Type 设为 Header,请求头名称填
X-API-Key,然后选择 Create。 - 在 Add tool 中选择 Create a new connection,粘贴 AnythingMCP 的 MCP API 密钥(MCP Servers → 你的服务器 → API keys),然后选择 Add to agent。
- 在智能体的 Test 窗格中试一试:提出需要用到
Google Drive的工具的请求。 - 选择 Publish,然后进入 Channels → Microsoft 365 and Microsoft Teams,保持勾选 Make agent available in Microsoft Copilot,再选择 Add channel。See agent in Teams 会为你安装该智能体;在 Microsoft 365 Copilot 中输入 @ 并选择该智能体。
希望每个用户各自登录?请选择 OAuth 2.0 → Dynamic discovery 代替 API 密钥:每个用户会在智能体首次调用时登录 AnythingMCP。
自托管?请用你实例的公网 HTTPS 地址替换 https://cloud.anythingmcp.com。Copilot Studio 从 Microsoft 的云端连接,因此 localhost 无法使用。
可用工具
| 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
这适用于哪个 Copilot? 适用于工作中的 Microsoft 365 Copilot,通过 Copilot Studio 的智能体实现。面向个人账户的 Microsoft Copilot 应用无法添加自己的 MCP 服务器。
我需要什么? 一个可以使用 Copilot Studio 的工作账户(许可证或试用版),用于构建智能体。在 Microsoft 365 Copilot 或 Teams 中使用它的人需要拥有该智能体的访问权限:把它共享给他们,或请管理员为整个组织发布。如果你的组织对 Power Platform 连接器设置了数据策略,这些策略同样适用于 MCP 服务器。
智能体不调用工具。 检查请求头名称是否正好是 X-API-Key,密钥是否属于与 URL 相同的 MCP 服务器,并把 Server description 写得具体:Copilot Studio 根据它决定何时调用服务器。每次修改后重新发布智能体;在已打开的对话中输入 "start over" 即可使用新版本。
下一步
这份指南对你有帮助吗?