gchat-mcp
MCP (Model Context Protocol) server for Google Chat integration. This server provides tools to interact with Google Chat spaces and messages.
Features
- List all Google Chat spaces you're a member of
- Retrieve recent messages from any space
- Search messages by text content
Installation
Using uv
# Create virtual environment
uv venv
# Activate it
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
uv pip install -e ".[dev]"
Or with pip
pip install -e ".[dev]"
Setup
-
Create a Google Cloud project: https://console.cloud.google.com/
-
Enable Google Chat API:
gcloud services enable chat.googleapis.com
-
Create a service account:
- Go to IAM & Admin > Service Accounts
- Click "Create Service Account"
- Give it a name (e.g., "gchat-mcp")
- Click "Generate Key" and select JSON format
- Download the JSON file
-
Place credentials: Put your service account JSON as
credentials.jsonin the project root -
Validate credentials:
make oauth # or uv run python oauth_setup.py credentials.json
Usage
As an MCP Server
# Start the MCP server
uv run python -m src.apps.gchat_mcp.server
Available Tools
list_spaces()
Returns a list of Google Chat spaces the authenticated user is a member of.
Example:
from src.apps.gchat_mcp.server import app
# In MCP context
spaces = await app.call_tool("list_spaces")
print(spaces)
# [{'spaceId': 'abc123', 'name': 'General', 'iconLink': 'https://...'}]
list_messages(space_id, limit=20)
Retrieves recent messages from a specific space.
Arguments:
space_id(str): The unique identifier of the spacelimit(int, optional): Maximum number of messages to retrieve (default: 20)
Example:
messages = await app.call_tool("list_messages", {"space_id": "abc123", "limit": 10})
print(messages)
# [{'messageId': 'msg1', 'text': 'Hello!', 'authorName': 'User1', ...}]
search_messages(space_id, query)
Searches for messages containing specific text in a space.
Arguments:
space_id(str): The unique identifier of the space to search inquery(str): The text query to search for
Example:
results = await app.call_tool("search_messages", {"space_id": "abc123", "query": "meeting"})
print(results)
# [{'messageId': 'msg1', 'text': 'Meeting at 3pm...', 'authorName': 'User1', ...}]
Project Structure
ai-meetup-demo/
├── pyproject.toml
├── README.md
├── src/
│ ├── config/ # Configuration files
│ │ └── __init__.py
│ ├── apps/
│ │ └── gchat_mcp/ # MCP server application
│ │ ├── __init__.py
│ │ └── server.py
│ └── manage.py # Entry point
├── credentials.json # Google Cloud service account (add to .gitignore)
├── oauth_setup.py # OAuth setup helper script
├── examples/
│ └── example_usage.py # Usage examples
└── tests/
└── test_server.py # Unit tests
Configuration
Service Account
Place your Google Cloud service account JSON as credentials.json in the project root. This file is excluded from git.
Development
# Install dev dependencies
uv pip install -e ".[dev]"
# Run tests
uv run pytest
# Check code quality
uv run ruff check src/
uv run ruff format src/ --check
License
MIT
Metadata
Release files for gchat-mcp 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gchat_mcp-0.1.6.tar.gz | 712.3 kB | Without provenance | Details for gchat_mcp-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gchat_mcp-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for gchat_mcp-0.1.6-py3-none-any.whl |
Total release size: 717.4 kB
Release files / gchat_mcp-0.1.6.tar.gz
| Download URL | gchat_mcp-0.1.6.tar.gz |
|---|---|
| Size | 712.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ade5768ba435b81ca2c96b463887f47ed455b9118fdf63ffc984abd926d8fc92
|
|
BLAKE2b-256 checksum How to use checksums |
6ac7e049a91390c81e1b0739f0c43ebca2a5f3c24af15711fbdd1d7d4b79e05b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.23
|
Release files / gchat_mcp-0.1.6-py3-none-any.whl
| Download URL | gchat_mcp-0.1.6-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
226186477eefb85e8a7424921ccf4b8c31af422a378805f9f17a2525ab7219bd
|
|
BLAKE2b-256 checksum How to use checksums |
530d6533773f8ef8871e1951d87ed324b6eb8a6094ba6555aa3f565eb5dcfe4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.23
|
Security for gchat-mcp 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.