IMAP MCP
Allows reading, searching, sending, and managing email messages in mailboxes hosted on cPanel-based mail servers over IMAP and SMTP.
Allows reading, searching, sending, and managing messages on self-hosted Dovecot IMAP and SMTP mail servers.
Allows reading, searching, sending, and managing email messages in mailboxes hosted on Plesk-based mail servers over IMAP and SMTP.
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., "@IMAP MCP search my inbox for unread emails from my boss"
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 MCP
An MCP server that gives Claude read, manage and send access to any IMAP mailbox, for the mail that Google and Microsoft connectors do not cover: hosting company mailboxes (xneelo, cPanel, Plesk), self hosted Dovecot, anything that speaks plain IMAP and SMTP.
Runs locally over stdio. Your password stays in a local .env file, and mail goes directly from this machine to your mail server.
What Claude gets
Tool | What it does |
| Configured mailboxes, and whether each password is set |
| Every folder, plus the detected Sent, Trash and Drafts folders |
| Search by sender, recipient, subject, text, date, unread, flagged. Newest first, header only by default |
| One message: headers, body as text, attachment list |
| Save one attachment to disk and return the path |
| Mark read or unread |
| seen, flagged, answered, draft, deleted |
| Move or archive to another folder |
| Move to Trash, or erase permanently after confirmation |
| Send new mail, after a preview and confirmation |
| Threaded reply, sender only or reply all, after a preview |
| Save a draft for you to send yourself |
Related MCP server: IMAP MCP Server
Safety rules built in
Reading never marks mail as read. Every fetch uses BODY.PEEK and folders open read only, so Claude browsing the mailbox does not change its state.
get_message(mark_seen=True)is the only exception and has to be asked for.Sending and permanent deletion take two steps. The first call returns the exact message or the exact target plus a
confirmation_tokenand does nothing. Only a second call withcommit=Trueand that token acts. Change any argument between the two calls and the token stops matching.Delete means Trash.
delete_messagesmoves to the Trash folder unless you passpermanent=True.Per account read_only. Set
"read_only": trueon an account and every write tool refuses, while reading keeps working.Sent mail is filed. SMTP does not copy what it sends, so after a send the same bytes are appended to the Sent folder, where your normal mail client expects them.
Attachments go to disk, never into the conversation.
Setup
Install:
uv venv --python 3.12 uv pip install -e ".[dev]"Copy
accounts.example.jsontoaccounts.jsonand fill in your mail server details. Ask your host for the IMAP and SMTP settings if you do not have them. Passwords do not go in this file.Copy
.env.exampleto.envand add one password per account. The variable name is the account name, uppercased, with anything that is not a letter or digit turned into an underscore: accountworkreadsIMAP_PASSWORD_WORK. AddSMTP_PASSWORD_<NAME>only if the SMTP password differs.Prove the account works before wiring it in:
.venv\Scripts\python.exe scripts\smoke.pyRegister the server with Claude Code:
claude mcp add --scope user imap -- "C:\Claude Projects\IMAP MCP\.venv\Scripts\python.exe" -m imap_mcp.serverRestart Claude Code and check
/mcp.
Account fields
Field | Default | Notes |
| required | How you refer to the account in a prompt |
| required | |
| required | Usually the full email address |
| 993 | 143 for starttls or none |
|
|
|
| none | Leave blank to disable sending |
| 587 | 465 for ssl |
|
|
|
|
| Only if it differs |
|
| The address mail is sent as |
| blank | Display name on outgoing mail |
| detected | Set these only if detection picks the wrong folder |
| false | Blocks every write tool for this account |
| true | Set false only for a host whose certificate is broken. The connection stays encrypted, the server identity stops being checked |
| 60 | Seconds |
Sent, Trash and Drafts are found from the server's SPECIAL-USE flags, falling
back to the usual names including the Dovecot style INBOX.Sent.
Shared hosting and certificates
Hosts like xneelo point mail.yourdomain.co.za at a shared server whose
certificate is issued for the server's own name, so strict TLS verification
fails on the vanity hostname even though the connection is fine. Find the real
server name and use that instead:
python -c "import socket; print(socket.gethostbyaddr(socket.gethostbyname('mail.yourdomain.co.za')))"That returns something like www12.cpt3.host-h.net, which its certificate does
cover. The tradeoff is that if the host migrates your mailbox to another server,
the hostname changes and login starts failing: rerun the line above and update
accounts.json. The alternative is keeping the vanity hostname with
"verify_tls": false.
Not supported
OAuth2, so Gmail and Microsoft 365 are out of scope: they have first party connectors already. Password authentication over TLS only. Gmail with an app password does work if you want it here anyway.
Tests
.venv\Scripts\python.exe -m pytest # 35 unit tests, no networkEnd to end against a throwaway mail server in Docker, which exercises all 12 tools including sending, moving and permanent deletion without touching a real mailbox:
docker run -d --rm --name imapmcp-greenmail -p 3143:3143 -p 3025:3025 ^
-e GREENMAIL_OPTS="-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled" ^
greenmail/standalone:2.1.0
.venv\Scripts\python.exe scripts\e2e_greenmail.py
docker stop imapmcp-greenmailAvailable Tools
12 toolscreate_draftA
Save a draft in the Drafts folder for the user to review and send from their own mail client. Nothing is sent, so no confirmation is needed.
Inputs: cc, to, bcc, body, +4 more.
delete_messagesA
Delete messages. By default they move to Trash and can be recovered. permanent=True erases them, and that path previews first: call once to get a confirmation_token, then again with commit=True and that token.
Inputs: uid, uids, commit, folder, +3 more.
get_attachmentA
Save one attachment to disk and return the path. Identify it by index or filename from get_message. Defaults to the downloads folder in the project.
Inputs: uid, index, folder, account, +2 more.
get_messageA
Fetch one message by uid: headers, body as text, and the list of attachments (names and sizes, not their content). Long bodies are truncated at max_chars and flagged as such. The message stays unread unless mark_seen=True.
Inputs: uid, folder, account, mark_seen, +2 more.
list_accountsA
List the configured mailboxes and whether each has its password set.
Inputs: no named parameters.
list_foldersA
List every folder in a mailbox, with the detected Sent, Trash and Drafts folders. Folder names are case sensitive and may be nested, so always take names from here rather than guessing.
Inputs: account.
mark_readC
Mark one or more messages read (read_state=True) or unread.
Inputs: uid, uids, folder, account, +1 more.
move_messagesA
Move messages to another folder, for example to archive them. Use an exact folder name from list_folders. UIDs change on move.
Inputs: uid, uids, folder, account, +1 more.
reply_to_messageA
Reply to a message, keeping the thread intact. Goes to the sender only unless reply_all=True. Previews first and sends on the second call with commit=True and the confirmation_token, exactly like send_message.
Inputs: uid, body, commit, folder, +6 more.
search_messagesA
Search a folder and return message headers, newest first.
Dates are YYYY-MM-DD and IMAP compares by day only. 'text' is a server side substring search across the whole message and its behaviour varies by server. include_snippet=True adds the first 200 characters of each body, which means downloading every match, so keep the limit small when using it. raw_criteria takes a raw IMAP search string and overrides the other filters. Reading never marks anything as seen.
Inputs: text, limit, since, before, +10 more.
send_messageA
Send a new mail. The first call returns a preview of the exact message plus a confirmation_token and sends nothing. Call again with identical arguments, commit=True and that token to actually send. A copy is filed in the Sent folder. attachments are local file paths.
Inputs: cc, to, bcc, body, +6 more.
set_flagC
Add or remove an IMAP flag: seen, flagged, answered, draft or deleted.
Inputs: uid, flag, uids, value, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools have distinct purposes, but mark_read and set_flag overlap on the 'seen' flag, and delete_messages vs set_flag's 'deleted' could confuse agents. However, descriptions clarify the differences, so ambiguity is limited.
All 12 tools follow a consistent verb_noun pattern in snake_case (e.g., delete_messages, get_attachment, list_folders). No stylistic deviations or mixed conventions.
12 tools is within the ideal 3-15 range. Each tool covers a core email operation (send, read, search, manage), with no redundancies or missing essentials.
The surface covers key IMAP workflows: send, reply, draft, search, get message, attachment download, move, delete, flags, and folder/account listing. Minor gaps exist (e.g., folder creation, expunge, raw message fetch), but agents can accomplish typical tasks without failures.
Maintenance
Related MCP Connectors
Connect any IMAP/SMTP mailbox to Claude & ChatGPT: search, read, sort, draft. Sends only with OK.
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
Your mailboxes in ChatGPT and Claude: Gmail, iCloud, Fastmail, any IMAP. Passwords stay yours.
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables Claude to interact with email accounts via IMAP and SMTP, providing tools for searching, reading, sending, and managing emails across multiple providers.401,044 npm127MIT
- FlicenseNot gradedqualityDmaintenanceEnables Claude to read, search, send, and manage emails across multiple IMAP/SMTP accounts via a single deployment.-
- FlicenseNot gradedqualityBmaintenanceEnables Claude to read, search, draft, send, flag, and move email across multiple IMAP/SMTP mailboxes while keeping credentials local.-
- AlicenseAqualityBmaintenanceLets Claude Desktop read any IMAP mailbox and send emails via SMTP, with support for multiple mailboxes and locally stored credentials.1321 npmMIT