Skip to main content
Glama
umesh9883

multi-gmail-mcp-server

by umesh9883

multi-gmail-mcp-server

MCP server that connects multiple Gmail accounts and lets Claude search and summarize all of them in one shot. Built for the gmail-summary skill with multi-account support.


What It Does

  • Connects personal, work, kids, school Gmail accounts — as many as you need

  • Stores OAuth tokens securely in an AES-256-GCM encrypted file at ~/.multi-gmail-mcp/tokens.enc

  • Exposes 5 MCP tools to Claude:

    • gmail_list_accounts — see all connected accounts

    • gmail_search_all — search ALL accounts simultaneously

    • gmail_search — search a specific account

    • gmail_read_message — read a full message

    • gmail_read_thread — read a full thread


Related MCP server: gmail-mcp-server

Prerequisites

  • Node.js >= 18

  • A Google Cloud project with Gmail API enabled


Step 1 — Google Cloud Setup

  1. Go to https://console.cloud.google.com

  2. Create a new project (e.g. "my-gmail-mcp")

  3. Enable Gmail API (APIs & Services → Enable APIs → search "Gmail API")

  4. Create OAuth 2.0 credentials:

    • APIs & Services → Credentials → Create Credentials → OAuth client ID

    • Application type: Desktop app

    • Name: "multi-gmail-mcp"

  5. Download the credentials and note your Client ID and Client Secret


Step 2 — Install & Build

git clone https://github.com/umesh9883/multi-gmail-mcp-server.git
cd multi-gmail-mcp-server
npm install
npm run build

Step 3 — Set Environment Variables

# Linux / macOS
export GMAIL_CLIENT_ID=your_client_id_here
export GMAIL_CLIENT_SECRET=your_client_secret_here

# Windows (PowerShell)
$env:GMAIL_CLIENT_ID = "your_client_id_here"
$env:GMAIL_CLIENT_SECRET = "your_client_secret_here"

Tip: Put these in your shell profile (~/.bashrc, ~/.zshrc) so they persist.


Step 4 — Add Gmail Accounts

Run the setup CLI to connect each account:

npm run setup add personal     # Opens browser → sign in with personal@gmail.com
npm run setup add work         # Opens browser → sign in with work@company.com
npm run setup add kids         # Opens browser → sign in with kids@gmail.com
npm run setup add school       # Opens browser → sign in with school@gmail.com

Each command opens a browser, asks you to sign in, and stores the refresh token encrypted on disk.

npm run setup list             # See all connected accounts
npm run setup remove john@gmail.com   # Disconnect an account

Step 5 — Connect to Claude

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "multi-gmail": {
      "command": "node",
      "args": ["/absolute/path/to/multi-gmail-mcp-server/dist/index.js"],
      "env": {
        "GMAIL_CLIENT_ID": "your_client_id",
        "GMAIL_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

Restart Claude Desktop after saving.

Claude Code (.claude/settings.json)

{
  "mcpServers": {
    "multi-gmail": {
      "command": "node",
      "args": ["/absolute/path/to/multi-gmail-mcp-server/dist/index.js"],
      "env": {
        "GMAIL_CLIENT_ID": "your_client_id",
        "GMAIL_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

Usage with gmail-summary Skill

Once connected, use the same gmail-summary command in Claude. It will automatically find all your connected accounts and search them all:

gmail-summary today
gmail-summary this week
gmail-summary last 3 days

Each email in the summary will show which account it came from.


Troubleshooting

"No refresh_token received" The account was previously authorized without offline access. Go to https://myaccount.google.com/permissions, revoke the app, then run npm run setup add again.

"Missing GMAIL_CLIENT_ID or GMAIL_CLIENT_SECRET" Set the environment variables before running setup or starting the server.

Token expired errors Tokens auto-refresh. If you see persistent auth errors, remove and re-add the account:

npm run setup remove problematic@gmail.com
npm run setup add personal

Security Notes

  • Tokens are stored in an AES-256-GCM encrypted file at ~/.multi-gmail-mcp/tokens.enc (mode 600), encrypted with a key derived from your hostname and username

  • This server only requests read-only Gmail access (gmail.readonly scope)

  • It never modifies, sends, or deletes emails

  • The GMAIL_CLIENT_SECRET never leaves your machine

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables reading, sending, searching, and managing Gmail through Claude using the official Google Gmail API.
    89 npm
    3
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables Claude to read, search, send, and manage Gmail messages and threads through natural language.
    89 npm
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Connects multiple Gmail accounts to Claude Desktop via MCP, enabling email search, labeling, drafts, and confirmed sending through natural language.
    13
    62 npm
    MIT