Skip to main content
Glama
YenF
by YenF

gmail-multi-mcp

Seamless multi-account Gmail integration for AI assistants via the Model Context Protocol (MCP). Manage 2 to 20+ Gmail accounts concurrently in a single process without context explosion.

License: MIT MCP Compatible


Why gmail-multi-mcp?

Traditional Gmail MCP servers spawn one background process per account, duplicating 15–20 tool definitions in your LLM's system prompt for every inbox. With 5 accounts, that's nearly 100 tools cluttering the context window.

gmail-multi-mcp provides a unified multi-account architecture:

  • πŸš€ Single Process for N Accounts: Runs 1 lightweight process whether you have 2 or 10 accounts. Only 10 tools are registered in your prompt.

  • πŸ” Parallel Cross-Account Search: Search across all your inboxes at once using account="all" (queries all inboxes concurrently with Promise.allSettled).

  • πŸ›‘οΈ Per-Account Permission Tiers: Set sensitive work inboxes to draft (compose only) or readonly while keeping personal inboxes on full (send allowed).

  • πŸ”„ Hot-Reloading: Add new accounts via CLI while your AI assistant is runningβ€”new accounts are detected immediately without restarting your client.

  • πŸ“Ž Full Attachment Support: Download attachments to local folders and attach local files to outgoing emails or drafts.

  • πŸ”’ Zero Third-Party Relays: Direct communication between your local machine and Google APIs using official SDKs. Tokens are stored locally with strict 0600 permissions.


Related MCP server: Gmail MCP Server

Quick Start

1. Prerequisites & Google Cloud OAuth Setup

To access the Gmail API, you need a Google Cloud OAuth Desktop Client:

  1. Go to the Google Cloud Console and create a project (e.g. gmail-mcp).

  2. Navigate to APIs & Services > Library and enable the Gmail API.

  3. Go to APIs & Services > OAuth consent screen:

    • Choose External (or Internal if using a Google Workspace organization).

    • Fill in the required app information and add your email addresses as Test users.

  4. Go to APIs & Services > Credentials > Create Credentials > OAuth client ID:

    • Application type: Desktop app.

    • Download the generated JSON credentials file.

  5. Save the file to the default configuration directory:

    mkdir -p ~/.gmail-multi-mcp
    chmod 700 ~/.gmail-multi-mcp
    mv ~/Downloads/client_secret_*.json ~/.gmail-multi-mcp/gcp_client_secret.json
    chmod 600 ~/.gmail-multi-mcp/gcp_client_secret.json

2. Connect Your Accounts

Use the CLI to connect your accounts. Each command opens a browser tab for one-time Google Sign-in:

# Connect primary personal account (default: full permissions)
npx gmail-multi-mcp auth add personal

# Connect work account with draft-only safety (cannot send or trash emails)
npx gmail-multi-mcp auth add work --permission draft

# Connect an account using a custom corporate OAuth client JSON
npx gmail-multi-mcp auth add corp --oauth-keys ~/Downloads/corp-oauth.json

# View all connected accounts
npx gmail-multi-mcp auth list

3. Add to Your MCP Client Configuration

Antigravity (~/.gemini/config/mcp_config.json)

{
  "mcpServers": {
    "gmail-multi": {
      "command": "npx",
      "args": ["-y", "gmail-multi-mcp"]
    }
  }
}

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "gmail-multi": {
      "command": "npx",
      "args": ["-y", "gmail-multi-mcp"]
    }
  }
}

Cursor (Settings > Features > MCP)

  • Name: gmail-multi

  • Type: command

  • Command: npx -y gmail-multi-mcp


Permission Tiers

Configure permissions per account when adding it or change it anytime:

npx gmail-multi-mcp auth set-permission work draft

Permission

Search & Read

Download Attachments

Create Drafts

Modify Labels

Send Emails

Trash Emails

readonly

βœ…

βœ…

❌

❌

❌

❌

draft

βœ…

βœ…

βœ…

βœ…

❌

❌

full

βœ…

βœ…

βœ…

βœ…

βœ…

βœ…


Available Tools

Tool

Parameters

Description

list_accounts

(none)

Lists all connected accounts, aliases, real emails, and permission tiers.

search_emails

query, account (default: "all"), max_results

Searches emails with Gmail syntax (from:, is:unread). Queries all inboxes concurrently if account="all".

read_email

account, message_id

Reads email details (headers, text, HTML, attachment list).

read_thread

account, thread_id

Reads an entire email thread in chronological order.

download_attachment

account, message_id, attachment_id, filename, destination_dir

Downloads an email attachment to a local folder.

create_draft

account, to, subject, body, cc?, bcc?, attachments?, thread_id?

Creates a draft email with optional local file attachments.

send_email

account, to, subject, body, cc?, bcc?, attachments?, thread_id?

Directly sends an email or replies to a thread (blocked if account is not full).

modify_email

account, message_id, add_labels?, remove_labels?

Adds or removes labels (e.g. mark read, archive). Accepts label names or IDs.

trash_email

account, message_id

Moves an email to Gmail Trash (recoverable for 30 days).

list_labels

account

Lists all labels in an account.

create_label

account, name

Creates a new user label in an account.


CLI Reference

# Add a new account
gmail-multi-mcp auth add <alias> [--permission <readonly|draft|full>] [--oauth-keys <path>]

# List all connected accounts
gmail-multi-mcp auth list

# Update account permissions dynamically without re-login
gmail-multi-mcp auth set-permission <alias> <readonly|draft|full>

# Remove an account and delete its local token
gmail-multi-mcp auth remove <alias>

Directory Structure & Security

All local tokens and configuration files are stored outside project directories:

~/.gmail-multi-mcp/
β”œβ”€β”€ gcp_client_secret.json  # Default OAuth client secret (chmod 0600)
β”œβ”€β”€ accounts.json           # Account registry and metadata (chmod 0600)
└── tokens/                 # Encrypted OAuth refresh tokens per account (chmod 0600)
    β”œβ”€β”€ personal.json
    └── work.json
  • File Permissions: Created with 0700 (directory) and 0600 (files), ensuring only your local OS user can read them.

  • Custom Location: Set GMAIL_MULTI_MCP_DIR=/path/to/custom/dir to override the default storage directory.


Development

# Clone the repository
git clone https://github.com/your-username/gmail-multi-mcp.git
cd gmail-multi-mcp

# Install dependencies
npm install

# Build TypeScript
npm run build

# Test CLI
node dist/index.js auth list

License

MIT Β© 2026

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    B
    maintenance
    Enables AI assistants to manage multiple Gmail accounts simultaneously with built-in OAuth authentication, supporting email reading, sending, drafts, labels, and account management.
    60
    26 npm
    4
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Multi-account Gmail integration for AI agents, enabling read, write, archive, label, and auto-unsubscribe operations through the Model Context Protocol.
    226 npm
    16
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Connects AI assistants to multiple Gmail accounts simultaneously, enabling search, read, draft, send, and reply operations with per-account permission controls.
    54
    ISC
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI assistants to send, read, search, and manage Gmail emails, drafts, and labels via the Model Context Protocol.
    5
    MIT