gmail-multi-mcp
Manage multiple Gmail accounts with tools for searching, reading, composing, sending, labeling, archiving, and trashing emails.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gmail-multi-mcp search personal inbox for unread emails"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Related MCP server: Multi-Gmail MCP Server
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 build2. 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.comEach 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 |
|
Read |
|
Compose |
|
Labels |
|
Cleanup |
|
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
Available Tools
22 toolsadd_accountA
Multi-account Gmail (all connected accounts). Connect a new Gmail account via OAuth: opens a browser for authorization and stores the token locally. If this times out before the user finishes, run instead in a terminal: npm run auth -- --alias (in the gmail-mcp project).
Inputs: alias (required), email.
archive_threadA
Multi-account Gmail (all connected accounts). Archive a thread (remove it from the inbox; it stays searchable in All Mail).
Inputs: account (required), threadId (required).
create_draftA
Multi-account Gmail (all connected accounts). Create a draft email (does NOT send). Supports replies via replyToMessageId.
Inputs: account (required), body (required), to, cc, +3 more.
create_labelC
Multi-account Gmail (all connected accounts). Create a new label.
Inputs: account (required), name (required).
delete_draftA
Multi-account Gmail (all connected accounts). Delete a draft permanently (use this to discard a draft the user rejected). Does not affect sent mail.
Inputs: account (required), draftId (required).
delete_labelA
Multi-account Gmail (all connected accounts). Delete a label (does not delete the emails carrying it).
Inputs: account (required), labelId (required).
download_attachmentA
Multi-account Gmail (all connected accounts). Download an email attachment to ~/Downloads. Get attachmentId from get_thread/get_message.
Inputs: account (required), messageId (required), attachmentId (required), filename.
get_messageA
Multi-account Gmail (all connected accounts). Read a single email message in full (untruncated up to ~20k chars).
Inputs: account (required), messageId (required).
get_threadA
Multi-account Gmail (all connected accounts). Read a full email thread (all messages, bodies, attachment metadata).
Inputs: account (required), threadId (required), includeFullBodies.
label_messageB
Multi-account Gmail (all connected accounts). Add labels to a single message.
Inputs: account (required), messageId (required), labels (required).
label_threadB
Multi-account Gmail (all connected accounts). Add labels to a thread.
Inputs: account (required), threadId (required), labels (required).
list_accountsA
Multi-account Gmail (all connected accounts). List the connected Gmail accounts (alias + email). Call this when unsure which accounts exist or what to pass as "account".
Inputs: no named parameters.
list_draftsA
Multi-account Gmail (all connected accounts). List saved drafts with their subjects and recipients.
Inputs: account (required), maxResults.
list_labelsA
Multi-account Gmail (all connected accounts). List all labels in one account (system + user labels).
Inputs: account (required).
search_threadsA
Multi-account Gmail (all connected accounts). Search email threads in one account using full Gmail search syntax (e.g. "from:alice is:unread newer_than:7d has:attachment subject:invoice"). Returns compact thread summaries.
Inputs: account (required), query (required), maxResults, pageToken, +1 more.
send_draftA
Multi-account Gmail (all connected accounts). Send an existing draft. Sends immediately as the account's email address ā only after the user approved it.
Inputs: account (required), draftId (required).
send_messageA
Multi-account Gmail (all connected accounts). Send an email immediately as the account's email address. Prefer create_draft unless the user has explicitly approved sending. Supports replies via replyToMessageId.
Inputs: account (required), body (required), to, cc, +3 more.
trash_messageA
Multi-account Gmail (all connected accounts). Move a single message to Trash (recoverable for 30 days).
Inputs: account (required), messageId (required).
trash_threadB
Multi-account Gmail (all connected accounts). Move a whole thread to Trash (recoverable for 30 days).
Inputs: account (required), threadId (required).
unlabel_messageB
Multi-account Gmail (all connected accounts). Remove labels from a single message.
Inputs: account (required), messageId (required), labels (required).
unlabel_threadB
Multi-account Gmail (all connected accounts). Remove labels from a thread.
Inputs: account (required), threadId (required), labels (required).
update_labelB
Multi-account Gmail (all connected accounts). Rename a label.
Inputs: account (required), labelId (required), name (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 22 tools
Every tool targets a distinct action and resource (accounts, threads, messages, drafts, labels, attachments). There is no ambiguity between similar operations like trash_thread vs trash_message or label_thread vs label_message, as the descriptions clearly differentiate the scope.
All tool names follow a consistent verb_noun pattern using snake_case (e.g., create_draft, list_labels, send_message). The verbs are clear and uniform, making the tool set predictable for an agent.
With 22 tools, the server covers the core Gmail API surface comprehensively, including account management. While this is above the typical 3-15 range for a well-scoped server, each tool serves a distinct purpose and the count is justified by the multi-account complexity.
The tool set covers CRUD operations for threads, messages, drafts, and labels, plus search, attachments, and account management. Minor gaps exist (e.g., no explicit mark-as-read or spam tools), but these are handled indirectly through labeling and the core workflows are well-supported.
Maintenance
Related MCP Connectors
Hosted email MCP for your own Gmail, Outlook.com, Microsoft 365, iCloud or IMAP inbox: read, search, draft, reply in thread, forward and file mail. It moves or flags up to 500 messages in one call, and a send leaves exactly one copy in Sent. A calendar is a separate connection, and connecting one adds diary and scheduling tools.
A MCP server for Gmail that lets you search, read, and draft emails and replies.
Your Gmail, Calendar, Drive, GitHub, Oura, wallet and confirmed profile facts in any MCP client.
Email infrastructure for AI agents ā send, receive, search, and reply to email over MCP.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables interacting with multiple Gmail accounts through a single MCP server, supporting search, labels, drafts, and thread management with per-account OAuth.1-
- FlicenseNot gradedqualityDmaintenanceEnables searching, reading, and drafting emails across multiple Gmail accounts through a single MCP server.-
- AlicenseNot gradedqualityNot gradedmaintenanceEnables connecting Gmail to MCP clients, allowing search, read, send, reply-all, forward, attachments, drafts, labels, and thread management across multiple Google accounts at once via a self-hosted Cloudflare Worker.MIT
- AlicenseAqualityBmaintenanceEnables managing multiple Gmail accounts through a single MCP server, with independent OAuth per account, supporting email read, search, labeling, drafting and sending, as well as calendar and iCal feed operations.41Apache 2.0