gmail-multi-mcp
Connect multiple Gmail accounts to any MCP client, enabling search, read, draft, send, label, and organize mail across unlimited accounts with local-only OAuth token storage.
README
gmail-multi-mcp
Connect multiple Gmail accounts to Claude (or any MCP client) from one local server. The official Gmail connector only supports a single Google account — this lets you search, read, draft, send, label, and organize mail across as many accounts as you like, each addressed by a friendly alias.
Your OAuth tokens are stored locally on your machine only — never uploaded anywhere.
Features
- 🔢 Unlimited accounts — every tool takes an
accountparameter ("personal","work", …) - 🔎 Search & read — full Gmail search syntax, thread/message reading, attachment download
- ✍️ Compose — create/list/delete drafts, send mail, replies with correct threading headers
- 🏷️ Organize — full label management, archive, trash
- 🔐 Local-first — standard Google OAuth; tokens live in
~/.gmail-mcp/, chmod 600 - 🧩 22 tools, works with Claude Code, Claude Desktop, Cursor, and any MCP client
Prerequisites
- Node.js ≥ 20
- A Google account (and a free Google Cloud project — setup below)
1. Install
git clone https://github.com/Vinksj/claude-gmail-multi.git
cd claude-gmail-multi
npm install
npm run build
2. Create your Google OAuth app (one-time, ~10 min)
You register one OAuth "app" with Google; it then works for all the accounts you connect.
- Go to console.cloud.google.com → create a project (e.g.
gmail-mcp). - APIs & Services → Library → search Gmail API → Enable.
- APIs & Services → OAuth consent screen:
- User type External → Create.
- App name + your support email + your contact email → Save and Continue.
- Scopes page → Save and Continue. Test users page → Save and Continue.
- Publish to production: on the OAuth consent screen, set Publishing status → Publish app. (In "Testing" mode Google expires your refresh token every 7 days. Publishing avoids that. You'll click through a one-time "Google hasn't verified this app" warning per account — that's normal for a personal app: choose Advanced → Continue.)
- APIs & Services → Credentials → Create Credentials → OAuth client ID:
- Application type Desktop app → Create → Download JSON.
- Save that file as
~/.gmail-mcp/credentials.json:mkdir -p ~/.gmail-mcp && chmod 700 ~/.gmail-mcp mv ~/Downloads/client_secret_*.json ~/.gmail-mcp/credentials.json chmod 600 ~/.gmail-mcp/credentials.json
Note: newer Google Cloud UIs put these under "Google Auth Platform" (Branding / Audience / Clients) instead of "OAuth consent screen" — same steps, different labels.
3. Connect your accounts
npm run auth -- --alias personal --email you@gmail.com
npm run auth -- --alias work --email you@company.com
Each opens a browser → pick the matching Google account → approve. The optional --email flag
aborts if the wrong account gets authorized (an easy mistake with multi-login browsers). Connect
as many as you want; re-run any time a token is revoked.
4. Register with your MCP client
Claude Code:
claude mcp add --scope user gmail-multi -- node "$(pwd)/dist/index.js"
Claude Desktop / other clients — add to your MCP config:
{
"mcpServers": {
"gmail-multi": {
"command": "node",
"args": ["/absolute/path/to/gmail-multi-mcp/dist/index.js"]
}
}
}
Tools appear as gmail-multi's search_threads, create_draft, etc. Ask things like
"search my work inbox for unread from this week" or "draft a reply in personal to Alice."
Tools
| Group | Tools |
|---|---|
| Accounts | list_accounts, add_account |
| Read | search_threads, get_thread, get_message, download_attachment |
| Compose | create_draft, list_drafts, delete_draft, send_draft, send_message |
| Labels | list_labels, create_label, update_label, delete_label, label_thread, unlabel_thread, label_message, unlabel_message |
| Cleanup | archive_thread, trash_thread, trash_message |
Every tool except list_accounts takes an account parameter (alias or email). Replies via
replyToMessageId get correct In-Reply-To/References headers and threading automatically.
How it works
- One self-owned Google Cloud OAuth app (Desktop client) authorizes any number of accounts.
- Single scope:
https://www.googleapis.com/auth/gmail.modify(read, search, drafts, send, labels, archive, trash — narrower than fullhttps://mail.google.com/). - Per-account refresh tokens stored in
~/.gmail-mcp/tokens/<alias>.json(chmod 600); the account registry is~/.gmail-mcp/config.json. Nothing leaves your machine.
~/.gmail-mcp/
├── credentials.json # your OAuth client (you add this)
├── config.json # alias → email map (auto-managed)
└── tokens/<alias>.json # per-account refresh tokens (auto-managed)
Security notes
- Tokens are stored as plain files readable only by your user (chmod 600). On a single-user machine with full-disk encryption this is reasonable; moving token storage to the OS keychain is a sensible future hardening step.
- Never commit
~/.gmail-mcp/— it lives in your home directory, outside this repo, and the repo's.gitignoreexcludes build artifacts and dependencies regardless. - The
gmail.modifyscope cannot permanently delete mail —trash_*tools move items to Trash (recoverable for 30 days).
Development
npm run build # tsc -> dist/
npm run inspect # MCP Inspector UI against the built server
npm run auth -- --alias <name> [--email <expected>]
Important: stdout is the JSON-RPC channel — never console.log in server code; use console.error.
License
MIT © Saurabh Jain
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。