imap-2-mcp
Enables AI clients to search IMAP mailboxes with live access and a full-text index covering email bodies and attachments (PDF, DOCX, XLSX, text).
README
imap-2-mcp
Read-only 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).
Strictly read-only: it never sends, deletes, moves, or flags mail.
See SPEC.md for the full design and rationale.
Features (Phase 1)
- Multi-account IMAP (SSL), read-only.
- Background sync worker: initial full index + periodic incremental updates.
- Attachment text extraction (PDF, DOCX, XLSX, plain text).
- 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,sync_status.
Quick start
cp .env.example .env # fill in your IMAP account(s) — never commit this file
docker compose up --build
The 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-once
Configuration
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/mcp
Security 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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.