imap-mcp
Provides tools for interacting with Migadu email accounts via IMAP/SMTP, enabling tasks such as searching, reading, forwarding (with whitelist), and managing 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-mcpFind invoices from last month in my personal account"
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 — let your AI manage your mailbox
An MCP server that turns any plain IMAP mailbox into something Claude (or any MCP client) can work in: search it, clean it up, file things away, pull out attachments and forward receipts to your accounting system — while hard, config-level guardrails make sure it can never send to strangers or delete anything permanently.
Gmail and Microsoft 365 have official connectors. This is for the rest of your mail: self-hosted servers, Migadu, your domain host's IMAP, the old business account you still have to check. Standard IMAP/SMTP is all it needs.
What you can use it for
Inbox cleanup that respects your judgment. Most of what lands in an inbox isn't spam — it's just not important: newsletters you once signed up for, event marketing, "your webinar starts in 2 hours" for a webinar that ended last month, renewal warnings for things you already renewed. Ask your AI to sweep the inbox, trash the noise (recoverable — trash is the only "delete" that exists), and ask you about anything it isn't sure of.
Receipts and invoices to your accounting system. Have the AI find
invoices and receipts across folders, file them in a Receipts folder,
download the PDFs, or forward them directly to your bookkeeper or your
accounting system's inbox address (e-conomic, Billy, Dinero, …) — but
only to addresses you've whitelisted in the config.
Spend your time on what matters. Instead of wading through 60 unread mails, ask: "go through my inbox, summarize what actually needs me, star it and mark it unread — archive or trash the rest." You come back to a mailbox where the flagged items are the to-do list and everything else is filed.
Find that mail you filed away and forgot. Cross-folder search means "somewhere in this account there's a confirmation from my Apple developer enrollment" is a one-line request, not ten minutes of clicking through folders.
Example prompts that work well in Claude Desktop / Cowork:
Go through the INBOX on
personal. Move obvious newsletters and marketing to trash, file receipts into a Receipts folder, and give me a prioritized summary of what needs my attention. Star what I need to handle and mark it unread. Ask before touching anything you're unsure about.
Here's a spreadsheet of missing receipts. Search all folders for each one (supplier, amount, date), download the PDFs, and forward the mails to my bookkeeping inbox. Show me the list before you send anything.
Related MCP server: fagents-mcp
Safety model
The guardrails live in config, not in prompt instructions — so they hold no matter what the model is asked to do, including by a malicious mail trying to prompt-inject it:
Reading is always allowed, and folders are opened read-only, so nothing even gets marked as read by accident.
Writes require
"allow_writes": trueper account inaccounts.json— without it every write tool refuses.No permanent deletion. "Delete" means move to the trash folder (
trash_folder, defaultTrash), so everything is recoverable until the server's own retention empties it.Forwarding only to a whitelist.
forward_messagerequires an"smtp"block and an"allow_send_to"list on the account. Recipients are matched against the list (wildcards like*@e-conomic.dkare fine) — anything else is refused hard. There is no send-new-mail tool:create_draftcan compose mail (including replies), but only saves it to the Drafts folder — you review and hit send in your own mail client.
Setup
Requires Python 3.11+ on PATH and Claude Desktop installed.
Clone/copy this folder and run the setup script:
Windows (PowerShell):
.\setup.ps1macOS/Linux:
bash setup.sh
The script creates a venv, installs dependencies, creates
accounts.jsonfrom the template (if missing) and registers the server asimap-mailin Claude Desktop's config (Windows:%APPDATA%\Claude\, macOS:~/Library/Application Support/Claude/).Fill in
accounts.json— host and username per account. The key (e.g.personal) is the name Claude uses as theaccountparameter.encryption:"ssl"(port 993, default) or"starttls"(port 143).Use an app password if your provider supports them.
accounts.jsonis gitignored — credentials are entered per machine.
Store each account's password — preferably in the OS keychain (Windows:
.venv\Scripts\python.exe, macOS/Linux:.venv/bin/python):.venv/bin/python server.py --set-password "personal"and leave
"password"out ofaccounts.json. Setting"password"in the file also works (see Credential storage for the trade-off).Test the configuration:
.venv/bin/python server.py --checkThis reports where each account's password comes from and fails loudly if one is missing.
Restart Claude Desktop.
Tools
Tool | Does |
| List configured accounts |
| Folders in an account (INBOX, Sent, …) |
| Search (sender/subject/text/date), newest first — one folder or the whole account ( |
| Read one message incl. its attachment list |
| Save one attachment to a directory (never overwrites) |
| Create a new folder (requires |
| Move messages between folders (requires |
| Move messages to the trash folder (requires |
| Star/unstar and mark read/unread (requires |
| Save a draft — new mail or reply, optionally with local files attached — in the Drafts folder; never sends (requires |
| Forward a message incl. attachments (requires |
Credential storage
Passwords are resolved per account in this order:
"password"inaccounts.json— works everywhere, but plain text.The OS keychain (macOS Keychain, Windows Credential Manager, Secret Service/KWallet on Linux) under service
imap-mcpwith the account name as key. Store one with:.venv/bin/python server.py --set-password "personal"The interactive prompt keeps the secret out of shell history and the process table.
Be honest about what the keychain buys you — it differs per platform:
macOS: Keychain items carry an ACL of trusted apps, so a foreign process calling
security find-generic-passwordtriggers a user prompt. Real protection — but an attacker who can run this project's venv python and importkeyringgets the password without a prompt. Better than a file, not a vault.Windows: Credential Manager is DPAPI-backed per user account. Any process running as your user can decrypt it, so against a local attacker it is roughly equivalent to the plain-text file. The gain is that the secret no longer sits in a file that can be synced, backed up or committed by accident.
Linux: depends entirely on a running Secret Service (GNOME Keyring / KWallet). On a headless server there is none — keep the password in
accounts.jsonthere; the error message will tell you.
In short: the keychain protects well against accidental leaks (git, backups, file sync, a config flashed on screen) and not at all against a targeted local attacker running as your user. That trade-off is why both options exist.
Belt and braces either way: install.py creates accounts.json with
mode 600, and the server warns on startup and --check if the config
file lives in a synced folder (Dropbox, iCloud, OneDrive, Google Drive).
Notes and limitations
Search criteria containing non-ASCII characters are not sent to the IMAP server (many servers reject UTF-8 SEARCH) — they are filtered locally instead. Always constrain with
since/before; otherwise only the newest ~300 matching messages are scanned. The response reports exactly which folders were searched (folders_searched/folders_not_searched) and setsscan_truncated: truewhenever the budget stopped the traversal early, so the model knows to narrow the range.With
"password"set,accounts.jsonstores credentials in plain text. Prefer the OS keychain (see Credential storage), keep the file out of git and sync services (it is gitignored here), prefer app passwords, and treat the file like a password manager export.Authentication is plain IMAP/SMTP login — no OAuth. Gmail and Microsoft 365 accounts are better served by their official connectors anyway; this server is for everything else.
Mail content is untrusted input. The config-level guardrails limit the blast radius of prompt injection, but it's still wise to tell your AI to treat mail text as data, not instructions, and to confirm with you before forwarding anything.
Tests
.venv/bin/python test_server.pyRuns offline — verifies tool registration, config validation and the write/send gating without touching any mail server.
License
MIT — see LICENSE.
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.
Related MCP Servers
- FlicenseAqualityDmaintenanceAn MCP server that enables Claude to directly access and manage email through IMAP. It provides tools for reading, searching, organizing, and drafting emails within your mailbox.Last updated9

fagents-mcpofficial
Alicense-qualityBmaintenanceMCP server that enables Claude Code agents to send and read emails via SMTP/IMAP with per-agent credential isolation and audit logging.Last updatedMIT- Alicense-qualityDmaintenanceA cross-platform MCP server that provides Claude with email access via IMAP, supporting multiple email providers and account management.Last updatedMIT
- Flicense-qualityCmaintenanceLocal IMAP/SMTP MCP server that lets Claude read, search, draft, send, flag, and move mail across multiple IMAP mailboxes. Credentials stay on your machine.Last updated
Related MCP Connectors
Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Shipmail MCP server for AI agent custom-domain email inboxes with REST API and webhooks.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/friisconsult/imap-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server