Integration with gmail and Google Calendar.
mcp-gsuite
MCP ServerThe mcp-gsuite
server bridges the gap between Large Language Models (LLMs) and Google Workspace, enabling powerful integrations with Gmail and Calendar through the Model Context Protocol (MCP). This document provides a comprehensive guide to understanding, installing, configuring, and developing with mcp-gsuite
.
This MCP server empowers LLMs with the following functionalities:
1. General
2. Gmail
3. Calendar
The recommended installation method is through Smithery, which automates the process for Claude Desktop:
npx -y @smithery/cli install mcp-gsuite --client claude
Google Workspace APIs require OAuth 2.0 for secure authorization. Follow these steps to configure authentication:
1. Create OAuth 2.0 Credentials:
http://localhost:4100/code
for local development).2. Required OAuth 2.0 Scopes:
Ensure the following OAuth 2.0 scopes are enabled for your application:
[ "openid", "https://mail.google.com/", "https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/userinfo.email" ]
3. Create .gauth.json
:
Create a .gauth.json
file in your working directory with your OAuth 2.0 client credentials:
{ "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
:
Create a .accounts.json
file to define the Google accounts you want to use:
{ "accounts": [ { "email": "[email protected]", "account_type": "personal", "extra_info": "Contains Family Calendar" } ] }
extra_info
field is crucial for providing context to the LLM about each account (e.g., whether it contains a specific calendar).Important: The first time you use a tool for a specific account, a browser window will open, redirecting you to Google for authentication. After successful login, the credentials are saved in a local file named .oauth.{email}.json
. Subsequent requests will use the refresh token for authorization.
To integrate mcp-gsuite
with Claude Desktop, you need to configure the claude_desktop_config.json
file. The location of this file varies depending on your operating system:
~/Library/Application\ Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
{ "mcpServers": { "mcp-gsuite": { "command": "uv", "args": [ "--directory", "<dir_to>/mcp-gsuite", "run", "mcp-gsuite" ] } } }
You can customize the paths to the accounts file and credentials directory:
{ "mcpServers": { "mcp-gsuite": { "command": "uv", "args": [ "--directory", "<dir_to>/mcp-gsuite", "run", "mcp-gsuite", "--accounts-file", "/path/to/custom/.accounts.json", "--credentials-dir", "/path/to/custom/credentials" ] } } }
{ "mcpServers": { "mcp-gsuite": { "command": "uvx", "args": [ "mcp-gsuite", "--accounts-file", "/path/to/custom/.accounts.json", "--credentials-dir", "/path/to/custom/credentials" ] } } }
The mcp-gsuite
server offers several command-line options for customization:
--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 the directory for storing OAuth credentials. Default: current working directory with a subdirectory for each account as .oauth.{email}.json
.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
Sync dependencies and update lockfile:
uv sync
Build package distributions:
uv build
This creates source and wheel distributions in the dist/
directory.
Publish to PyPI:
uv publish
You'll need to set PyPI credentials via environment variables or command flags:
--token
or UV_PUBLISH_TOKEN
--username
/UV_PUBLISH_USERNAME
and --password
/UV_PUBLISH_PASSWORD
Debugging MCP servers running over stdio can be complex. The recommended approach is to use the MCP Inspector.
Launch the MCP Inspector using:
npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-gsuite run mcp-gsuite
The Inspector will provide a URL for browser-based debugging.
You can also monitor server logs using:
tail -n 20 -f ~/Library/Logs/Claude/mcp-server-mcp-gsuite.log
Here are some example prompts to get you started:
Gmail:
Calendar:
By following this guide, you can effectively leverage the mcp-gsuite
server to create powerful LLM applications that seamlessly integrate with Google Workspace.
📇 🏠 🍎 Allows to read notes and tags for the Bear Note taking app, through a direct integration with Bear's sqlitedb.
📇 An MCP server for basic local taskwarrior usage (add, update, remove tasks)
📇 🏠 An MCP server to list and launch applications on MacOS
🐍 ☁️ A Model Context Protocol (MCP) server that integrates with Notion's API to manage personal todo lists efficiently.