Google Chat MCP server

Lightweight Google Chat integration server enabling OAuth2-authenticated access to chat spaces and messages with flexible date-based filtering for developers.
Back to servers
Provider
Zz Chen
Release date
Mar 27, 2025
Language
Python
Stats
6 stars

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.

Prerequisites

  • Python 3.8 or higher
  • Google Cloud project with Chat API enabled
  • OAuth2 credentials from Google Cloud Console

Installation

  1. Clone the repository:

    git clone https://github.com/chy168/google-chat-mcp-server.git
    cd google-chat-mcp-server
    
  2. Install required dependencies (recommended to use a virtual environment):

    pip install -r requirements.txt
    

Setting Up Google OAuth Authentication

Create Google Cloud Project Credentials

  1. Go to the Google Cloud Console at https://console.cloud.google.com/
  2. Create a new project or select an existing one
  3. Navigate to "APIs & Services" > "Credentials"
  4. Click "Create Credentials" > "OAuth client ID"
  5. Select "Web application" as the application type
  6. Add the following:
    • Authorized JavaScript origins: http://localhost:8000
    • Authorized redirect URIs: http://localhost:8000/auth/callback
  7. Download the client secrets JSON file
  8. Save the downloaded file as credentials.json in the project's root directory

Obtain Google Access Token

  1. Start the authentication server:

    python server.py --local-auth --port 8000
    
  2. Open your browser and navigate to:

    http://localhost:8000/auth
    
  3. Complete the Google login process

  4. After successful authentication, your access token will be saved as token.json in the project directory

Configuring the MCP Server

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.

Using the MCP Server

Starting the Server

Use the FastMCP CLI to start the server:

fastmcp start

Available Tools

The MCP server provides the following Google Chat tools:

Get Chat Spaces

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"
  }
]

Get Space Messages

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."
  }
]

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later