Google Chat MCP

io.github.A1-x-Tech由 GitHub 账号 A1-x-Tech 发布v1.1.2更新于 Nov 7, 2026

MCP server for the Google Chat API: spaces, messages, threads, reactions and memberships.

已验证STDIO仅桌面效率与工作流沟通与协作

概览

AI 生成的概览

面向 Google Chat API 的本地 MCP 服务器,让助手以登录用户身份读取空间与消息、在话题中回复、添加表情回应并管理成员。

可以做什么
  • 发现空间与已有私信,读取空间详情、话题模式和成员情况
  • 读取消息、单条消息、话题及附件元数据
  • 以用户本人身份发送、编辑和删除自己的消息,包括在话题中回复
  • 为消息添加、列出和移除表情回应
  • 列出空间成员,并在用户是空间管理员时添加、改角色或移除成员
  • 在对话中完成 OAuth 连接、查看授权状态、退出登录,或通过 raw_request 调用任意 Chat API v1 路径
适用场景
适合让助手跟进 Google Chat 会话、总结讨论结论、以你的名义起草并发送回复,或在聊天客户端内处理空间成员。不适用于 Gmail、Meet 或 Drive,也不支持消息文本搜索,因为 Chat API 本身不提供该能力。
运行要求
以 npm stdio 包在本地运行,需要 Node.js 20+ 和可访问 Google Chat 的 Google 账号。必须使用 OAuth 2.0,API 密钥不够。可在对话中连接(需启用 Chat API 的 Google Cloud 项目、Desktop 应用 OAuth 客户端 JSON,并在同一台机器上完成浏览器授权),或设置 GOOGLE_CHAT_CLIENT_ID、GOOGLE_CHAT_CLIENT_SECRET 与 GOOGLE_CHAT_REFRESH_TOKEN,或使用短期 GOOGLE_CHAT_ACCESS_TOKEN。可选:GOOGLE_CHAT_OAUTH_PORT、GOOGLE_CHAT_API_BASE、GOOGLE_CHAT_TIMEOUT_MS、GOOGLE_CHAT_MAX_RETRIES。
安装前请注意
它以你的 Google 账号身份操作:发送的消息显示为你的名字,delete_message 和移除成员不可撤销。写入在结果不确定时不会重试,重发前应先确认。GOOGLE_CHAT_CLIENT_SECRET 与 GOOGLE_CHAT_REFRESH_TOKEN 等同密码,客户端 JSON 应以文件路径传入而非粘贴到对话中。search_spaces 需要 Workspace 管理员权限,可检索你并非成员的空间。raw_request 可调用任意 Chat API 方法。匿名遥测默认开启,可用 ASKADS_TELEMETRY=0 关闭。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Google Chat MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[A1] Google Chat MCP

English | Русский

[npm] [Glama] [CI] [License: MIT]

A1 Google Chat MCP lets an AI app work in Google Chat in plain language. Find the right space or direct message, catch up on a conversation, reply in a thread, react with an emoji and manage who is in a space.

It uses the Google Chat API with your Google account and acts as the signed-in user: messages send under your name, and only your own messages and reactions can be edited or deleted. It makes the limits of the Chat API explicit instead of implying that every chat task is possible.

  • 20 tools. Connect from the chat, discover spaces and direct messages, read and send messages with thread control, manage emoji reactions, read attachment metadata and manage membership.
  • Connects from the conversation. Say "connect Google Chat": the server walks you through the OAuth client, catches Google's redirect on 127.0.0.1 with PKCE and keeps the tokens itself — no config files, no restart.
  • You act as yourself. Sends appear under your name; edits and deletes stop at your own messages and reactions.
  • A send is never replayed. After an ambiguous failure the server does not retry a write — a replayed send would be a duplicate message in a real room.
  • Minimal Google scopes. The server sends whatever token you minted; grant scopes per task — read-only ones are enough for browsing spaces and messages.

Start with a read-only question:

Show today’s messages in the team space and summarize what was decided.

Connect the server · Explore use cases · Open technical documentation


See it work in a minute

You: What was discussed in the release space today?

