mail-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mail-mcp check my inbox for unread emails from the last week"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mail-mcp
MCP server for IMAP/SMTP email access — works with Claude and other MCP clients.
Requirements
Node.js >=18
macOS, Windows, or Linux (credentials stored in the OS keychain via cross-keychain)
Related MCP server: mail-mcp-oauth
Installation
Method | Install command | Best for | Auto-updates? |
npx (no install) |
| Trying it out, always-latest | Yes -- on each run |
Global npm |
| Daily use, offline-friendly | No -- run |
Homebrew |
| macOS users who prefer brew | Formula updated on publish -- run |
Run without installing (recommended)
npx @honest-magic/mail-mcpGlobal install
npm install -g @honest-magic/mail-mcp
mail-mcpHomebrew
brew tap honest-magic/tap
brew install mail-mcpUpdating
npx (run without installing)
npx always fetches the latest published version. No update step needed.
Global npm install
npm update -g @honest-magic/mail-mcpHomebrew
The Homebrew formula is updated automatically when a new version is published to npm.
brew upgrade mail-mcpVersion pinning
To run a specific version instead of latest:
npx @honest-magic/mail-mcp@1.1.0See the Releases page for version history.
Configuration
1. Add an account (interactive)
npx @honest-magic/mail-mcp accounts addThis prompts for IMAP/SMTP settings, stores the account in ~/.config/mail-mcp/accounts.json, and saves the password in macOS Keychain.
Manage accounts
mail-mcp accounts list # show configured accounts
mail-mcp accounts remove ID # remove an account and its keychain entryManual setup
Alternatively, create ~/.config/mail-mcp/accounts.json by hand:
[
{
"id": "work",
"name": "Work Email",
"host": "imap.example.com",
"port": 993,
"smtpHost": "smtp.example.com",
"smtpPort": 587,
"user": "you@example.com",
"authType": "login",
"useTLS": true
}
]Then store the password in the OS keychain. The easiest way is mail-mcp accounts add, which handles this automatically. On macOS you can also use:
security add-generic-password \
-s ch.honest-magic.config.mail-server \
-a <account-id> \
-w <password-or-app-password>Account fields
Field | Type | Required | Description |
| string | yes | Unique identifier used by MCP tools |
| string | yes | Human-readable label |
| string | yes | IMAP hostname |
| number | yes | IMAP port (993 for TLS, 143 for STARTTLS) |
| string | no | SMTP hostname (omit for read-only use) |
| number | no | SMTP port (587 for STARTTLS, 465 for TLS) |
| string | yes | Login username / email address |
| string | yes |
|
| boolean | yes |
|
OAuth2 — after starting the server, call the register_oauth2_account MCP tool:
{
"tool": "register_oauth2_account",
"arguments": {
"accountId": "work",
"clientId": "<oauth2-client-id>",
"clientSecret": "<oauth2-client-secret>",
"refreshToken": "<oauth2-refresh-token>",
"tokenEndpoint": "https://oauth2.googleapis.com/token"
}
}The credentials are stored in Keychain under the same service name. Token refresh is handled automatically.
3. Add to your MCP client
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"mail": {
"command": "npx",
"args": ["-y", "@honest-magic/mail-mcp"]
}
}
}Generic MCP client:
{
"mcpServers": {
"mail": {
"command": "mail-mcp"
}
}
}Use "command": "mail-mcp" if installed globally, or "command": "npx", "args": ["-y", "@honest-magic/mail-mcp"] otherwise.
Available Tools
Tool | Description |
| List all configured email accounts |
| List recent emails from a folder with metadata and snippets |
| Search emails by sender, subject, date range, or keywords |
| Fetch the full content of an email as Markdown |
| Send a new email via SMTP |
| Save a draft to the Drafts folder without sending |
| List all available folders and labels in a mailbox |
| Move a message to another folder (Archive, Trash, Spam, etc.) |
| Add or remove IMAP flags / provider labels on a message |
| Fetch all messages in a conversation thread |
| Download attachment content via MCP Resource URI |
| Extract plain text from PDF and document attachments |
| Store OAuth2 tokens in Keychain for an account |
| Apply move, delete, or label actions to multiple emails at once |
Read-Only Mode
Start the server with --read-only to disable all write operations:
npx @honest-magic/mail-mcp --read-onlyIn read-only mode:
Write tools (
send_email,create_draft,move_email,modify_labels,batch_operations,register_oauth2_account) are removed from the tool list entirely and return a descriptive error if called directly.SMTP authentication is skipped — only IMAP connects.
The active mode is advertised to the MCP client at handshake via
InitializeResult.instructions.
Claude Desktop read-only config:
{
"mcpServers": {
"mail-readonly": {
"command": "npx",
"args": ["-y", "@honest-magic/mail-mcp", "--read-only"]
}
}
}License
MIT
Available Tools
29 toolsbatch_operationsADestructive
Perform bulk IMAP operations (move, delete, label) on up to 100 emails at once — works with any provider.
Inputs: uids (required), action (required), folder (required), accountId (required), +4 more.
create_draftBDestructive
Save a draft email to the IMAP Drafts folder — works with Gmail, Outlook, and custom domains.
Inputs: to (required), body (required), subject (required), accountId (required), +5 more.
delete_emailADestructive
Permanently delete a single email by UID via IMAP — works with any provider (Gmail, Outlook, custom domains). This is irreversible; prefer move_email to Trash if you want recovery.
Inputs: uid (required), accountId (required), folder, confirmationId.
delete_filterADestructive
Delete a SIEVE filter script by name via ManageSieve. Cannot delete the currently active script. Only available on self-hosted mail servers — Gmail and Outlook do not support ManageSieve.
Inputs: name (required), accountId (required), confirmationId.
extract_attachment_textARead-only
Extract readable text from a PDF or plain-text email attachment — fetched via IMAP from any provider.
Inputs: uid (required), filename (required), accountId (required), folder.
extract_contactsARead-only
Scan recent messages via IMAP and return structured contact data (name, email, frequency) sorted by how often they email you — enables "who emails me most?" queries. Works with any IMAP provider.
Inputs: accountId (required), count, folder.
forward_emailBDestructive
Forward an email to a new recipient via SMTP — prepends "Fwd: " to subject and includes the original message body. Works with any IMAP/SMTP provider.
Inputs: to (required), uid (required), accountId (required), cc, +6 more.
get_attachmentARead-only
Download an email attachment via IMAP — works with any provider (Gmail, Outlook, custom domains).
Inputs: uid (required), filename (required), accountId (required), folder.
get_filterARead-only
Retrieve the content of a SIEVE filter script by name via ManageSieve. Only available on self-hosted mail servers — Gmail and Outlook do not support ManageSieve.
Inputs: name (required), accountId (required).
get_threadBRead-only
Fetch all emails in a conversation thread via IMAP — works with Gmail, Outlook, and custom domains.
Inputs: threadId (required), accountId (required), folder.
list_accountsARead-only
List IMAP mail accounts configured in mail-mcp — works with any provider (Gmail, Outlook, custom domains).
Inputs: no named parameters.
list_emailsARead-only
List recent emails via IMAP from any folder — works with Gmail, Outlook, and custom domains. Use headerOnly=true for fast inbox scanning that returns only subject, sender, date, and flags without downloading message bodies.
Inputs: accountId (required), count, folder, offset, +1 more.
list_filtersARead-only
List SIEVE filter scripts on the server via ManageSieve (RFC 5804). Returns script names and which one is active. Only available on self-hosted mail servers — Gmail and Outlook do not support ManageSieve.
Inputs: accountId (required).
list_foldersARead-only
List all IMAP folders for an account — returns folder names across any provider (Gmail, Outlook, custom domains).
Inputs: accountId (required).
list_templatesARead-only
List configured email templates — reusable message skeletons with {{variable}} placeholders for standard replies, acknowledgements, out-of-office notices, etc. Optionally filter by account to show global and account-specific templates.
Inputs: accountId.
mailbox_statsARead-only
Return mailbox statistics (total messages, unread count, recent) for one or more IMAP folders — without listing individual emails. Works with any provider (Gmail, Outlook, custom domains).
Inputs: accountId (required), folders.
mark_readADestructive
Mark an email as read (sets the \Seen flag) via IMAP — works with Gmail, Outlook, and custom domains. Simpler alternative to modify_labels.
Inputs: uid (required), accountId (required), folder, confirmationId.
mark_unreadADestructive
Mark an email as unread (removes the \Seen flag) via IMAP — works with Gmail, Outlook, and custom domains. Simpler alternative to modify_labels.
Inputs: uid (required), accountId (required), folder, confirmationId.
modify_labelsBDestructive
Add or remove IMAP flags (e.g. \\Seen, \\Flagged) on an email — works with Gmail, Outlook, and custom domains.
Inputs: uid (required), folder (required), accountId (required), addLabels, +2 more.
move_emailBDestructive
Move an email between IMAP folders — works with any provider (Gmail, Outlook, custom domains).
Inputs: uid (required), accountId (required), sourceFolder (required), targetFolder (required), +1 more.
read_emailARead-only
Fetch and read a full email via IMAP, including body and headers — works with Gmail, Outlook, and custom domains.
Inputs: uid (required), accountId (required), folder.
register_oauth2_accountBDestructive
Store OAuth2 credentials (client ID, secret, refresh token) for an IMAP account in the system keychain.
Inputs: clientId (required), accountId (required), clientSecret (required), refreshToken (required), +2 more.
reply_emailADestructive
Reply to an email in-thread via SMTP — sets In-Reply-To and References headers so the reply appears in the original conversation. Works with any IMAP/SMTP provider.
Inputs: uid (required), body (required), accountId (required), cc, +5 more.
search_emailsBRead-only
Search emails via IMAP — works with any provider (Gmail, Outlook, custom domains). Filter by sender, subject, date, or keywords.
Inputs: accountId (required), from, count, since, +5 more.
send_emailADestructive
Send an email via SMTP and save to Sent — works with any IMAP/SMTP provider (Gmail, Outlook, custom domains).
Inputs: to (required), body (required), subject (required), accountId (required), +5 more.
set_filterADestructive
Create or replace a SIEVE filter script on the server via ManageSieve. The script content should be valid SIEVE syntax. Only available on self-hosted mail servers — Gmail and Outlook do not support ManageSieve.
Inputs: name (required), content (required), accountId (required), confirmationId.
starADestructive
Star (flag) an email (sets the \Flagged flag) via IMAP — works with Gmail, Outlook, and custom domains. Simpler alternative to modify_labels.
Inputs: uid (required), accountId (required), folder, confirmationId.
unstarADestructive
Unstar (unflag) an email (removes the \Flagged flag) via IMAP — works with Gmail, Outlook, and custom domains. Simpler alternative to modify_labels.
Inputs: uid (required), accountId (required), folder, confirmationId.
use_templateARead-only
Apply a configured email template — fills {{variable}} placeholders with provided values and returns ready-to-use arguments for send_email or create_draft. Does not send; call send_email or create_draft with the returned args.
Inputs: templateId (required), cc, to, bcc, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 29 tools
Core operations (read_email, list_emails, search_emails, get_thread, send_email, reply_email, forward_email) are cleanly separated by resource and action. The main overlap is intentional and documented: mark_read/mark_unread/star/unstar are explicitly labeled 'simpler alternatives to modify_labels', and batch_operations overlaps with move_email/delete_email for bulk cases. An agent can still choose correctly, but four single-flag tools duplicating one modify_labels call add selection noise.
The dominant pattern is verb_noun (list_emails, send_email, get_thread, delete_filter, extract_contacts), which is applied consistently across most of the surface. Deviations are minor: bare verbs star/unstar, and noun-phrase names like mailbox_stats and batch_operations break the pattern slightly. No mixed casing or wildly different conventions.
29 tools is heavy, but the server spans genuinely broad territory (accounts, messages, folders, attachments, templates, SIEVE filters, bulk ops), so most tools map to real operations. Still, a handful could be consolidated — mark_read/mark_unread/star/unstar are just flag presets, and batch_operations partially duplicates move/delete. The count is at the upper bound of what this domain justifies.
Message lifecycle is well covered (list/read/search/send/draft/reply/forward/move/delete/threads/attachments/batch), and filters have full CRUD. However, there are notable gaps: folders can only be listed (no create/rename/delete folder), templates can be listed and used but never created or edited, and accounts can be listed and OAuth2-registered but not updated or removed. These missing operations will force agents into dead ends for common mailbox-management tasks.
Maintenance
Related MCP Connectors
Connect any IMAP/SMTP mailbox to Claude & ChatGPT: search, read, sort, draft. Sends only with OK.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Email: search, read, fetch attachments; attach files when the MCP client supports inputs.
Your mailboxes in ChatGPT and Claude: Gmail, iCloud, Fastmail, any IMAP. Passwords stay yours.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables Claude to read, search, draft, send, flag, and move email across multiple IMAP/SMTP mailboxes while keeping credentials local.-
- AlicenseNot gradedqualityBmaintenanceEnables Claude to read, search, send, and manage email across multiple IMAP/SMTP accounts through OAuth 2.1-secured MCP tools.MIT
- AlicenseBqualityDmaintenanceEnables email management through IMAP/SMTP, including reading, sending, replying, starring, deleting, labeling emails, handling attachments, and filtering by Gmail smart categories. Works with MCP-compatible clients like Claude Desktop and Claude Code using App Password authentication.1950 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude and other MCP clients to search, read, and, when permitted, send email from regular IMAP/SMTP mailboxes, with read-first behavior and send previews requiring confirmation. It defaults to Titan Mail but supports any provider that accepts password or app-password IMAP/SMTP.MIT