Multi-Account Gmail MCPGmail MCP

Open source, MIT licensed

Multi-account Gmail MCP server

A multi-account Gmail MCP server lets Claude, Cursor, Windsurf or any MCP client work with several Gmail inboxes through one connection. This open-source server connects as many Gmail accounts as you add, searches them all in one call, and archives, labels, drafts, sends and unsubscribes.

Source on GitHub · MIT · README

Works with Claude · Cursor · Windsurf · Cline · Continue · any MCP client

One connection, every Gmail inbox

Most Gmail connectors in AI tools handle a single account. This one holds as many as you connect.

Many accounts, one server

Connect personal, work and side-project inboxes once. Every tool takes an account parameter, so you pick the inbox per request.

Search all of them at once

Pass "account": "all" to list_emails or batch_process and get one merged answer, with Gmail's full search syntax.

Unsubscribe that tells the truth

RFC 8058 one-click or mailto, sent from the account that got the newsletter. It reports success only when the sender accepted, and hands you the link otherwise.

Claude's built-in Gmail connector compared with this multi-account server
FeatureClaude's built-in GmailMulti-account Gmail MCP
Gmail accounts at onceOneAs many as you connect
Search across accounts in one callNoYes
Unsubscribe (RFC 8058 and mailto)NoYes
Works in Cursor, Windsurf, ClineNoYes
Self-hosted and open sourceNoYes, MIT

Nine tools your AI agent can call

Read, search, organize, write and unsubscribe, on any connected account. Full tool reference in the README.

ToolWhat it does
list_accountsList every connected Gmail account
list_emailsSearch with Gmail query syntax, in one account or all of them
get_emailRead the full message, headers and unsubscribe links
archive_emailRemove a message from the inbox
apply_labelAdd a label, creating it if needed
create_draftWrite a new draft or a reply. Nothing is sent
send_emailSend a message, a reply, or an existing draft
unsubscribe_emailOne-click or mailto unsubscribe, or the link to click
batch_processFetch a batch of messages for triage, across accounts

Try prompts like these

Set up multiple Gmail accounts with Claude in 5 minutes

You host it, so your tokens and mail stay with you. The README has the full guide for Vercel, Railway and Docker, including how to keep accounts across Docker restarts.

  1. 1

    Create Google credentials

    In Google Cloud Console, enable the Gmail API, set up the OAuth consent screen with the gmail.readonly and gmail.modify scopes, and create a Web application OAuth client.

  2. 2

    Deploy the server

    Deploy to Vercel, Railway, Docker or your own host, and set GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, ENCRYPTION_KEY, ADMIN_PASSWORD, MCP_SECRET and SERVER_URL.

  3. 3

    Connect your Gmail accounts

    Open /setup on your server, enter the admin password, choose Add Gmail Account, and repeat for each inbox.

  4. 4

    Add it to your AI client

    Point Claude, Cursor, Windsurf, Cline or Continue at https://your-server/mcp/<MCP_SECRET>, then ask it to list your connected accounts.

Run it yourself

git clone https://github.com/navbuildz/multi-account-gmail-mcp.git
cd multi-account-gmail-mcp
npm install && npm run build
npm start

Docker, Railway and Vercel are covered in the README.

Add it to Cursor

{
  "mcpServers": {
    "gmail": {
      "url": "https://your-server/mcp/<MCP_SECRET>"
    }
  }
}

Windsurf uses serverUrl. In Claude, add it under Settings, Connectors, Add custom connector.

Built to be safe with your inbox

The details live in the code. Read the security section or browse the source.

Frequently asked questions

Not covered here? The README FAQ has the same answers, and you can ask on GitHub.

Can I use multiple Gmail accounts with Claude?

Yes. Connect each account once on the /setup page, then add the server to Claude as a custom connector. Every tool takes an account parameter, and list_emails and batch_process accept "all" to search every inbox in one call.

How is this Gmail MCP server for multiple accounts different from the built-in Gmail connector?

The built-in connector works with one account. This server holds as many as you connect, searches across all of them at once, unsubscribes from newsletters, and works with Cursor, Windsurf, Cline and any other MCP client, not just Claude.

Does it work with Claude Desktop?

Yes, through Claude's custom connector. In Claude go to Settings, then Connectors, then Add custom connector, and paste your /mcp/<MCP_SECRET> URL. The server runs on your own host (Vercel, Railway, Docker or a VPS); a local mode that Claude Desktop launches directly is not built yet.

Does it work with Google Workspace accounts?

It is built and tested with personal Gmail accounts. Workspace support is on the to-do list.

Is it safe to give an MCP server access to Gmail?

It asks only for gmail.readonly and gmail.modify, never full mail.google.com access, so nothing is permanently deleted. Refresh tokens are encrypted with AES-256-GCM, and you can revoke access any time from your Google Account permissions.

Can it unsubscribe from newsletters?

Yes. It uses the RFC 8058 one-click request or sends the mailto request from the right account, and it only reports success when the sender accepted it. Anything that needs a human click comes back as a link for you to open.

Connect all your Gmail accounts to your AI assistant

Free, open source and MIT licensed.