🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

mailbox-mcp

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailbox-mcp

Multi-account, multi-provider email MCP server

latest
Source
npmnpm
Version
0.10.0
Version published
Weekly downloads
41
-32.79%
Maintainers
1
Weekly downloads
 
Created
Source

mailbox-mcp

npm License Built by

Give your AI tools access to your email. Search, read, send, and manage messages across multiple accounts without leaving your terminal.

mailbox-mcp is an MCP server that connects your email to Claude Code, Cursor, Windsurf, or any AI tool that supports the Model Context Protocol. Instead of switching between your terminal and Gmail, you ask the AI to find that invoice, summarize a thread, or draft a reply — and it does.

What makes this different from the 60+ other email MCP servers:

  • Multiple accounts, one server. Work email, personal email, client accounts — all accessible through a single server. No need to run separate instances.
  • Not just Gmail. Supports Gmail (full API), any IMAP/SMTP provider (ProtonMail, corporate mail, self-hosted), and JMAP (Fastmail, Stalwart, Topicbox). Add providers without changing a line of tool code.
  • Security-conscious. Encrypted credentials (AES-256-GCM), prompt injection fencing on email content, rate limiting, TLS enforcement, SSRF protection with IP encoding evasion detection, input validation.
  • Tools for the workflows that matter. Search, read, send, reply, forward, drafts, labels, filters, templates, signatures, vacation replies, attachments, unsubscribe, and more.
  • Zero native dependencies. Pure Node.js. Install and run anywhere.

Quick Start

Install

Add to your Claude Code MCP config (~/.claude.json). The package runs straight from npm via npx:

{
  "mcpServers": {
    "mailbox": {
      "command": "npx",
      "args": ["-y", "mailbox-mcp"],
      "env": {
        "MAILBOX_MCP_PASSPHRASE": "a-long-random-passphrase"
      }
    }
  }
}

MAILBOX_MCP_PASSPHRASE is the passphrase used to encrypt IMAP/JMAP credentials at rest; it's required before adding an IMAP or JMAP account, and unused for Gmail-only setups.

From source instead
git clone https://github.com/jgalea/mailbox-mcp.git
cd mailbox-mcp
npm install && npm run build

Then point the config at the build with "command": "node", "args": ["/path/to/mailbox-mcp/dist/server.js"].

Add a Gmail Account

1. Create a Google Cloud project

  • Go to Google Auth Platform > Branding
  • Set App name and User support email
  • Go to Audience, select External
  • Add the Google account you'll sign in with as a test user (this must be the exact @gmail.com address you use to authenticate, not a workspace alias)

3. Create OAuth credentials

4. Authenticate

In Claude Code, run: authenticate alias="personal" provider="gmail" email="you@gmail.com"

This opens a browser window to complete the OAuth flow. Your tokens are stored locally in ~/.mailbox-mcp/accounts/.

Add an IMAP Account

In Claude Code, run:

authenticate alias="work" provider="imap" email="you@company.com" host="imap.company.com" smtpHost="smtp.company.com" username="you@company.com" password="<app-password>"

Credentials are encrypted at rest using AES-256-GCM.

Add a JMAP Account

In Claude Code, run:

authenticate alias="fastmail" provider="jmap" email="you@fastmail.com" host="fastmail.com" username="you@fastmail.com" password="<app-password>"

JMAP auto-discovers the API endpoint via .well-known/jmap. Credentials are encrypted at rest using AES-256-GCM.

Supported JMAP servers: Fastmail, Stalwart, Topicbox, Cyrus IMAP, and any RFC 8620-compliant server.

JMAP advantages over IMAP:

  • Native thread support (real conversations, not synthetic)
  • Server-side search (faster, more accurate)
  • Batch operations in a single HTTP request
  • No persistent connection required

Tools

Universal (Gmail + IMAP + JMAP)

