mcp-imap
Allows reading and sending emails via IMAP/SMTP for Gmail accounts, including listing folders, searching, moving, and marking as read.
Allows reading and sending emails via IMAP/SMTP for iCloud accounts, including listing folders, searching, moving, and marking as read.
Allows reading and sending emails via IMAP/SMTP for Infomaniak accounts, including listing folders, searching, moving, and marking as read.
Allows reading and sending emails via IMAP/SMTP for Proton Mail (via Proton Bridge) accounts, including listing folders, searching, moving, and marking as read.
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., "@mcp-imaplist my recent unread 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.
mcp-imap
A minimal MCP server for reading and sending emails via IMAP/SMTP — works with any mail provider (Infomaniak, Gmail, iCloud, Proton Bridge, etc.) and supports multiple accounts in a single instance.
Zero external dependencies — uses Python's built-in imaplib, smtplib and email modules only.
Compatible with Hermes, Claude Desktop, Cursor, and any MCP-compatible client.
Tools
Tool | Description |
| List all configured mail accounts |
| List available IMAP folders |
| List recent emails (with unread filter) |
| Read full email content by UID |
| Search emails by keyword (subject or sender) |
| Send an email via SMTP |
| Move email to another folder |
| Mark email as read |
All tools accept an optional account parameter to target a specific account (e.g. "pro", "perso"). Omit it to use the default account.
Related MCP server: mcp-email-client
Installation
git clone https://github.com/TheGoldfingerCH/mcp-imap
cd mcp-imap
cp .env.example .env
# Edit .env with your credentialsPython 3.12+ required. No pip install needed.
Multi-account setup
Add as many accounts as you need using the MAIL_<ACCOUNT>_* pattern in .env:
# Default account
MAIL_USER=you@yourdomain.com
MAIL_PASS=password
MAIL_IMAP_HOST=imap.example.com
MAIL_SMTP_HOST=smtp.example.com
# Second account named "pro"
MAIL_PRO_USER=pro@company.com
MAIL_PRO_PASS=password
MAIL_PRO_IMAP_HOST=imap.company.com
MAIL_PRO_SMTP_HOST=smtp.company.com
# Third account named "perso"
MAIL_PERSO_USER=me@gmail.com
MAIL_PERSO_PASS=app_password
MAIL_PERSO_IMAP_HOST=imap.gmail.com
MAIL_PERSO_SMTP_HOST=smtp.gmail.comThen in the AI chat:
list_emails()→ default account inboxlist_emails(account="pro")→ pro account inboxsend_email(to="...", subject="...", body="...", account="perso")→ send from perso account
Configuration
Edit .env:
MAIL_IMAP_HOST=imap.yourprovider.com
MAIL_IMAP_PORT=993
MAIL_SMTP_HOST=smtp.yourprovider.com
MAIL_SMTP_PORT=587
MAIL_USER=you@yourdomain.com
MAIL_PASS=your_password
MAIL_FROM=you@yourdomain.comHermes
Add to ~/.hermes/config.yaml (or ~/.hermes-prive/config.yaml for a private instance):
mcp_servers:
- name: imap
command: python
args:
- /path/to/mcp-imap/src/cli.py
env:
MAIL_IMAP_HOST: imap.yourprovider.com
MAIL_IMAP_PORT: "993"
MAIL_SMTP_HOST: smtp.yourprovider.com
MAIL_SMTP_PORT: "587"
MAIL_USER: you@yourdomain.com
MAIL_PASS: your_password
MAIL_FROM: you@yourdomain.comClaude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"imap": {
"command": "python",
"args": ["/path/to/mcp-imap/src/cli.py"],
"env": {
"MAIL_IMAP_HOST": "imap.yourprovider.com",
"MAIL_IMAP_PORT": "993",
"MAIL_SMTP_HOST": "smtp.yourprovider.com",
"MAIL_SMTP_PORT": "587",
"MAIL_USER": "you@yourdomain.com",
"MAIL_PASS": "your_password",
"MAIL_FROM": "you@yourdomain.com"
}
}
}
}Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"imap": {
"command": "python",
"args": ["/path/to/mcp-imap/src/cli.py"],
"env": {
"MAIL_IMAP_HOST": "imap.yourprovider.com",
"MAIL_IMAP_PORT": "993",
"MAIL_SMTP_HOST": "smtp.yourprovider.com",
"MAIL_SMTP_PORT": "587",
"MAIL_USER": "you@yourdomain.com",
"MAIL_PASS": "your_password",
"MAIL_FROM": "you@yourdomain.com"
}
}
}
}Security
Credentials are read from environment variables or
.env— never hardcoded.envis in.gitignore— never commit itOnly
imaplib,smtplib,email(Python stdlib) — no supply chain riskEmail body is truncated at 4000 chars to protect context window
Provider examples
Provider | IMAP host | SMTP host | SMTP port |
Infomaniak |
|
| 587 |
Gmail |
|
| 587 |
iCloud |
|
| 587 |
Proton Bridge |
|
| 1025 |
License
MIT — © TheGoldfinch
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for MailTempo's public free temporary email inboxes.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
A MCP server for Gmail that lets you search, read, and draft emails and replies.
MCP server for Nylas — read email, calendars, events and contacts, and send email or create events.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceSelf-hosted MCP server for any IMAP/SMTP inbox. Multi-account in one config. Built for Claude Code.-
- FlicenseCqualityDmaintenanceA Python-based MCP server for managing email configurations, sending emails, and reading the latest unread emails.1218-
- AlicenseNot gradedqualityCmaintenanceCross-platform MCP server and CLI for email operations, including send, read, search, and contact management, compatible with Gmail, Outlook, Yahoo, and any IMAP/SMTP providers.8 npm1MIT
- AlicenseAqualityDmaintenanceLocal MCP server for multi-account IMAP/SMTP email (iCloud + Gmail via app-specific passwords). Never marks mail read. Cross-folder search, idempotent sends, TLS verified.8MIT