Assistant: Lists today’s messages with senders and threads. Nothing changes.

You: Reply in the deploy thread that the rollout is finished.

Assistant: Shows the target space, the thread and the drafted text, then asks for confirmation before sending.

You: Confirm.

Assistant: Sends the reply under your name in that thread. It does not touch any other message.

Contents

Quick start

You need Node.js 20+ and a Google account with access to Google Chat. Credentials are not required at install time — the server connects from the conversation.

  1. Add the server to your AI app.
  2. Say "connect Google Chat": the assistant walks you through creating the OAuth client and approving access without editing config files or restarting.
  3. Ask the read-only question above.
Codex

In the app: open Settings → MCP servers, select Add server, choose STDIO, enter the command npx -y mcp-google-chat@latest, then select Save. No environment variables are needed — connect from the chat afterwards.

From the command line:

bash
codex mcp add google-chat \  -- npx -y mcp-google-chat@latest
bash
codex mcp list

Codex MCP documentation

Claude Code
bash
claude mcp add \  --transport stdio --scope user google-chat \  -- npx -y mcp-google-chat@latest
bash
claude mcp list

Claude Code MCP documentation

Claude Desktop

The current official path is Settings → Extensions. For a custom desktop extension, open Advanced settings → Extension Developer → Install Extension…, select a .mcpb file and follow the prompts.

This repository currently publishes an npm stdio package and does not contain a .mcpb bundle. For Claude Desktop builds that still support local configuration, use the following JSON stdio configuration as a fallback:

json
{  "mcpServers": {    "google-chat": {      "command": "npx",      "args": ["-y", "mcp-google-chat@latest"]    }  }}

In those builds, save it to ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows.

Claude Desktop MCP documentation

Cursor

Add this to ~/.cursor/mcp.json on macOS/Linux or %USERPROFILE%\.cursor\mcp.json on Windows:

json
{  "mcpServers": {    "google-chat": {      "type": "stdio",      "command": "npx",      "args": ["-y", "mcp-google-chat@latest"]    }  }}

Cursor MCP documentation

VS Code

Run MCP: Open User Configuration and add:

json
{  "servers": {    "google-chat": {      "type": "stdio",      "command": "npx",      "args": ["-y", "mcp-google-chat@latest"]    }  }}

Check it with MCP: List Servers.

VS Code MCP documentation

What you can ask it to do

Catch up on a conversation

  • Show my spaces and find the direct message with [email protected].
  • What was posted in the release space today? Summarize the decisions.
  • Show the whole thread this message belongs to.

Post and maintain messages

  • Send a status update to the team space.
  • Reply in the deploy thread that the rollout is finished.
  • Fix the typo in my last message, or delete it entirely.

React and check attachments

  • Add a 👍 to the announcement and show who else reacted with what.
  • Remove my reaction from that message.
  • What files are attached to this message? Show their names and types.

Manage who is in a space

  • Who is in this space, and who are its managers?
  • Add [email protected] to the space and make them a manager.
  • Remove a former teammate from the space.

How the server acts in Chat

  1. With the OAuth refresh credentials the server acts as the signed-in user: messages send under your name, and edits and deletes reach only your own messages and reactions. Membership changes additionally require you to be a space manager.
  2. Spaces accept a bare id, but messages, threads, members, reactions and attachments are addressed by the full resource names the API returns — list first, then act on an exact name.
  3. A reply targets a thread by its name or by a thread key. By default a send falls back to starting a new thread when the target cannot be threaded; you can ask it to fail instead.
  4. Acting as a Chat app — cards, app direct messages, the dedicated attachment endpoint, forced deletes — is a separate Google Cloud configuration; the only bridge here is a service-account access token supplied as GOOGLE_CHAT_ACCESS_TOKEN.

The Chat API cannot search message text — the only message filters are creation time and thread. find_direct_message finds an existing DM but never creates one, and file bytes are not downloaded or uploaded through this server. Space creation and the other uncovered API methods go through raw_request.

What can change

