26 连接 Google Drive、Calendar 和 Gmail
将 Google Drive、Calendar 和 Gmail 连接到 Claude Tag,使其可以读取文档、表格、日历事件和邮件。涵盖 OAuth 设置、服务账号选项以及各自授予的内容。
export const BetaNote = () => Claude Tag is in public beta. Features and behavior described here may change before general availability.;
连接在 Access bundle 中添加。在 claude.ai/admin-settings/claude-tag 打开左侧导航的 Access bundles,点击进入一个包(或 Create 一个),转到其 Credentials 标签。
连接 Google Drive、Calendar 和 Gmail 让 Claude 从包作用域下的任何频道读取文档、电子表格、日历事件和邮件。你将其作为连接添加到 Access bundle 中;凭据属于代理而非任何个人。
这是 HTTP API 连接,不是个人 claude.ai 连接器。成员的个人 Google 连接器仅在私信中生效。
26.1 选择 OAuth 或服务账号
连接选择器提供两种方式:
| 方式 | 何时使用 |
|---|---|
| OAuth(Connect 按钮) | 最快路径。管理员用有权访问 Claude 所需内容的 Google 账号登录。 |
| GCP 服务账号密钥 | 当你希望 Google 中有可审计访问的专用非人类身份,或需要跨 Workspace 的域级委派时。 |
两种方式都创建凭据和按路径限定到该 Google 服务的 allowed-websites 规则(Drive API 路径用于 Drive,Calendar API 路径用于 Calendar,Gmail API 路径用于 Gmail)。
26.2 通过 OAuth 添加连接
为此连接使用专用 Google 账号(例如 claude@yourcompany.example.com),不是你自己的。连接是共享的:在包作用域覆盖的频道中,任何人都可以要求 Claude 读取此账号在 Drive、Calendar 和 Gmail 中能看到的任何内容。专用账号在分享特定文件夹和日历给 Claude 之前没有访问权限,且其活动在 Google 审计日志中显示为独立身份。
在包中,点击 Google Drive、Google Calendar 或 Google Gmail 旁边的 Connect。出现 scope 清单,默认选中只读 scope。每个 scope 授予特定权限:
| Scope | 让 Claude 做什么 |
|---|---|
openid, userinfo.email |
标识连接的账号(默认选中) |
calendar.readonly |
读取事件和日历 |
calendar.events.readonly |
仅读取事件(比 calendar.readonly 更窄) |
calendar |
创建、编辑和删除事件 |
drive.readonly |
读取文件和文件夹 |
drive.file |
创建和编辑 Claude 自己创建的文件 |
gmail.readonly |
读取邮件 |
仅在 Claude 应创建或编辑时勾选写入 scope。点击 Sign in with Google Calendar(或 Sign in with Google Drive,或 Sign in with Google Gmail),批准 Google 同意屏幕,凭据即保存。
连接的可达范围是登录的 Google 账号能看到的全部内容。在测试前,在 Google 中与该账号共享相关的文件夹和日历。
26.3 通过服务账号添加连接
在包中,点击 Custom tool 旁边的 Connect,选择 GCP access token (with Service Account Key)。
| 字段 | 值 |
|---|---|
| GCP service account key (JSON) | 来自 Google Cloud Console 的 JSON 密钥文件 |
| Scopes (optional) | 要请求的 Google API scope(例如 https://www.googleapis.com/auth/drive.readonly)。字段标注为可选,但 Drive 和 Calendar 调用在缺少匹配 scope 时会失败。 |
| Subject (optional) | 通过域级委派模拟的用户邮箱。为 Workspace 数据(Drive、Calendar、Gmail、Docs)设置此项。 |
| Allowed websites | *.googleapis.com |
对于 Google Workspace 数据(Drive、Calendar、Gmail、Docs),服务账号需要在 Google Admin 控制台中配置域级委派及匹配的 API scope。Google 的指南在 developers.google.com/identity/protocols/oauth2/service-account。
Agent Proxy 在网络边界注入凭据;模型和沙箱不会获得密钥。参见 Agent Proxy 的工作原理。
26.4 验证连接
在包作用域下的频道中,开启新话题:
text wrap theme={null} @Claude what can you access from this channel?
连接生效后 Google Drive、Calendar 或 Gmail 出现在列表中。新话题会自动获取连接;在已有话题中,通过名称要求 Claude 使用该服务。
包中的凭据行在 Claude 首次使用连接前显示 Never used。该标签追踪使用情况而非健康状态,因此在有人执行它之前,正常工作的连接保持 Never used。要确认连接正常工作,在同一话题中要求 Claude 从该服务读取内容,如今天的日历事件或某个命名文档。标签在首次读取后更新。
26.5 相关资源
- 此连接增加的能力:基于团队文档的回答
- 为 Claude 配置访问:完整的凭据类型和允许主机参考