Click on "Install 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-mcpGive me a daily digest of my recent emails"
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
Generic IMAP+SMTP MCP server for AI agents.
Connect any email account to any AI agent (Claude, Gemini, Codex, Copilot…). Intent-first design: high-level tools that match real user workflows, backed by a clean IMAP/SMTP core.
Problem: AI agents have no native email access.
Why: IMAP+SMTP are universal, server-agnostic, and require no OAuth2 dance.
How: FastMCP tools layer, pure stdlib SMTP, imapclient for IMAP, secrets via bw-env.Architecture
mail_mcp/
├── config.yaml # Non-sensitive settings (hosts, ports, env var names)
├── config.py # @lru_cache loader + 3-tier secret resolution
│
├── core/
│ ├── models.py # Pydantic: Message, MessageSummary, Folder, Address…
│ ├── imap_client.py # IMAPClient context-manager — search, fetch, flags, move
│ └── smtp_client.py # SMTPClient — send, reply, forward, draft
│
├── tools/
│ ├── guide.py # mail_guide() — agent orientation entry point
│ ├── read.py # check_inbox, daily_digest, search_messages, get_thread…
│ ├── compose.py # send_message, reply_message, forward_message, save_draft
│ └── manage.py # list_folders, mark_messages, move/archive/delete/spam
│
├── server.py # FastMCP root — mounts all sub-MCPs
└── cli.py # Typer+Rich admin: serve, status, inbox, folders, accountsSecret resolution (3 tiers)
1. Process env → fastest (already injected by shell or MCP host)
2. bw-env login → zsh -l -c 'printf "%s" "${VAR}"' (Bitwarden GLOBAL_ENV_VARS)
3. local .env → dev override only, never committedSupported accounts
Account | IMAP | SMTP | Server |
Polytechnique (X) |
|
| Zimbra |
More accounts: add an entry in config.yaml — no code change needed.
Quick start
# Install (editable)
uv tool install --editable .
# Check credentials
mail-mcp status
# List folders
mail-mcp folders
# Show inbox
mail-mcp inbox -n 5
# Start MCP server
mail-mcp serveMCP agent registration
Claude Code (~/.claude.json)
"mail-mcp": {
"command": "zsh",
"args": ["-l", "-c", "/home/kpihx/.local/bin/mail-mcp serve"]
}Codex (~/.codex/config.toml)
[mcp_servers.mail_mcp]
command = "zsh"
args = ["-l", "-c", "/home/kpihx/.local/bin/mail-mcp serve"]Tool reference
Tool | Intent |
| Agent orientation — start here |
| Unread count + last N summaries |
| Structured morning overview |
| Browse a folder |
| Full body by UID |
| Flexible search (query, sender, date, flags) |
| Unread shortcut |
| Full thread by Message-ID |
| New email |
| Reply by UID |
| Forward by UID |
| Draft to Drafts folder |
| All IMAP folders |
| Seen / flagged / answered flags |
| Move UIDs to folder |
| Move to Archive |
| Move to Trash |
| Permanent delete + expunge |
| Move to Spam/Junk |
Security
Credentials are never stored in
config.yaml— only env var names.Secrets live in Bitwarden (
GLOBAL_ENV_VARS) and are injected viabw-env/ login shell..envis gitignored and for local dev only.No OAuth2, no refresh token storage — IMAP password auth via TLS only.
Roadmap (v0.2+)
Multi-account support with account selector
CalDAV / CardDAV integration (Zimbra has both)
IDLE push notifications
Attachment download tool
Additional email providers (Gmail OAuth2, Outlook EWS)
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.