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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.