Skip to main content
Glama
Google Chat MCP Server

Google Chat MCP Server

by chy168

Introduction

This project provides a Google Chat integration for MCP (Model Control Protocol) servers written by Python with FastMCP. It allows you to access and interact with Google Chat spaces and messages through MCP tools.

Structure

The project consists of two main components:

  1. MCP Server with Google Chat Tools: Provides tools for interacting with Google Chat through the Model Control Protocol.

    • Written by FastMCP

    • server.py: Main MCP server implementation with Google Chat tools

    • google_chat.py: Google Chat API integration and authentication handling

  2. Authentication Server: Standalone component for Google account authentication

    • Written by FastAPI

    • Handles OAuth2 flow with Google

    • Stores and manages access tokens

    • Can be run independently or as part of the MCP server

    • server_auth.py: Authentication server implementation

The authentication flow allows you to obtain and refresh Google API tokens, which are then used by the MCP tools to access Google Chat data. (Your spaces and messages)

Related MCP server: google-chat-mcp

Features

  • OAuth2 authentication with Google Chat API

  • List available Google Chat spaces

  • Retrieve messages from specific spaces with date filtering

  • Read card messages (bots, webhooks, CI notifications) rendered as markdown

  • Local authentication server for easy setup

Requirements

  • Python 3.13+

  • Google Cloud project with the following APIs enabled:

    • Google Chat API

    • People API (for user display names)

  • OAuth2 credentials from Google Cloud Console

How to use?

Prepare Google Oauth Login

  1. Clone this project

    git clone https://github.com/chy168/google-chat-mcp-server.git
    cd google-chat-mcp-server
  2. Prepare a Google Cloud Project (GCP)

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

  4. Google Auth Platform > Clients > (+) Create client > Web application reference: https://developers.google.com/identity/protocols/oauth2/?hl=en Authorized JavaScript origins add: http://localhost:8000 Authorized redirect URIs: http://localhost:8000/auth/callback

  5. After you create a OAuth 2.0 Client, download the client secrets as .json file. Save as credentials.json at top level of project.

Authentication

There are two authentication modes available:

uv run python server.py --auth cli

This will:

  1. Display an authorization URL

  2. Open the URL in any browser (can be on another device)

  3. Complete Google authorization

  4. Copy the redirect URL from browser and paste it back to terminal

  5. Token will be saved as token.json

Option 2: Web Mode (For environments with local browser)

uv run python server.py --auth web --port 8000

MCP Configuration (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"
            ]
        }
    }

Docker / Podman

Run Container

# Mount your project directory containing token.json
docker run -it --rm \
  -v /path/to/your/project:/data \
  ghcr.io/chy168/google-chat-mcp-server:latest \
  --token-path=/data/token.json

# or with podman
podman run -it --rm \
  -v /path/to/your/project:/data \
  ghcr.io/chy168/google-chat-mcp-server:latest \
  --token-path=/data/token.json

Run Auth Server in Container

# Web mode
docker run -it --rm \
  -p 8000:8000 \
  -v /path/to/your/project:/data \
  ghcr.io/chy168/google-chat-mcp-server:latest \
  --auth web --host 0.0.0.0 --port 8000 --token-path=/data/token.json

# CLI mode (for headless environments)
docker run -it --rm \
  -v /path/to/your/project:/data \
  ghcr.io/chy168/google-chat-mcp-server:latest \
  --auth cli --token-path=/data/token.json

Tools

The MCP server provides the following tools:

Google Chat Tools

  • get_chat_spaces() - List all Google Chat spaces the bot has access to

  • get_space_messages(space_name: str, start_date: str, end_date: str = None) - List messages from a specific Google Chat space with optional time filtering

  • search_messages(space_name: str, query: str, start_date: str = None, end_date: str = None) - Case-insensitive substring search in message text and card text

Card messages

Bots and webhooks (CI, monitoring, alerting) usually post cards and leave the message text empty. Such messages get an extra cards_text field holding the cards rendered as markdown: card and section headers as headings, labelled values as list items, and buttons and clickable texts as links.

{"sender": "CI", "text": null, "cards_text": "## ❌ my-pipeline #42\n\n_Build failed_\n\n- **Duration** : 11 sec\n[Open build](https://ci.example.com/42)"}

Development and Debug

Build Image

docker build -t google-chat-mcp-server:latest .
# or
podman build -t google-chat-mcp-server:latest .

Debug

fastmcp dev server.py --with-editable .

Run Tests

uv run python -m unittest discover -s tests -t .

The same suite runs in GitHub Actions on every push and pull request (.github/workflows/test.yml).

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

    ActivityMaintained
    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.
      110 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.
      34 npm
      Apache 2.0