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.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Your IMAP mailbox as an MCP server: read, search and (if you allow it) organize mail. Open source.
MCP server for MailTempo's public free temporary email inboxes.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
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 gradedqualityDmaintenanceCross-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.29 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.835 PyPIMIT