imap-2-mcp
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-2-mcpsearch for emails with 'meeting' in the last week"
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-2-mcp
MCP server that makes IMAP mailboxes searchable for AI clients such as Claude. It combines live IMAP access with a local SQLite FTS5 index that also covers attachment contents (PDF/DOCX/XLSX/text), so full-text search stays fast even for large mailboxes (50k+ messages).
Read-only against existing mail: it never sends, deletes, moves, or flags anything. The single write operation is
create_draft, which APPENDs a new draft to the drafts folder — sending stays a manual step in your mail client (there is no SMTP in this project).
See SPEC.md for the full design and rationale.
Features (Phase 1)
Multi-account IMAP (SSL), read-only against existing mail.
Background sync worker: initial full index + periodic incremental updates.
Attachment text extraction (PDF, DOCX, XLSX, plain text).
Draft creation (
create_draft): store a draft — optionally threaded as a reply — in the account's drafts folder; never sends.MCP tools over streamable HTTP (client may run on another machine):
list_mailboxes,list_recent,get_email,get_thread,search,search_attachments,get_attachment_text,create_draft,sync_status.
Related MCP server: Mailing Manager MCP
Quick start
cp .env.example .env # fill in your IMAP account(s) — never commit this file
docker compose up --buildThe server listens on :8000 (streamable HTTP). The first sync runs on
startup; large mailboxes take a while to index initially.
To run a one-off index pass without serving:
docker compose run --rm imap-2-mcp python -m imap2mcp --sync-onceConfiguration
All config is via environment variables (see .env.example).
Declare accounts with ACCOUNTS=name1,name2 and one ACCOUNT_<NAME>_* block
each (HOST, PORT, SSL, USER, PASSWORD). Secrets live only in your
local .env, which is git-ignored.
Authentication
Set API_TOKEN in your .env to require a bearer token on every request.
Clients then authenticate either via header or via a query parameter (useful
for connector UIs that cannot set custom headers):
Authorization: Bearer <token>
# or
https://<host>/mcp?token=<token>With API_TOKEN unset, the endpoint is unauthenticated — keep it on a trusted
network only.
Connecting Claude
Add the streamable-HTTP endpoint as an MCP server, e.g. for Claude Code:
claude mcp add --transport http imap http://<home-server-ip>:8000/mcpSecurity notes
Set
API_TOKENbefore exposing the server beyond your local network.Without a token, only expose it inside your home network (LAN/VPN such as Tailscale). Do not port-forward it to the internet.
Phase 2 (public connector) will add full OAuth and a TLS tunnel.
Status
Phase 1 implementation. Not yet hardened or load-tested against a live mailbox.
This server cannot be deployed
Maintenance
Related MCP Connectors
- Lettio MCPOAutheu.lettio
Private, EU-hosted email for AI agents over JMAP: read, search, reply, organize, send.
1 AI email inbox and sending tools with attachments, search, live events, and webhooks.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to read, search, and manage emails via IMAP with secure, read-only access to email accounts.6-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage multiple email accounts with secure credentials, local full-text search, thread-aware replies, and automation.6 npmMIT
- AlicenseAqualityDmaintenanceEnables LLM clients to read and search email via IMAP with tools for listing folders, searching messages, and fetching message content. It supports pagination, snippets, and thread context, and is designed for local AI workflows.10MIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP-compatible AI assistants to securely search multiple mailboxes, reconstruct email threads, and inspect attachments through read-only tools without altering mailbox state.Apache 2.0