MCP HubMCP Hub
MarkusPfundstein

mcp-gsuite

by: MarkusPfundstein

MCP Server to interact with Google Gsuite prodcuts

272created 30/11/2024
Visit
GSuite
API

📌Overview

Purpose: To provide an MCP server that facilitates seamless interaction with Google products, specifically Gmail and Calendar.

Overview: The mcp-gsuite server is designed to integrate with multiple Google accounts, enabling users to manage their Gmail and Calendar activities effectively. It supports robust functionalities for retrieving, sending, and organizing emails, as well as managing calendar events with user-defined parameters.

Key Features:

  • Multiple Google Accounts Support: Manage more than one Google account, making it easier to handle personal and professional tasks without needing to log in and out.

  • Gmail Integration: Access user information, conduct flexible email searches, create, retrieve, and manage drafts, reply to emails, and save attachments locally, enhancing email management efficiency.

  • Calendar Management: Organize and retrieve events, create new events with customizable details (including attendees and notifications), and efficiently manage multiple calendars for better scheduling.


MCP Server for G Suite

MCP server to interact with Google products.

Supported Features

Gmail Capabilities

  • Access Gmail user information
  • Flexible email querying (unread, specific senders, date ranges, attachments)
  • Retrieve complete email content by ID
  • Create, delete, and manage draft emails
  • Reply to existing emails (send immediately or save as draft)
  • Retrieve multiple emails by their IDs
  • Save multiple email attachments to your local system

Calendar Capabilities

  • Manage multiple calendars
  • Get calendar events within specified time ranges
  • Create calendar events with title, start/end times, location, description, and attendees
  • Delete calendar events

Example Prompts

  • Retrieve my latest unread messages
  • Check my agenda for tomorrow
  • Plan an event with Tim for next week

Quickstart

Installation

To install mcp-gsuite for Claude Desktop via Smithery:

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

OAuth 2 Setup

  1. Create OAuth2 Credentials:

    • Go to Google Cloud Console
    • Create/select a project and enable Gmail and Calendar APIs
    • Create OAuth client ID with appropriate application type
    • Set up the OAuth consent screen and authorized redirect URIs (e.g., http://localhost:4100/code)
  2. Required OAuth2 Scopes:

    [
      "openid",
      "https://mail.google.com/",
      "https://www.googleapis.com/auth/calendar",
      "https://www.googleapis.com/auth/userinfo.email"
    ]
    
  3. Create .gauth.json Configuration File:

    {
        "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"
        }
    }
    
  4. Create .accounts.json File:

    {
        "accounts": [
            {
                "email": "alice@bob.com",
                "account_type": "personal",
                "extra_info": "Additional info for the account."
            }
        ]
    }
    

Configuration Options

The server can be configured with custom paths for authentication and account information:

  • --gauth-file: Path to the .gauth.json file
  • --accounts-file: Path to the .accounts.json file
  • --credentials-dir: Directory for storing OAuth credentials

Example usage:

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

Development

Building and Publishing

  1. Sync dependencies and update lockfile:

    uv sync
    
  2. Build package distributions:

    uv build
    
  3. Publish to PyPI:

    uv publish
    

Debugging

For debugging, use the MCP Inspector:

npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-gsuite run mcp-gsuite

Monitor server logs:

tail -n 20 -f ~/Library/Logs/Claude/mcp-server-mcp-gsuite.log