google-chat-mcp

google-chat-mcp

MCP server for Google Chat that enables managing spaces, messages, members, reactions, attachments, and GIFs through the Model Context Protocol.

Category
访问服务器

README

google-chat-mcp

MCP server for Google Chat — manage spaces, messages, members, reactions, attachments, and GIFs through the Model Context Protocol.

Features

  • 19 MCP tools covering the full Google Chat API
  • Spaces — list, get, create, update, delete
  • Messages — list (newest first), get, send, reply to threads, update, delete
  • Members — list, add, remove, get user info
  • Reactions — add, remove
  • Attachments — get metadata, upload files with messages
  • Two transports — stdio and HTTP/SSE
  • Automatic OAuth — browser-based flow, token caching + auto-refresh
  • Smart formatting — concise human-readable responses, automatic user name resolution

Setup

1. Google Cloud Project & Chat API Setup

Create Project & Enable API

  1. Go to Google Cloud Console
  2. Create a new project (or select existing)
  3. Go to APIs & Services > Library
  4. Search for "Google Chat API" and click Enable

Configure the Chat App

This step is required — without it, the Chat API won't work.

  1. After enabling the Google Chat API, click on it to open its settings
  2. Go to the Configuration tab
  3. Fill in the following:
    • App name — give it a name (e.g. "Chat MCP Assistant")
    • Avatar URL — optional, any image URL for the app icon
    • Description — a short description (e.g. "MCP server for Google Chat")
    • Enable Interactive features — toggle ON
    • Functionality — check "Receive 1:1 messages" and "Join spaces and group conversations"
    • Connection settings — select "Apps Script project" (this won't actually be used, but a selection is required)
    • Visibility — choose who can use the app:
      • For personal use: select your own account
      • For team use: select your Google Workspace domain
  4. Click Save

Create OAuth Credentials

  1. Go to APIs & Services > Credentials
  2. Click Create Credentials > OAuth client ID
  3. If prompted, configure the OAuth consent screen first:
    • Choose Internal (for Workspace) or External (for personal Gmail)
    • Fill in app name and your email
    • Add these scopes: chat.spaces, chat.messages, chat.memberships, chat.messages.reactions, userinfo.profile, directory.readonly
    • Save and continue through the remaining steps
  4. Back on Credentials, click Create Credentials > OAuth client ID
  5. Choose Desktop app or Web application
    • If Web application: add http://localhost:18273/auth/callback as an authorized redirect URI (or any http://localhost:{port}/{path} — the server reads it from your credentials file)
    • If Desktop app: no redirect URI needed
  6. Download the JSON and save it as credentials.json

2. Install & Run

# Run directly with npx (no install needed)
npx google-chat-mcp --credentials-path ./credentials.json

# Or install globally
npm install -g google-chat-mcp
google-chat-mcp --credentials-path ./credentials.json

# HTTP/SSE transport
npx google-chat-mcp --transport http --port 3000 --credentials-path ./credentials.json

On first run, your browser will open for Google authentication. Approve access and the token is cached automatically.

3. Connect to AI Agents

Claude Code (CLI)

claude mcp add google-chat -- npx google-chat-mcp --credentials-path /absolute/path/to/credentials.json

Add -s user to make it available across all projects:

claude mcp add google-chat -s user -- npx google-chat-mcp --credentials-path /absolute/path/to/credentials.json

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "google-chat": {
      "command": "npx",
      "args": [
        "google-chat-mcp",
        "--credentials-path",
        "/absolute/path/to/credentials.json"
      ]
    }
  }
}

Cursor

Add to Cursor's MCP settings (Settings > MCP Servers):

{
  "google-chat": {
    "command": "npx",
    "args": [
      "google-chat-mcp",
      "--credentials-path",
      "/absolute/path/to/credentials.json"
    ]
  }
}

Windsurf / Continue / Other MCP Clients

Any MCP client that supports stdio transport can connect. Use:

  • Command: npx
  • Args: google-chat-mcp --credentials-path /absolute/path/to/credentials.json

For HTTP/SSE clients, run with --transport http --port 3000 and connect to http://localhost:3000/sse.

CLI Options

Flag Default Description
--transport stdio Transport mode: stdio or http
--port 3000 Port for HTTP transport
--credentials-path ./credentials.json Path to OAuth credentials file
--token-path ./token.json Path to stored token
--disable-token-saving false Don't persist tokens to disk

Tools

Spaces

Tool Description
list_spaces List all accessible spaces (concise format, configurable pageSize)
get_space Get full details of a specific space
create_space Create a new space
update_space Update space display name or description
delete_space Delete a space

Messages

Tool Description
list_messages List messages newest-first with sender names resolved. Supports date filtering (local timezone) and pageSize
get_message Get a specific message with sender name resolved
send_message Send a text message to a space
reply_to_thread Reply to an existing thread
update_message Update a message's text
delete_message Delete a message

Members

Tool Description
list_members List members with display names resolved
add_member Add a user to a space
remove_member Remove a member from a space
get_user_info Look up a user's display name, email, and photo

Reactions

Tool Description
add_reaction Add an emoji reaction to a message
remove_reaction Remove a reaction

Attachments

Tool Description
get_attachment Get attachment metadata and download URL
upload_attachment Upload a file and send it as a message

OAuth Scopes

The server requests these Google OAuth scopes:

  • chat.spaces — read/write spaces
  • chat.messages — read/write messages
  • chat.memberships — read/write memberships
  • chat.messages.reactions — read/write reactions
  • userinfo.profile — authenticated user profile
  • directory.readonly — workspace user directory (for name resolution)

Troubleshooting

redirect_uri_mismatch error

Your OAuth credentials have a registered redirect URI that doesn't match. The server reads the redirect URI from your credentials.json automatically. Make sure the URI registered in Google Cloud Console matches what's in the file.

User names showing as users/123456...

The People API may not resolve names depending on your Google Workspace privacy settings. The server caches display names from Chat API responses (members, message senders) as a fallback.

Token expired

Delete your token.json file and restart — the browser auth flow will re-trigger.

Development

npm install
npm run build
npm test

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选