Skip to main content
Glama
Google Chat MCP Server

Google Chat MCP Server

by chy168

介绍

该项目为使用 Python 和 FastMCP 编写的 MCP(模型控制协议)服务器提供了 Google Chat 集成。它允许您通过 MCP 工具访问 Google Chat 聊天室和消息并进行交互。

结构

该项目由两个主要部分组成:

  1. 带有 Google Chat 工具的 MCP 服务器:提供通过模型控制协议与 Google Chat 交互的工具。

    • 作者:FastMCP

    • server.py :使用 Google Chat 工具的主要 MCP 服务器实现

    • google_chat.py :Google Chat API 集成和身份验证处理

  2. 身份验证服务器:用于 Google 帐户身份验证的独立组件

    • 由 FastAPI 编写

    • 与 Google 一起处理 OAuth2 流程

    • 存储和管理访问令牌

    • 可以独立运行或作为 MCP 服务器的一部分运行

    • server_auth.py :认证服务器实现

身份验证流程允许您获取并刷新 Google API 令牌,然后 MCP 工具会使用这些令牌访问 Google Chat 数据。(您的聊天室和消息)

Related MCP server: google-chat-mcp

特征

  • 使用 Google Chat API 进行 OAuth2 身份验证

  • 列出可用的 Google Chat 空间

  • 通过日期过滤从特定空间检索消息

  • 本地身份验证服务器,易于设置

要求

  • Python 3.8+

  • 启用 Chat API 的 Google Cloud 项目

  • 来自 Google Cloud Console 的 OAuth2 凭据

如何使用?

准备 Google Oauth 登录

  1. 克隆此项目

    git clone https://github.com/chy168/google-chat-mcp-server.git
    cd google-chat-mcp-server
  2. 准备 Google Cloud 项目 (GCP)

  3. Google Cloud Console( https://console.cloud.google.com/auth/overview?project=\ <YOUR_PROJECT_NAME>)

  4. Google Auth 平台 > 客户端 > (+) 创建客户端 > Web 应用程序参考: https://developers.google.com/identity/protocols/oauth2/ ?hl=en 授权 JavaScript 来源添加: http://localhost:8000授权重定向 URI: http://localhost:8000/auth/callback

  5. 创建 OAuth 2.0 客户端后,请将客户端密钥下载为.json文件。并将其保存为credentials.json ,并置于项目根目录。

运行 Auth 服务器并获取您的 Google 访问令牌(仅登录 Google,尚未登录 MCP 服务器)

python server.py -local-auth --port 8000

MCP 配置 (mcp.json)

{
    "mcpServers": {
        "google_chat": {
            "command": "uv",
            "args": [
                "--directory",
                "<YOUR_REPO_PATH>/google-chat-mcp-server",
                "run",
                "server.py",
                "--token-path",
                "<YOUR_REPO_PATH>/google-chat-mcp-server/token.json"
            ]
        }
    }

工具

MCP 服务器提供以下工具:

Google 聊天工具

  • get_chat_spaces() - 列出机器人可以访问的所有 Google 聊天空间

  • get_space_messages(space_name: str, start_date: str, end_date: str = None) - 列出来自特定 Google Chat 空间的消息,并可选择时间过滤

开发和调试

fastmcp dev server.py --with-editable .

Available Tools

5 tools
addC

Add two numbers

Inputs: a (required), b (required).

fetch_weatherB

Fetch current weather for a city

Inputs: city (required).

get_chat_spacesA

List all Google Chat spaces the bot has access to.

This tool requires OAuth authentication. On first run, it will open a browser window for you to log in with your Google account. Make sure you have credentials.json downloaded from Google Cloud Console in the current directory.

Inputs: no named parameters.

get_ip_my_addressC

Get IP address from outian.net

Inputs: city (required).

get_space_messagesA

List messages from a specific Google Chat space with optional time filtering.

This tool requires OAuth authentication. The space_name should be in the format 'spaces/your_space_id'. Dates should be in YYYY-MM-DD format (e.g., '2024-03-22').

When only start_date is provided, it will query messages for that entire day. When both dates are provided, it will query messages from start_date 00:00:00Z to end_date 23:59:59Z.

Args: space_name: The name/identifier of the space to fetch messages from start_date: Required start date in YYYY-MM-DD format end_date: Optional end date in YYYY-MM-DD format

Returns: List of message objects from the space matching the time criteria

Raises: ValueError: If the date format is invalid or dates are in wrong order

Inputs: space_name (required), start_date (required), end_date.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.7/5.0

    Scored across 5 tools

    Disambiguation2/5

    The tool set has significant ambiguity issues. 'add' (math operation) and 'fetch_weather' (weather API) are completely unrelated to the Google Chat domain suggested by the server name and other tools. 'get_ip_my_address' is another unrelated utility. Only 'get_chat_spaces' and 'get_space_messages' clearly belong to the Google Chat domain, creating confusion about the server's actual purpose.

    Naming Consistency2/5

    Naming conventions are inconsistent across the tool set. 'add' uses a simple verb, 'fetch_weather' uses verb_noun, 'get_chat_spaces' and 'get_space_messages' use get_noun_noun pattern, and 'get_ip_my_address' mixes get_noun_adjective_noun. There's no coherent naming strategy, with tools using different verb styles and structural patterns.

    Tool Count2/5

    With only 5 tools, the count seems reasonable at first, but the content mismatch makes it inappropriate. For a 'Google Chat MCP Server', having only 2 actual Google Chat tools alongside 3 unrelated utilities creates a poorly scoped tool set. The server name suggests a focused domain, but the tools deliver a scattered collection.

    Completeness2/5

    For a Google Chat server, the coverage is severely incomplete. While 'get_chat_spaces' and 'get_space_messages' provide read access, there are no tools for creating messages, updating content, managing memberships, or other essential chat operations. The inclusion of unrelated tools (add, fetch_weather, get_ip) further dilutes the domain coverage, creating significant gaps in the expected functionality.

    Maintenance

    ActivitySlowing
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      A
      maintenance
      Enables interaction with Google Chat via MCP using the internal Dynamite API, allowing listing spaces, reading and sending messages, and managing DMs. No Google Cloud Console setup required.
      13
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server for Google Chat that enables managing spaces, messages, members, reactions, attachments, and GIFs through the Model Context Protocol.
      35 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with Google Chat through MCP, allowing listing spaces and messages, searching messages, and sending messages. Supports local and remote transports.
      Apache 2.0