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 "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., "@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: outlook-mcp-server
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 installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/TheGoldfingerCH/mcp-imap'
If you have feedback or need assistance with the MCP directory API, please join our Discord server