OperationWhat happensConfirmation boundary
Read spaces, messages, members, reactions and attachment metadataReads conversations and metadataNo change
Send a messagePosts in a real space under your nameChanges a conversation
Update a messageReplaces the text of your own messageChanges a conversation
Add or remove a reactionChanges your own reaction on a messageChanges a conversation
Delete a messagePermanently removes a messageDestructive
Manage membershipAdds, re-roles or removes a space memberPotentially destructive
Raw API requestCan call API methods without a dedicated toolPotentially destructive

The AI client controls confirmation prompts. The server marks reads, writes and destructive tools so the client can distinguish catching up from posting.

Getting access

Google Chat requires OAuth 2.0; an API key is not enough. There are two ways in, and the first one needs no configuration files.

Connect from the chat (recommended)

Say "connect Google Chat" and the assistant runs the flow with you:

  1. setup_instructions prints the checklist: create or select a Google Cloud project, enable the Google Chat API, configure the consent screen and create a Desktop app OAuth client.
  2. Download that client's JSON ("Download JSON") and give the assistant its path — set_client stores it owner-only. The secret never goes through the conversation.
  3. start_login returns a Google consent link. Open it on this machine and approve; the code comes back to a one-shot listener on 127.0.0.1 (PKCE), never through the chat.
  4. finish_login exchanges the code, saves the tokens to ~/.config/mcp-google-chat/credentials.json (mode 0600) and verifies them with a real Chat API call — so a Chat API that is still switched off is caught right there, not on your first real question.

The tokens are re-read on every call, so the connection works immediately — no restart of the AI app. auth_status shows what is connected, logout revokes and deletes it. The login asks for chat.spaces.readonly, chat.messages, chat.messages.reactions and chat.memberships.readonly; the admin scope behind search_spaces is not requested — use the environment path if you need it.

Environment variables (CI, unattended installs)

  1. Create or select a Google Cloud project and enable Google Chat API.

  2. Configure the OAuth consent screen and create a Desktop app OAuth client.

  3. Authorize the Google account you chat as. The OAuth 2.0 Playground can obtain the refresh token when Use your own OAuth credentials is enabled.

  4. Request only the scopes your sessions need. For reading and sending, this is enough:

    text
    https://www.googleapis.com/auth/chat.spaces.readonlyhttps://www.googleapis.com/auth/chat.messages.readonlyhttps://www.googleapis.com/auth/chat.messages.create

    The full per-task table — editing and deleting your own messages, reactions, memberships, admin search — is in docs/TOOLS.md.

Testing-mode OAuth refresh tokens can expire after seven days. Publish the OAuth app, or use an Internal app in a Workspace domain, when you need long-lived access. Treat the client secret and refresh token as passwords.

For a quick session, a short-lived token in GOOGLE_CHAT_ACCESS_TOKEN also works — for example from gcloud auth print-access-token with Chat scopes granted. The same variable is how a service-account Chat-app token reaches the server when you need app-only features.

Configuration

Every variable is optional — with none of them the server connects from the chat.

VariableRequiredDescription
GOOGLE_CHAT_CLIENT_IDNo*OAuth client ID.
GOOGLE_CHAT_CLIENT_SECRETNo*OAuth client secret.
GOOGLE_CHAT_REFRESH_TOKENNo*OAuth refresh token.
GOOGLE_CHAT_ACCESS_TOKENNo*Short-lived alternative to the OAuth trio; can be a service-account or Chat-app token.
GOOGLE_CHAT_OAUTH_PORTNoFixed loopback port for the in-chat login; useful over SSH port forwarding.
GOOGLE_CHAT_API_BASENoGoogle Chat API base URL override.
GOOGLE_CHAT_TIMEOUT_MSNoPer-request timeout; default 60000 ms.
GOOGLE_CHAT_MAX_RETRIESNoTemporary-error retries; default 3.

* For the environment path, provide either the OAuth trio or an access token. When set, they win over a stored in-chat login and the server never refreshes or deletes them.

Started without any credentials, the server still completes the MCP handshake; the instructions and the first tool call then name both fixes — the in-chat login (no restart) and the environment variables (restart).

