Google Chat MCP Server

by chy168

Integrations

  • Provides tools for accessing and interacting with Google Chat spaces and messages, including listing available spaces and retrieving messages with date filtering.

  • Utilizes Google Cloud authentication for OAuth2 credentials required to access Google Chat API.

介绍

该项目为使用 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 数据。(您的聊天室和消息)

特征

  • 使用 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 .
-
security - not tested
F
license - not found
-
quality - not tested

提供通过 OAuth2 身份验证访问和与 Google 聊天空间和消息交互的 MCP(模型控制协议)工具。

  1. Structure
    1. Features
      1. Requirements
        1. How to use?
          1. Prepare Google Oauth Login
          2. Run Auth server and get your Google access token (login google only, not MCP server yet)
          3. MCP Configuration (mcp.json)
          4. Tools
          5. Development and Debug

        Related MCP Servers

        • -
          security
          F
          license
          -
          quality
          A specialized Model Context Protocol (MCP) server that integrates Google services (Gmail, Calendar, etc.) into your AI workflows. This server enables seamless access to Google services through MCP, allowing AI agents to interact with Gmail, Google Calendar, and other Google services.
          Last updated -
          10
          3
          TypeScript
        • -
          security
          F
          license
          -
          quality
          This server provides a standardized framework using the Model Context Protocol (MCP) to seamlessly integrate and manage diverse tools, enabling features like Twitter automation, cryptocurrency updates, and ElizaOS interaction.
          Last updated -
          2
          Python
        • -
          security
          A
          license
          -
          quality
          A secure MCP (Model Context Protocol) server hosted on Google Cloud Run that enables team collaboration by providing authenticated access via Google Cloud IAM, allowing teams to share custom MCP servers over the internet before official MCP authentication is implemented.
          Last updated -
          16
          TypeScript
          MIT License
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that provides seamless integration with Google Workspace, allowing operations with Google Drive, Docs, and Sheets through secure OAuth2 authentication.
          Last updated -
          Python
          MIT License
          • Linux
          • Apple

        View all related MCP servers

        ID: 8bcrxn62bu