Gmail & Calendar Multi-Account MCP Server
A local MCP server that connects multiple Gmail and Google Calendar accounts to Claude Desktop, enabling email and calendar management across accounts.
README
Gmail & Calendar Multi-Account MCP Server
A local Model Context Protocol (MCP) server that connects multiple Gmail accounts and Google Calendars to Claude Desktop. Runs entirely on your machine — no cloud hosting required.
Features
- Multiple accounts — connect as many Gmail or Google Workspace accounts as you need
- Unified email search — search across all accounts simultaneously with Gmail's full query syntax
- Full read access — read individual messages and entire threads
- Send & draft — compose and send emails, or save drafts, from any account
- Label management — list labels, mark as read/unread, star messages
- Google Calendar — list calendars, browse upcoming events, search by keyword
Requirements
- macOS (tested on macOS 14+)
- Python 3.11+
- A Google Cloud project with the Gmail API and Calendar API enabled (free)
- Claude Desktop
Installation
1. Clone the repository
git clone https://github.com/DiegoMaldonadoRosas/gmail-mcp.git
cd gmail-mcp
2. Run the setup script
bash setup.sh
This creates a virtual environment and installs all Python dependencies.
3. Configure your accounts
Copy the example config and fill in your accounts:
cp config.json.example config.json
Edit config.json:
{
"accounts": {
"personal": {
"email": "you@gmail.com",
"description": "Personal Gmail"
},
"work": {
"email": "you@company.com",
"description": "Work account"
}
},
"credentials_dir": "./credentials"
}
The account keys (personal, work) are the names you'll use when asking Claude to interact with a specific account.
4. Get Google OAuth credentials
- Go to Google Cloud Console
- Create a project and enable both the Gmail API and the Google Calendar API
- Go to APIs & Services → Credentials → + Create Credentials → OAuth 2.0 Client ID
- Choose Desktop app as the application type
- Download the JSON file and save it as
credentials/client_secret.json - Go to APIs & Services → OAuth consent screen → Test users and add every email address you configured in
config.json
5. Authenticate your accounts
source .venv/bin/activate
python setup_auth.py
A browser window will open for each account. Sign in with the correct Google account. Tokens are saved locally and refreshed automatically — you only need to do this once per account.
Note: If you previously authenticated for Gmail only, you must re-run
setup_auth.pyafter adding Calendar support so the tokens include the new Calendar permissions.
6. Add the server to Claude Desktop
Open ~/Library/Application Support/Claude/claude_desktop_config.json and add:
{
"mcpServers": {
"gmail": {
"command": "/absolute/path/to/gmail-mcp/.venv/bin/python",
"args": ["/absolute/path/to/gmail-mcp/server.py"]
}
}
}
Replace /absolute/path/to/gmail-mcp with the actual path where you cloned the repo.
7. Restart Claude Desktop
All tools will appear automatically.
Available Tools
Gmail
| Tool | Description |
|---|---|
list_accounts |
List all configured accounts and their auth status |
gmail_get_profile |
Get account profile and mailbox stats |
gmail_search |
Search emails using Gmail query syntax (one or all accounts) |
gmail_read_message |
Read the full content of a message |
gmail_read_thread |
Read all messages in a thread |
gmail_send |
Send an email from a specific account |
gmail_create_draft |
Save an email as a draft |
gmail_list_drafts |
List drafts in an account |
gmail_list_labels |
List all labels and folders |
gmail_modify_labels |
Add or remove labels (mark read/unread, star, etc.) |
gmail_trash |
Move a message to trash |
Google Calendar
| Tool | Description |
|---|---|
calendar_list_calendars |
List all calendars for an account (primary, work, shared, etc.) |
calendar_list_events |
List upcoming events, optionally filtered by date range |
calendar_search |
Search events by keyword (title, description, location, attendees) |
calendar_get_event |
Get full details of a specific event |
Usage Examples
Once connected, you can ask Claude things like:
Email:
- "Do I have any unread emails in my work account?"
- "Search for invoices received in the last month across all my accounts"
- "Read the last email from John in my personal account"
- "Draft a reply to the budget email in my work account"
- "Mark all emails from newsletter@example.com as read"
Calendar:
- "What meetings do I have this week in my work account?"
- "Search for events related to 'product launch' in my personal calendar"
- "List all my calendars in my work account"
- "What are the details of tomorrow's standup?"
Adding a New Account
- Add the account to
config.json - Add the email as a Test User in Google Cloud Console (OAuth consent screen)
- Run
python setup_auth.py— it will only prompt for the new account - Restart Claude Desktop
Security
- OAuth tokens are stored locally in
credentials/tokens/and are excluded from version control via.gitignore config.json(which contains your email addresses) is also excluded from version control- Nothing is sent to any third-party server — all communication is directly between your Mac and Google's APIs
- To revoke access at any time, visit myaccount.google.com/permissions
Project Structure
gmail-mcp/
├── server.py # MCP server — exposes 15 tools to Claude
├── auth.py # OAuth2 token manager (per account)
├── gmail.py # Gmail API wrapper
├── gcalendar.py # Google Calendar API wrapper
├── config.py # Configuration loader
├── setup_auth.py # One-time authentication script
├── setup.sh # First-time installer
├── requirements.txt # Python dependencies
├── config.json.example # Account configuration template
└── .gitignore # Excludes credentials and config.json
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。