Data, limits and background work

  • Requests go to Google Chat. The local server refreshes Google OAuth tokens and calls the Chat API; the token is never sent to any other host. Its anonymous telemetry contains an installation ID, package version, AI client and platform versions, and tool names — never OAuth tokens, message content, tool arguments or prompts. For each tool call it also sends the outcome and, on failure, an excerpt of the error text with e-mails, addresses, tokens, numbers of 4+ digits and quoted text replaced by #; a value from your request can appear in it if the error text contains it. Set ASKADS_TELEMETRY=0 to opt out.
  • Google applies per-project and per-user quotas. On 429, the server uses backoff; reads also retry after network and 5xx errors, while writes are never replayed after an uncertain failure — a replayed send would be a duplicate message in a real room. send_message accepts a custom message id that makes a send addressable and deduplicable.
  • There is no background polling. The server runs only when called. list_messages can poll a space incrementally by creation time if your AI app supports scheduled tasks; space event subscriptions go through raw_request.

Technical documentation

Support

Found a bug or need a scenario? Create an issue or write in Telegram.


[Две Моны дают пять]

You made it to the end!

来源:README.md,提交 c6c071e

工具

20

auth_status

Google connection status

Shows whether this server is connected to Google: token presence and source (env variables or a stored in-chat login), expiry, the Google account email, granted vs missing OAuth scopes, where the credentials file lives and where the OAuth client comes from. Makes no network calls and never returns the token itself. Call it first when other tools report the server is not connected.

无需输入参数。

setup_instructions

Setup instructions

Step-by-step checklist for connecting this server to Google: creating a Google Cloud project and a Desktop-app OAuth client, publishing the consent screen (mandatory — Testing-mode refresh tokens die after 7 days), downloading the client JSON and handing its PATH to set_client. Works without any credentials; the checklist shortens to 'enable the API + log in' when an OAuth client is already configured (one client serves the whole mcp-google-* line). Never asks the user to paste secrets into the chat.

无需输入参数。

set_client

Save the OAuth client

Saves the OAuth client credentials from the JSON file downloaded from Google Cloud Console ('Download JSON' on a Desktop-app client). Pass the file PATH — the secret must never be pasted into the chat. The client is stored once in the shared ~/.config/mcp-google-auth/client.json (owner-only) and reused by every mcp-google-* server; tokens stay per-server. After this, call start_login.

输入参数path必填

start_login

Start the Google login

First step of connecting from the chat, without editing config files or restarting the client. Returns authorizeUrl — show it to the user as a clickable link and ask them to open it in the browser ON THIS MACHINE, pick the Google account and approve access. A one-shot listener on 127.0.0.1 catches Google's redirect; the code is exchanged locally and never passes through the chat. Does not open the browser itself. The attempt lives 10 minutes; when the browser shows the success page, call finish_login.

无需输入参数。

finish_login

Finish the Google login

Second step: waits up to 20 s for the browser consent to finish, saves the tokens to an owner-only file and verifies the login with a read-only identity call, returning the account email and the granted scopes. After success every tool works immediately — no client restart. If the user granted only part of the requested permissions, the login is still saved and missingScopes lists what will not work. Logging in under a different Google account replaces the previous login (its refresh token is revoked best-effort) and the response carries previousAccountEmail so the change never goes unnoticed.

无需输入参数。

logout

Disconnect from Google

Revokes the stored token at Google (oauth2.googleapis.com/revoke) and deletes the local credentials file. Tokens supplied via env variables are NOT touched — remove them from the MCP client config manually; envTokenStillSet in the response says whether any are still in effect.

无需输入参数。

list_spaces

List spaces

Lists the spaces the authenticated user is a member of: name (spaces/<id>), displayName (empty for direct messages), spaceType (SPACE = named room, GROUP_CHAT, DIRECT_MESSAGE), spaceThreadingState and timestamps. This is the discovery entry point — space names from here feed every other tool. space_type narrows the listing server-side; there is no text search here — match displayName client-side, or use search_spaces (Workspace admin only). Paginate with page_token from nextPageToken; results are unordered.

输入参数page_sizepage_tokenspace_type

get_space

Get a space

