This server provides a Google Chat integration for Model Control Protocol (MCP), allowing you to access and interact with Google Chat spaces and messages through MCP tools. The implementation uses FastMCP to create an MCP server with dedicated Google Chat functionality.
Clone the repository:
git clone https://github.com/chy168/google-chat-mcp-server.git
cd google-chat-mcp-server
Install required dependencies (recommended to use a virtual environment):
pip install -r requirements.txt
http://localhost:8000
http://localhost:8000/auth/callback
credentials.json
in the project's root directoryStart the authentication server:
python server.py --local-auth --port 8000
Open your browser and navigate to:
http://localhost:8000/auth
Complete the Google login process
After successful authentication, your access token will be saved as token.json
in the project directory
Create an MCP configuration file (mcp.json
) with the following content:
{
"mcpServers": {
"google_chat": {
"command": "uv",
"args": [
"--directory",
"/path/to/google-chat-mcp-server",
"run",
"server.py",
"--token-path",
"/path/to/google-chat-mcp-server/token.json"
]
}
}
}
Replace /path/to/google-chat-mcp-server
with the actual path to your local repository.
Use the FastMCP CLI to start the server:
fastmcp start
The MCP server provides the following Google Chat tools:
Lists all Google Chat spaces that your authenticated account has access to.
get_chat_spaces()
Example response:
[
{
"name": "spaces/AAAA1234",
"displayName": "Project Team Chat",
"type": "SPACE"
},
{
"name": "spaces/BBBB5678",
"displayName": "Marketing Team",
"type": "SPACE"
}
]
Retrieves messages from a specific Google Chat space with optional date filtering.
get_space_messages(
space_name="spaces/AAAA1234",
start_date="2023-10-01",
end_date="2023-10-31"
)
Parameters:
space_name
: The name of the space (from the get_chat_spaces
response)start_date
: Start date for message filtering (format: YYYY-MM-DD)end_date
: Optional end date for message filtering (format: YYYY-MM-DD)Example response:
[
{
"name": "spaces/AAAA1234/messages/abcdef123456",
"sender": {
"name": "users/123456789",
"displayName": "John Doe"
},
"createTime": "2023-10-15T14:23:45Z",
"text": "Hello team, let's discuss our project status."
},
{
"name": "spaces/AAAA1234/messages/ghijkl789012",
"sender": {
"name": "users/987654321",
"displayName": "Jane Smith"
},
"createTime": "2023-10-15T14:25:12Z",
"text": "I've completed the front-end components."
}
]
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.