Skip to main content
Glama
gmail-mcp-multi-account

gmail-mcp-multi-account

by ckarandev010

Gmail MCP (multi-account)

A small Model Context Protocol server that lets an AI assistant work with two personal Gmail accounts: search and read mail, create drafts (with attachments, threaded replies), list drafts, and send a draft on request.

Built for a job search: the assistant drafts tailored application emails with the right resume attached, and the human reviews and sends (or schedules) them.

Tools

Tool

What it does

list_accounts

Shows which address each account (personal, second) is signed in as

search_emails

Gmail search syntax, per account

read_email

Headers, plain-text body, attachment names

create_draft

Draft with to/cc/bcc, attachments (local paths), optional reply threading. Nothing is sent.

list_drafts

Drafts in an account

send_draft

Sends a draft. Intended only when the user explicitly asks.

Related MCP server: gmail-mcp

Safety design

  • Least privilege: scopes are gmail.readonly + gmail.compose. No delete, no label changes, no settings.

  • Drafts first: the assistant creates drafts; the user reviews them in Gmail. Sending is a separate, explicit step.

  • Blocked domains: mailboxes and recipients in blocked domains (for example a work domain) are refused in code, both when signing in and when building or sending a message. Configure with GMAIL_MCP_BLOCKED_DOMAINS="@work.com" or a git-ignored blocked_domains.txt.

  • Untrusted content: email bodies are returned as data; tool descriptions tell the model never to treat them as instructions.

  • Attachment limits: files are checked to exist and kept under ~20 MB per message.

  • Secrets stay local: OAuth client and tokens are git-ignored.

Setup

  1. In Google Cloud Console: create a project, enable the Gmail API, configure the OAuth consent screen (External, Testing) and add both Gmail addresses as test users.

  2. Create an OAuth client of type Desktop app, download the JSON and save it next to the script as credentials.json.

  3. Install and sign in each account:

pip install -r requirements.txt
python gmail_mcp.py --login personal   # pick the first Google account in the browser
python gmail_mcp.py --login second     # pick the second one
python gmail_mcp.py --whoami
  1. Register with Claude Code (or any MCP client):

claude mcp add gmail-jobhunt -s user -- python /path/to/gmail_mcp.py

While the consent screen is in Testing, Google expires refresh tokens after 7 days; re-run --login when that happens.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with Gmail through OAuth2 authentication, allowing users to list, search, read emails, and create drafts with a safety-first design that prevents accidental sends by default.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to read Gmail and create drafts securely with read-only access and query whitelisting.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables safe, multi-account Gmail and Microsoft 365 operations with explicit aliases, including searching, reading, drafting, archiving, labels/categories, and human-reviewed sending via a localhost approval window.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables an AI assistant to search and read multiple Hotmail/Outlook and Gmail accounts plus Google Drive and Calendar, and to create drafts, calendar events, and files without sending email. It supports local and remote operation with owner-only authentication and audit logging.
      MIT