Returns one space's details: displayName, spaceType, spaceDetails (description/guidelines), spaceThreadingState (THREADED_MESSAGES = replies go into threads, otherwise the space is flat), membershipCount, createTime and settings. Use it to check the threading model before send_message with a thread, or to confirm a space id before writing into it.

输入参数space必填

search_spaces

Search spaces (admin)

Server-side search over ALL named spaces in the Workspace organization — including ones the caller is not a member of. ADMIN-ONLY: the call runs with useAdminAccess=true and requires a Google Workspace administrator authorized with the chat.admin.spaces or chat.admin.spaces.readonly scope; anyone else gets PERMISSION_DENIED — fall back to list_spaces and match displayName client-side. query uses the API's search syntax and MUST contain customer = "customers/my_customer" AND spaceType = "SPACE"; add displayName:"text" for name search, e.g. customer = "customers/my_customer" AND spaceType = "SPACE" AND displayName:"onboarding". order_by accepts membership_count.joined_direct_human_user_count, last_active_time or create_time with ASC/DESC.

输入参数query必填order_bypage_sizepage_token

find_direct_message

Find a direct-message space

Finds the EXISTING direct-message space between the authenticated user and another user, returning the space (name spaces/<id>) to send_message into. Returns HTTP 404 when no DM with that user exists yet — this tool cannot create one (creating DMs needs spaces.setup via raw_request). The user can be a Google user id (users/123...) or an email address.

输入参数user必填

list_messages

List messages

Lists messages in a space (including messages from blocked members and spaces): name, text, sender, createTime, thread.name, attachment metadata and emoji reaction summaries. Filters are the API's only two: created_after (createTime) and thread_name (one thread's messages) — there is no text search, match client-side. order defaults to ascending by createTime; show_deleted includes tombstones of deleted messages. Poll incrementally with created_after + page_token instead of re-listing history. Requires the chat.messages.readonly (or chat.messages) scope and works only with user authentication.

输入参数orderspace必填page_sizepage_tokenthread_nameshow_deletedcreated_after

get_message

Get a message

Fetches one message by its full resource name: text, formattedText, sender, createTime/lastUpdateTime, thread.name (reply target for send_message), attachment[] metadata (name, contentName, contentType, downloadUri, attachmentDataRef) and emojiReactionSummaries. Also resolves custom-id names (spaces/<space>/messages/client-<id>) for messages sent with message_id. Deleted messages return deletionMetadata instead of content.

输入参数message必填

send_message

Send a message

Sends a text message to a space AS THE AUTHENTICATED USER (their name and avatar; needs the chat.messages.create or chat.messages scope, and the user must be a member of the space). Text supports Chat markup: *bold*, _italic_, ~strike~, `code`, <https://url|link>, <users/123> mentions. Threads: pass thread_name (from a message's thread.name) or a stable thread_key of your choosing to reply in a thread; by default a missing thread falls back to starting a new one — set reply_option="or_fail" to error instead. In non-threaded spaces the thread params are ignored by the API. message_id (must start with "client-") makes the send addressable later without storing the returned name — reuse of an id fails with ALREADY_EXISTS, which also makes accidental duplicate sends detectable. Returns the created message with name, thread.name and createTime. A send is NEVER retried after a 5xx/timeout: check with list_messages before re-sending. Cards (cardsV2) are app-auth-only — out of scope; use raw_request with a Chat-app token.

输入参数text必填space必填message_idthread_keythread_namereply_option

update_message

Update a message

Replaces the text of an existing message (updateMask=text; the previous text is overwritten, not appended). With user authentication only the authenticated user's OWN messages can be edited — editing someone else's returns PERMISSION_DENIED, a Chat rule, not a missing scope. The message keeps its name and thread; lastUpdateTime is set and clients show an Edited marker. Updating cards or accessory widgets needs app auth via raw_request.

输入参数text必填message必填

delete_message

Delete a message

Permanently deletes a message. With user authentication the user can delete their OWN messages; space managers can also delete others' messages in spaces they manage — otherwise PERMISSION_DENIED (a Chat permission rule, not a missing scope). If the message started a thread that has replies, the delete fails with FAILED_PRECONDITION; force=true deletes the replies too but works only with app (service-account) authentication. Deletion cannot be undone — read the message with get_message first if its content matters. Returns an empty object on success.

