IMAP Mini MCP is a lightweight MCP server that enables AI agents to interact with email accounts via IMAP for reading, organizing, and creating drafts — but cannot send or delete emails.
Email Reading & Search
List emails by date range (last 24h, 7 days, 30 days, 90 days, 365 days, or all)
Filter by sender address, domain, subject, unread status, or presence of attachments
Fetch full email content (subject, from, to, date, body, attachment metadata)
Download attachment files by ID
Folder Management
List all folders and create new folders (including subfolders)
Move individual emails between folders
Bulk move all emails from a specific sender or domain to a folder
Email Organization
Star/unstar emails and list all starred emails across folders
Mark emails as read or unread
Draft Management
Create new email drafts (with optional CC, BCC, reply threading)
Create reply drafts to existing emails (with optional reply-all)
Update/replace existing drafts
Compatibility
Works with any standard IMAP server (Gmail, Outlook, Fastmail, etc.) and local bridges like ProtonMail Bridge
Uses stable composite email IDs that remain valid when emails are moved between folders
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., "@IMAP Mini MCPSummarize the emails I received in the last 24 hours"
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.
IMAP Mini MCP
A lightweight MCP (Model Context Protocol) server for reading IMAP email and creating draft replies. Works with any standard IMAP server (Gmail, Outlook, Fastmail, etc.) and local bridges like ProtonMail Bridge.
Agents can read, search, move, star, and organize emails, and compose drafts — but cannot send or delete emails.
See CHANGELOG.md for recently added features.
Workflow Recommendation
I highly recommend using a speech-to-text tool (e.g. SuperWhisper on Mac or Whisperflow on Windows) and connecting your AI desktop application (Claude, Codex, etc.) to this MCP server. That way you can converse with your email inbox using speech, which will dramatically speed up your workflow.
How to Use
Agent configuration
Add to your MCP client config (e.g. claude_desktop_config.json):
{
"mcpServers": {
"imap-mini-mcp": {
"command": "node",
"args": ["/path/to/imap-mini-mcp/dist/index.js"],
"env": {
"IMAP_HOST": "imap.example.com",
"IMAP_USER": "you@example.com",
"IMAP_PASS": "your-password"
}
}
}
}The args path must point to the built dist/index.js. Add any optional variables to the env block as needed.
Environment variables
Variable | Required | Default | Description |
| yes | — | IMAP server hostname (e.g. |
| yes | — | Email address or username |
| yes | — | Password or app-specific password |
| no |
| IMAP server port |
| no |
| Use TLS for the connection |
| no |
| Upgrade to TLS via STARTTLS (when |
| no |
| Reject self-signed TLS certificates |
For most providers (Gmail, Outlook, Fastmail), the defaults work — just set host, user, and password.
For ProtonMail Bridge — all five settings below are required (the bridge listens on localhost without TLS, uses a self-signed certificate, and does not support STARTTLS):
IMAP_HOST=127.0.0.1
IMAP_PORT=1143
IMAP_SECURE=false
IMAP_STARTTLS=false
IMAP_TLS_REJECT_UNAUTHORIZED=falseOr as MCP client config:
{
"mcpServers": {
"imap-mini-mcp": {
"command": "node",
"args": ["/path/to/imap-mini-mcp/dist/index.js"],
"env": {
"IMAP_HOST": "127.0.0.1",
"IMAP_PORT": "1143",
"IMAP_SECURE": "false",
"IMAP_STARTTLS": "false",
"IMAP_TLS_REJECT_UNAUTHORIZED": "false",
"IMAP_USER": "you@proton.me",
"IMAP_PASS": "your-bridge-password"
}
}
}
}Tools
Every email is identified by a composite id (YYYY-MM-DDTHH:mm:ss.<Message-ID>) that is globally unique and stable across folder moves. Use the id returned by find_emails to fetch content, download attachments, move emails, or create reply drafts. Action tools accept an optional mailbox hint for faster lookup; if omitted, all folders are searched.
find_emails
Search and filter emails. All parameters are optional — calling with no parameters returns all emails from INBOX, sorted newest-first.
Parameter | Type | Default | Description |
| string | — | Only emails after this time. Relative ( |
| string | — | Only emails before this time. Same formats as |
| string | — | Substring match on sender address (e.g. |
| string | — | Substring match on subject line |
| boolean |
| Only return unread emails |
| boolean |
| Only return emails with attachments |
| string |
| Folder to search |
| number | — | Maximum number of results (newest first) |
Examples:
Use case | Parameters |
Last 24 hours |
|
Last 7 days, max 10 |
|
Unread emails |
|
From a domain |
|
With attachments, last month |
|
Specific sender, in Sent folder |
|
Other tools
Tool | Description | Key parameters |
| Starred emails across all folders | — |
| Full email content by id |
|
| Download an attachment |
|
| List all folders | — |
| Create a new folder |
|
| Move an email to another folder |
|
| Move all emails from a sender |
|
| Move all emails from a domain |
|
| Star an email |
|
| Unstar an email |
|
| Mark an email as read |
|
| Mark an email as unread |
|
| Create a new draft |
|
| Create a reply draft from an existing email |
|
| Replace an existing draft (Drafts folder only) |
|
Troubleshooting
"IMAP connection closed unexpectedly" or "Server disconnected"
This almost always means the server rejected the connection due to a TLS/STARTTLS mismatch. Verify these environment variables are set correctly in your MCP client config:
Variable | Check |
| Correct hostname or IP |
| Matches your server (993 for TLS, 143/1143 for plain) |
|
|
|
|
|
|
Local IMAP bridges (e.g. ProtonMail Bridge) typically require IMAP_SECURE=false, IMAP_STARTTLS=false, and IMAP_TLS_REJECT_UNAUTHORIZED=false. See the ProtonMail Bridge config example in the Environment variables section above.
"IMAP authentication failed"
Check that IMAP_USER and IMAP_PASS are correct. Some providers (e.g. Gmail) require an app-specific password rather than your account password.
"Cannot reach IMAP server — connection refused"
The IMAP server is not running or not listening on the configured host and port. For local bridges, make sure the bridge application is running.
Development
Build and run
npm install
npm run buildLocal development with .env
For running the server directly (outside of an MCP client), copy .env.example to .env and fill in your credentials, then:
npm startWhen used through an MCP client, credentials are provided via the client config's env block instead.
Testing
Tests use vitest and mock the IMAP layer — no real server connection is needed:
npm test # run once
npm run test:watch # watch mode
npm run lint # type-check only