ToolDescription
list_accountsList configured accounts
authenticateAdd a new account
reauthRe-run OAuth for an existing Gmail account (use when refresh token expires with invalid_grant)
remove_accountRemove an account
search_emailsSearch messages (optional folder to scope the search)
multi_account_searchRun the same query across every configured account in parallel
read_emailRead a message
read_threadRead a conversation thread (Gmail + JMAP)
send_emailSend a new email (supports from, attachments)
reply_emailReply to a message (supports from, attachments)
forward_emailForward a message (supports from, attachments)
create_draftCreate a draft (supports reply drafts via in_reply_to, plus from, attachments)
list_draftsList drafts for an account
send_draftSend an existing draft
trash_emailsTrash messages
mark_readMark a message as read or unread
star_emailStar or unstar a message
archive_emailArchive a message (remove from inbox)
list_labelsList labels/folders
create_labelCreate a label/folder
delete_labelDelete a label/folder
modify_emailModify message labels
batch_modify_emailsBulk modify labels
bulk_modifyAdd/remove labels on every message matching a query (search-then-batch; dry_run supported)
bulk_trashTrash every message matching a query (dry_run supported)
list_recent_bulk_opsList recorded bulk operations from the transaction log
undo_bulk_opReverse a recorded bulk operation against the exact ids it touched
count_unread_by_labelShow unread message counts per label/folder
download_attachmentDownload an attachment
export_emailSave a message as a .eml file
export_threadSave every message in a thread as .eml files (Gmail + JMAP)
emails_sinceList messages received after a given timestamp
inbox_summaryInbox overview

Gmail-Only

ToolDescription
update_draftReplace the contents of an existing draft (thread association preserved)
delete_draftPermanently delete a draft
create_filterCreate a filter
list_filtersList filters
delete_filterDelete a filter
save_templateSave a template
list_templatesList templates
delete_templateDelete a template
send_templateSend from template
get_signatureGet signature
set_signatureUpdate signature
get_vacationGet vacation settings
set_vacationConfigure vacation reply (supports date ranges, domain-only)
unsubscribeFind unsubscribe link
bulk_unsubscribeBulk unsubscribe
list_send_asList send-as aliases

Choosing which tools load

49 tool schemas cost roughly 6,000 tokens in clients that load every definition into context. In everyday use a handful of tools do most of the work, so you can expose only the groups you need with MAILBOX_MCP_TOOLS (comma-separated). Unset means everything loads.

"env": {
  "MAILBOX_MCP_TOOLS": "core,attachments"
}
GroupToolsWhat it covers
core19accounts, search, read, send, reply, forward, drafts, inbox summary (~2,900 tokens)
organize9labels, star, archive, trash, modify
bulk4query-wide modify/trash with dry-run and undo
attachments3download attachments, export .eml
gmail-extras14filters, templates, signatures, vacation, unsubscribe, send-as

Calls to tools in disabled groups fail with an error naming the group to enable.

Sending attachments

send_email, reply_email, forward_email, and create_draft accept an optional attachments parameter — an array of local file paths. The server reads each file, detects its MIME type from the extension, and embeds it in the outgoing message (or draft).

send_email account="personal" to=["friend@example.com"] subject="The report" body="See attached." attachments=["/path/to/report.pdf", "/path/to/chart.png"]
  • Each file must be a regular file ≤ 25 MB; total per message is capped at 25 MB (Gmail's hard limit).
  • Paths are resolved through any symlinks, and filenames are stripped of CRLF before going into headers.
  • Gmail routes messages with attachments through the multipart upload endpoint (35 MB API limit) instead of the JSON endpoint, so the 25 MB message cap is the real ceiling.
  • JMAP uploads each file to the server's upload URL first, then references the resulting blobIds in the Email/set call.

Choosing the sender address

One account often speaks for several addresses. send_email, reply_email, forward_email, create_draft, and update_draft accept an optional from parameter; without it, the account's primary address is used.

reply_email account="personal" message_id="18f..." from="jean@example.com" body="Thanks, sorted."

Accepted forms are alias@example.com and Name <alias@example.com>; matching is case-insensitive.

The address is checked against the account before anything is sent, and the call fails with the list of usable addresses if it doesn't match. This matters because Gmail silently falls back to the primary address when the From header names an address you haven't verified, so a message can be sent from the wrong identity and still look like it succeeded. Some recipients (Amazon's customer service, for one) reject mail that doesn't come from the address on file.

  • Gmail: the address must be a send-as alias with verification completed. Run list_send_as to see them. Pending aliases are refused.
  • JMAP: the address must match one of the account's identities; its identityId is attached to the submission.
  • IMAP: no alias list exists to check against, so any from is passed to the SMTP relay, which accepts or rejects it at send time.

License

MIT

Built at AgentVania.

Keywords

mcp

FAQs

Package last updated on 12 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts