Google Workspace MCP server

Interact with Google Docs, Sheets, and other Workspace products.
Back to servers
Provider
Markus Pfundstein
Release date
Nov 30, 2024
Language
Python
Package
Stats
6.5K downloads
337 stars

This MCP server enables integration with Google products like Gmail and Calendar, allowing you to manage emails and calendar events through Claude. It supports multiple Google accounts and provides a comprehensive set of features for email management and calendar scheduling.

Installation

Using Smithery

The easiest way to install mcp-gsuite for Claude Desktop is through Smithery:

npx -y @smithery/cli install mcp-gsuite --client claude

Setting Up Google OAuth2 Authentication

Google Workspace APIs require OAuth2 authorization:

  1. Create OAuth2 credentials:

    • Go to the Google Cloud Console
    • Create a new project or select an existing one
    • Enable the Gmail API and Google Calendar API
    • Navigate to "Credentials" → "Create Credentials" → "OAuth client ID"
    • Select "Desktop app" or "Web application"
    • Configure the OAuth consent screen
    • Add http://localhost:4100/code as an authorized redirect URI
  2. Required OAuth2 scopes:

[
  "openid",
  "https://mail.google.com/",
  "https://www.googleapis.com/auth/calendar",
  "https://www.googleapis.com/auth/userinfo.email"
]
  1. Create a .gauth.json file in your working directory:
{
    "web": {
        "client_id": "$your_client_id",
        "client_secret": "$your_client_secret",
        "redirect_uris": ["http://localhost:4100/code"],
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://oauth2.googleapis.com/token"
    }
}
  1. Create a .accounts.json file with account information:
{
    "accounts": [
        {
            "email": "[email protected]",
            "account_type": "personal",
            "extra_info": "Additional info that you want to tell Claude: E.g. 'Contains Family Calendar'"
        }
    ]
}

You can specify multiple accounts. The extra_info field allows you to include specific details about the account that you want Claude to know.

Note: When you first execute a tool for a specific account, a browser will open asking for Google authentication. After successful login, credentials are stored in a local file named .oauth.{email}.json. For subsequent uses, the refresh token will be used automatically.

Claude Desktop Configuration

Modify your Claude Desktop configuration file:

On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json

On Windows: %APPDATA%/Claude/claude_desktop_config.json

For published servers:

{
  "mcpServers": {
    "mcp-gsuite": {
      "command": "uvx",
      "args": [
        "mcp-gsuite",
        "--accounts-file",
        "/path/to/custom/.accounts.json",
        "--credentials-dir",
        "/path/to/custom/credentials"
      ]
    }
  }
}

Configuration Options

The server supports several command-line options:

  • --gauth-file: Specifies the path to the .gauth.json file (default: ./.gauth.json)
  • --accounts-file: Specifies the path to the .accounts.json file (default: ./.accounts.json)
  • --credentials-dir: Specifies where OAuth credentials are stored (default: current directory)

Example custom configuration:

uv run mcp-gsuite --gauth-file /path/to/custom/.gauth.json --accounts-file /path/to/custom/.accounts.json --credentials-dir /path/to/custom/credentials

Usage Examples

Gmail Capabilities

Try these examples with Claude:

  • "Retrieve my latest unread messages"
  • "Search my emails from the Scrum Master"
  • "Retrieve all emails from accounting"
  • "Take the email about ABC and summarize it"
  • "Write a nice response to Alice's last email and upload a draft"
  • "Reply to Bob's email with a Thank you note. Store it as draft"

Calendar Capabilities

Try these examples with Claude:

  • "What do I have on my agenda tomorrow?"
  • "Check my private account's Family agenda for next week"
  • "I need to plan an event with Tim for 2hrs next week. Suggest some time slots."

The MCP server supports creating calendar events with customizable options including title, time range, location, description, attendees, timezone, and notification preferences.

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