输入参数forcemessage必填

manage_reactions

Manage message reactions

Emoji reactions on a message, as the authenticated user. action=add puts a unicode emoji (the emoji character itself, e.g. "👍" or "🎉" — not :shortcode:) on the message; adding the same emoji twice fails with ALREADY_EXISTS. action=list returns who reacted with what — each reaction's name (spaces/.../reactions/<id>), emoji and user; filter with emoji to one emoji's reactions. action=remove deletes ONE reaction by its full reaction_name from list — only the authenticated user's own reactions can be removed (someone else's returns PERMISSION_DENIED). Custom (workspace) emoji need raw_request with emoji.customEmoji. Scopes: chat.messages.reactions (add/remove; .create suffices for add-only) or chat.messages.reactions.readonly (list).

输入参数emojiaction必填messagepage_sizepage_tokenreaction_name

get_attachment

Get attachment metadata

Fetches metadata of one message attachment by its resource name (from a message's attachment[].name): contentName (filename), contentType (MIME), source (DRIVE_FILE or UPLOADED_CONTENT), downloadUri/thumbnailUri (short-lived, for a signed-in browser user — not for server-side download) and attachmentDataRef. NOTE the auth split: this dedicated endpoint accepts only APP (service-account) authentication — with user credentials it returns an error, but the SAME metadata is already embedded in get_message's attachment[] field, so user-auth flows should read it there. Downloading raw bytes goes through the media endpoint (v1/media/<resourceName>?alt=media) and uploading new attachments through the upload endpoint — both outside this server's tools.

输入参数attachment必填

list_members

List space members

Lists memberships in a space: each membership's name (spaces/<space>/members/<member> — the handle manage_members needs), member (users/<id>, displayName, type HUMAN|BOT), role (ROLE_MEMBER or ROLE_MANAGER) and state (JOINED, INVITED, NOT_A_MEMBER). role filters to managers or members; show_invited includes invited-but-not-joined users, show_groups includes Google Groups. Requires the chat.memberships.readonly (or chat.memberships) scope and membership in the space.

输入参数rolespace必填page_sizepage_tokenshow_groupsshow_invited

manage_members

Manage space membership

Membership management in a space — WORKS ONLY WITH SUFFICIENT ACCESS: the authenticated user needs the chat.memberships scope, and add/update_role/remove additionally require them to be a space MANAGER (otherwise PERMISSION_DENIED — a Chat role rule, not a network problem; check their role via list_members). action=get reads one membership by member_name. action=add invites/adds a human user (space + user, optional role=manager); in DMs and group chats members cannot be added. action=update_role switches a membership between member and manager (member_name + role). action=remove deletes the membership — the user is kicked from the space immediately and this is not undoable from here (re-add creates a fresh invitation). Google Groups and Chat-app memberships are managed via raw_request.

输入参数roleuserspaceaction必填member_name

raw_request

Raw Google Chat API call

Escape hatch to call any Google Chat API v1 path directly, for requests the typed tools don't cover — e.g. creating a space (path "v1/spaces", method POST, body {"spaceType":"SPACE","displayName":"..."}), setting up a DM ("v1/spaces:setup"), custom-emoji reactions, Google Group memberships, space events ("v1/spaces/<id>/spaceEvents"), or updating a space ("v1/spaces/<id>" PATCH with a query updateMask). The path may carry a query string (e.g. "v1/spaces/AAA/members?showInvited=true"). The Bearer token is added automatically; the method defaults to GET. Not for media: attachment upload/download use different endpoints (upload/v1, media/v1) that this server does not proxy.

输入参数bodypath必填method

版本历史

6
  1. v1.1.2最新Nov 5, 2026
  2. v1.1.1Oct 31, 2026
  3. v1.1.0Oct 31, 2026
  4. v1.0.0Sep 23, 2026
  5. v0.2.0Sep 21, 2026
  6. v0.1.0Sep 16, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分