google-chat-mcp
google-chat-mcp
用于 Google Chat 的 MCP 服务器。让 Claude(Code / Desktop)或任何 MCP 客户端列出你的空间、读取和搜索消息、拉取线程和成员,并且——可选——以你的身份发送消息。
默认只读。通过 stdio 在本地运行。刷新令牌以 0600 权限存储在 ~/.google-chat-mcp/ 下。
工具
工具 | 输入 | 说明 |
|
| 按最近活动排序。除非 |
|
| 最新优先。 |
|
| 客户端扫描;Chat API 没有全文搜索。默认窗口 14 天,每个空间 ≤500 条消息。 |
|
| 所有回复,最旧优先。 |
|
| 用户 + 角色,通过 People API 获取姓名/邮箱。 |
|
| 仅在 |
发送者姓名来自 People API 目录(directory.readonly)。如果该 API 被禁用或用户是外部用户,你会得到 users/<id>——其他一切仍然正常工作。
Related MCP server: A1 Google Chat MCP
设置
需要 Google Workspace 账户。消费者 @gmail.com 账户无法调用 Chat API(403)。
1. Google Cloud 项目(一次性,约 10 分钟)
console.cloud.google.com → 创建/选择项目。
APIs & Services → Library → 启用 Google Chat API 和 People API。
Google Chat API → Configuration 标签页 → 填写 App name、Avatar URL、Description;交互功能 关闭;对您的域可见。保存。
注意:在保存此表单之前,Chat API 会拒绝所有 OAuth 调用并返回
403,即使对于只读用户认证也是如此。OAuth consent screen → Internal → 添加范围:
https://www.googleapis.com/auth/chat.spaces.readonlyhttps://www.googleapis.com/auth/chat.messages.readonlyhttps://www.googleapis.com/auth/chat.memberships.readonlyhttps://www.googleapis.com/auth/directory.readonlyhttps://www.googleapis.com/auth/chat.messages.create(仅当您想要send_message时)
Credentials → Create credentials → OAuth client ID → Desktop app → 下载 JSON。将其保存在任何仓库之外。
2. 登录
export GOOGLE_CHAT_CLIENT_SECRET_PATH=/path/to/client_secret.json
npx google-chat-mcp login # browser opens → sign in with your Workspace account
npx google-chat-mcp whoami # sanity check3. 使用 Claude Code 注册
claude mcp add google-chat \
-e GOOGLE_CHAT_CLIENT_SECRET_PATH=/path/to/client_secret.json \
-- npx -y google-chat-mcpClaude Desktop(claude_desktop_config.json):
{
"mcpServers": {
"google-chat": {
"command": "npx",
"args": ["-y", "google-chat-mcp"],
"env": { "GOOGLE_CHAT_CLIENT_SECRET_PATH": "/path/to/client_secret.json" }
}
}
}环境
变量 | 默认值 | 用途 |
| — | 桌面 OAuth 客户端 JSON。在 macOS 上回退到 Keychain 项 |
|
| 刷新令牌缓存。 |
|
|
|
配额说明
Chat API:约 60 次请求/分钟/用户。空间和成员列表在进程内缓存 5 分钟;解析的用户名在磁盘上缓存于 ~/.google-chat-mcp/users.json。search_messages 是开销最大的操作——使用 spaces 和 since 限制范围。
开发
pnpm install
pnpm dev login
pnpm typecheck && pnpm lint && pnpm buildNode ≥ 22。TypeScript 严格模式,ESM,tsup 构建。
许可证
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Read email/chat conversations, messages, contacts and teams; draft, send and update threads.
Read Spruce Health contacts, conversations, messages, phone lines and team members (read-only).
Permissioned access to Gmail, Drive and Calendar via the user's own Google account
Chat where AI agents are first-class members, with their own identity and permissions.
Related MCP Servers
- -licenseNot gradedqualityDmaintenanceEnables AI assistants to read and send messages in Google Chat spaces using service account authentication.-
- AlicenseAqualityBmaintenanceEnables AI assistants to work in Google Chat through natural language: find spaces and direct messages, read and send messages, manage threads, reactions, attachments, and memberships while acting as the signed-in user.20140 npmMIT
- FlicenseAqualityCmaintenanceEnables LLM clients to send messages to Google Chat spaces, list spaces, and search message history.4-
- AlicenseNot gradedqualityAmaintenanceEnables reading, searching, and writing to Google Chat spaces, direct messages, and sidebar through MCP clients such as Claude Code and Claude Desktop.Apache 2.0