by n24q02m
Provides IMAP/SMTP email access for AI agents, offering multi‑account management, auto‑discovery of provider settings, and a set of composite tools for searching, reading, sending and organizing messages.
Better Email MCP supplies AI agents with full‑featured email capabilities via IMAP and SMTP. It supports multiple accounts (Gmail, Outlook, Yahoo, iCloud, Zoho, ProtonMail, and custom IMAP) and exposes six composite tools that let agents search, read, compose, reply, forward, and organize messages in a single API call.
npx -y @n24q02m/better-email-mcp
PUBLIC_URL=https://your-domain.com \
DCR_SERVER_SECRET=$(openssl rand -hex 32) \
npx -y @n24q02m/better-email-mcp
EMAIL_PROVIDER, EMAIL_USER, EMAIL_APP_PASSWORD for stdio mode, orPUBLIC_URL and DCR_SERVER_SECRET for HTTP mode. Multiple accounts can be supplied via EMAIL_CREDENTIALS (comma‑separated user:pass[:host[:port]]).messages, folders, attachments, send, setup, help). Each tool maps to a set of actions that can be invoked from any compatible AI agent.In‑Reply‑To and References headers)Q: How do I add multiple email accounts?
A: Use the EMAIL_CREDENTIALS environment variable with a comma‑separated list, e.g., user1@gmail.com:pass1,user2@outlook.com:pass2.
Q: Do I need to register an Azure app for Outlook OAuth?
A: No. The server ships with a public Azure client (d56f8c71-9f7c-43f4-9934-be29cb6e77b0). You only need to provide PUBLIC_URL for the redirect.
Q: Can I run the server locally without Docker?
A: Yes. After installing with npx, launch the binary directly or use bun run dev as described in the repo.
Q: What storage is used for OAuth tokens?
A: Tokens are kept in memory for the hosted service and written to tokens/<sub>.json with mode 600 for self‑hosted HTTP mode.
Q: Is the server compatible with Claude, Cursor, or other AI coding assistants?
A: All supported agents can call the MCP endpoints; the documentation provides sample mcp.json snippets for Claude Code, Codex, Gemini CLI, Cursor, and Windsurf.
mcp-name: io.github.n24q02m/better-email-mcp
IMAP/SMTP email server for AI agents -- 6 composite tools with multi-account and auto-discovery
| Project | Tagline | Tag |
|---|---|---|
| better-code-review-graph | Knowledge graph for token-efficient code reviews -- fixed search, configurabl... | MCP |
| better-email-mcp | IMAP/SMTP email server for AI agents -- 6 composite tools with multi-account ... | MCP |
| better-godot-mcp | Composite MCP server for Godot Engine -- 17 mega-tools for AI-assisted game d... | MCP |
| better-notion-mcp | Markdown-first Notion API server for AI agents -- 10 composite tools replacin... | MCP |
| better-telegram-mcp | MCP server for Telegram with dual-mode support: Bot API (httpx) for quick bot... | MCP |
| claude-plugins | Full documentation: mcp.n24q02m.com — unified docs for all 8 servers + the mc... | Marketplace |
| imagine-mcp | Production-grade MCP server for image and video understanding + generation ac... | MCP |
| jules-task-archiver | Chrome Extension for bulk operations on Jules tasks via batchexecute API -- a... | Tooling |
| mcp-core | Unified MCP Streamable HTTP 2025-11-25 transport, OAuth 2.1 Authorization Ser... | MCP |
| mnemo-mcp | Persistent AI memory with hybrid search and embedded sync. Open, free, unlimi... | MCP |
| qwen3-embed | Lightweight Qwen3 text embedding and reranking via ONNX Runtime and GGUF | Library |
| skret | Secrets without the server. | CLI |
| web-core | Shared web infrastructure package for search, scraping, HTTP security, and st... | Library |
| wet-mcp | Open-source MCP Server for web search, content extraction, library docs & mul... | MCP |
help tool + MCP Resources2026-05-02 -- Architecture stabilization update
Past months saw significant churn around credential handling and the daemon-bridge auto-spawn pattern. This caused multi-process races, browser tab spam, and inconsistent setup UX across plugins. As of v<auto>, the architecture is stable: 2 clean modes (stdio + HTTP), no daemon-bridge layer, no auto-spawn from stdio.
Apologies for the instability period. If you encountered issues with prior versions, please update to v<auto>+ and follow the current
docs/setup-manual.md-- most prior workarounds are no longer needed.Related plugins from the same author:
- wet-mcp -- Web search + content extraction
- mnemo-mcp -- Persistent AI memory
- imagine-mcp -- Image/video understanding + generation
- better-notion-mcp -- Notion API
- better-email-mcp -- Email management
- better-telegram-mcp -- Telegram
- better-godot-mcp -- Godot Engine
- better-code-review-graph -- Code review knowledge graph
All plugins share the same architecture -- install once, learn pattern transfers.
Full docs at mcp.n24q02m.com/servers/better-email-mcp/:
Install with AI agent -- paste this to your AI coding agent:
Install MCP server
better-email-mcpfollowing the steps at https://raw.githubusercontent.com/n24q02m/claude-plugins/main/plugins/better-email-mcp/setup-with-agent.md
| Tool | Actions | Description |
|---|---|---|
messages |
search, read, mark_read, mark_unread, flag, unflag, move, archive, trash |
Search, read, and organize emails |
folders |
list |
List mailbox folders |
attachments |
list, download |
List and download email attachments |
send |
new, reply, forward |
Compose, reply, and forward emails |
setup |
status, start, reset, complete |
Credential setup via browser relay, status check, reset, re-resolve |
help |
- | Get full documentation for any tool |
| URI | Description |
|---|---|
email://docs/messages |
Message operations reference |
email://docs/folders |
Folder operations reference |
email://docs/attachments |
Attachment operations reference |
email://docs/send |
Send/compose reference |
email://docs/help |
Full documentation |
Run as a multi-user HTTP server with OAuth 2.1 authentication:
{
"mcpServers": {
"better-email": {
"type": "http",
"url": "https://better-email-mcp.n24q02m.com/mcp"
}
}
}
Single multi-user mode (relay form for App-Password providers + bundled Outlook OAuth device-code):
docker run -p 8080:8080 \
-e PUBLIC_URL=https://your-domain.com \
-e DCR_SERVER_SECRET=$(openssl rand -hex 32) \
n24q02m/better-email-mcp:latest
Users provide their own email credentials through the OAuth flow / paste form. No server-side EMAIL_CREDENTIALS needed. Outlook OAuth uses the bundled public Azure client (d56f8c71-9f7c-43f4-9934-be29cb6e77b0, Thunderbird-pattern) -- no user-side Azure app registration needed.
In HTTP mode, Outlook/Hotmail/Live accounts use OAuth2 device-code automatically. On first use:
tokens/<sub>.json)OAuth uses the bundled public Azure client (d56f8c71-9f7c-43f4-9934-be29cb6e77b0, Thunderbird-pattern) -- no user-side Azure registration needed.
In stdio mode, Outlook accounts use an App Password instead (Outlook Account Settings → Security → Advanced security options → App passwords).
| Variable | Required | Default | Description |
|---|---|---|---|
EMAIL_PROVIDER |
Yes (stdio, single-account) | - | Provider key: gmail, outlook, yahoo, icloud, zoho, custom |
EMAIL_USER |
Yes (stdio, single-account) | - | Email address |
EMAIL_APP_PASSWORD |
Yes (stdio, single-account) | - | App password (Gmail/Yahoo/iCloud) or Outlook App Password |
EMAIL_IMAP_HOST |
No (custom only) | - | Custom IMAP hostname when EMAIL_PROVIDER=custom |
EMAIL_CREDENTIALS |
Alternative (multi-account) | - | Legacy user@gmail.com:app-password (comma-separated for multi-account) |
PUBLIC_URL |
Yes (http) | - | Server's public URL for OAuth redirects |
DCR_SERVER_SECRET |
Yes (http) | - | HMAC secret for stateless client registration |
PORT |
No | 8080 |
Server port (http mode) |
OUTLOOK_CLIENT_ID |
No | d56f8c71-9f7c-43f4-9934-be29cb6e77b0 (bundled public client) |
Override the bundled Azure AD public client for self-hosted Outlook OAuth2 |
OUTLOOK_EMAIL |
No | - | Workaround when Microsoft device-code response omits the email field |
EMAIL_CREDENTIALS=user1@gmail.com:pass1,user2@outlook.com:pass2,user3@yahoo.com:pass3
# Custom hostname (default port 993, implicit TLS)
EMAIL_CREDENTIALS=user@custom.com:password:imap.custom.com
# Custom hostname with a custom port
EMAIL_CREDENTIALS=user@custom.com:password:imap.custom.com:1993
# Local IMAP proxy -- "localhost" is accepted as a host, even without a dot
EMAIL_CREDENTIALS=user@custom.com:password:localhost:1993
Each account can use its own host and port. A non-993 port is treated as plaintext/STARTTLS -- the usual shape for a local IMAP proxy (for example email-oauth2-proxy).
| Query | Description |
|---|---|
UNREAD |
Unread emails |
FLAGGED |
Starred emails |
SINCE 2024-01-01 |
Emails after date |
FROM boss@company.com |
Emails from sender |
SUBJECT meeting |
Emails matching subject |
UNREAD SINCE 2024-06-01 |
Compound filter |
| Provider | Auth | Save-to-Sent |
|---|---|---|
| Gmail | App Password | Auto (skipped) |
| Yahoo | App Password | Auto (skipped) |
| iCloud/Me.com | App-Specific Password | Auto (skipped) |
| Outlook/Hotmail/Live | OAuth2 (Device Code) | IMAP APPEND |
| Zoho | App Password | IMAP APPEND |
| ProtonMail | ProtonMail Bridge | IMAP APPEND |
| Custom | Via email:pass:imap.host |
IMAP APPEND |
git clone https://github.com/n24q02m/better-email-mcp.git
cd better-email-mcp
bun install
bun run dev
This plugin implements TC-NearZK (in-memory, ephemeral). See mcp-core/docs/TRUST-MODEL.md for full classification.
| Mode | Storage | Encryption | Who can read your data? |
|---|---|---|---|
| HTTP n24q02m-hosted (default) | In-memory Map<sub, OAuthToken> |
In-process only | Server process (cleared on restart) |
| HTTP self-host | Same as hosted | Same | Only you (admin = user) |
| stdio proxy | ~/.better-email-mcp/config.json |
AES-GCM, machine-bound key | Only your OS user (file perm 0600) |
MIT -- See LICENSE.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by modelcontextprotocol
An MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.
by danny-avila
Provides a self‑hosted ChatGPT‑style interface supporting numerous AI models, agents, code interpreter, image generation, multimodal interactions, and secure multi‑user authentication.
by block
Automates engineering tasks on local machines, executing code, building projects, debugging, orchestrating workflows, and interacting with external APIs using any LLM.
by RooCodeInc
Provides an autonomous AI coding partner inside the editor that can understand natural language, manipulate files, run commands, browse the web, and be customized via modes and instructions.
by pydantic
A Python framework that enables seamless integration of Pydantic validation with large language models, providing type‑safe agent construction, dependency injection, and structured output handling.
by mcp-use
A Python SDK that simplifies interaction with MCP servers and enables developers to create custom agents with tool‑calling capabilities.
by lastmile-ai
Build effective agents using Model Context Protocol and simple, composable workflow patterns.
by Klavis-AI
Provides production‑ready MCP servers and a hosted service for integrating AI applications with over 50 third‑party services via standardized APIs, OAuth, and easy Docker or hosted deployment.
by nanbingxyz
A cross‑platform desktop AI assistant that connects to major LLM providers, supports a local knowledge base, and enables tool integration via MCP servers.
{
"mcpServers": {
"better-email": {
"command": "npx",
"args": [
"-y",
"@n24q02m/better-email-mcp"
],
"env": {
"PUBLIC_URL": "<YOUR_PUBLIC_URL>",
"DCR_SERVER_SECRET": "<YOUR_DCR_SERVER_SECRET>"
}
}
}
}claude mcp add better-email npx -y @n24q02m/better-email-mcp