本项目提供了一个用于Python编写的MCP(模型控制协议)服务器与Google Chat集成的功能。它允许您通过MCP工具访问和与Google Chat空间及消息进行交互。
该项目由两个主要组件构成:
带有Google Chat工具的MCP服务器:提供了通过模型控制协议与Google Chat交互的工具。
server.py:主MCP服务器实现,包含Google Chat工具google_chat.py:Google Chat API集成和身份验证处理身份验证服务器:独立的身份验证组件,用于Google账户的身份验证
server_auth.py:身份验证服务器实现身份验证流程允许您获取和刷新Google API令牌,这些令牌随后将被MCP工具用来访问Google Chat数据。(您的空间和消息)
git clone https://github.com/chy168/google-chat-mcp-server.git
cd google-chat-mcp-server
http://localhost:8000
授权重定向URI:http://localhost:8000/auth/callback.json文件。保存为项目顶层的credentials.json。python server.py -local-auth --port 8000
token.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服务器提供了以下工具:
get_chat_spaces() - 列出机器人可以访问的所有Google Chat空间get_space_messages(space_name: str, start_date: str, end_date: str = None) - 列出特定Google Chat空间的消息,可选时间过滤fastmcp dev server.py --with-editable .