Self-hosted remote MCP server that lets an AI (Claude, etc.) read, search and send email through multiple IMAP/SMTP accounts
概览
Self-hosted remote that lets an AI (Claude, etc.) read, search and send email through , and read/write the user's calendar through — authenticated via . MCP clients (Claude Desktop, Claude.ai, …) can talk to remote servers, but none of them ship with a way to plug IMAP/SMTP and CalDAV accounts securely. Shoving raw credentials into a client config or shipping them to a third-party SaaS is a non-starter for anything serious. imap-mcp is a tiny, self-hosted Next.js app that: - authenticates with Clerk (you get a real sign-in UI, MFA, SSO, whatever Clerk supports), - authenticates with OAuth 2.1 (PKCE + Dynamic Client Registration), - stores an per user, encrypted at rest (AES-256-GCM), - exposes those accounts to any MCP client through a clean set of tools — emails and calendar. One container, one domain, your server, your keys.
README
以下为原文 README 节选,完整内容请查看原文。
imap-mcp
Self-hosted remote MCP server that lets an AI (Claude, etc.) read, search and send email through multiple IMAP/SMTP accounts, and read/write the user’s calendar through CalDAV — authenticated via Clerk.
Why
MCP clients (Claude Desktop, Claude.ai, …) can talk to remote servers, but none of them ship with a way to plug your own IMAP/SMTP and CalDAV accounts securely. Shoving raw credentials into a client config or shipping them to a third-party SaaS is a non-starter for anything serious.
imap-mcp is a tiny, self-hosted Next.js app that:
- authenticates humans with Clerk (you get a real sign-in UI, MFA, SSO, whatever Clerk supports),
- authenticates MCP clients with OAuth 2.1 (PKCE + Dynamic Client Registration),
- stores an arbitrary number of IMAP/SMTP and CalDAV accounts per user, encrypted at rest (AES-256-GCM),
- exposes those accounts to any MCP client through a clean set of tools — emails and calendar.
One container, one domain, your server, your keys.
Features
- 🔐 Clerk for user auth — you manage users, not us
- 🔑 OAuth 2.1 (Authorization Code + PKCE) with Dynamic Client Registration (RFC 7591)
- 📬 Unlimited IMAP/SMTP accounts per user, each with its own HTML signature (Tiptap editor, DOMPurify-sanitized)
- 🗓️ Unlimited CalDAV calendar accounts per user — list/read/create/update/delete events and find free slots, fully timezone-aware (TZID + DST-correct recurrences)
- 🔒 Credentials encrypted with AES-256-GCM; OAuth tokens stored as SHA-256 hashes only
- 🧰 27 MCP tools: 19 email tools (list/read/search/send/reply/flag/move/folder ops) + 8 calendar tools (
list_calendar_accounts,list_calendars,list_events,get_event,create_event,update_event,delete_event,find_free_slots) - 🧪 Test connection from the list (IMAP
NOOP+ SMTPVERIFY, CalDAV principal-discovery) with per-account status badges and actionable error hints - ⚡ Provider presets on account creation: Gmail, Outlook / Microsoft 365, iCloud, Yahoo, Fastmail, OVH for email — iCloud, Fastmail, Nextcloud, OVH, Baïkal/generic for calendars
- ⚠️ Live port/SSL consistency warnings — catches the
wrong version numbertrap before it happens - 🎯
/connectguide with tabbed, copy-to-clipboard setup instructions for Claude.ai (web), Claude Desktop and Claude Code - 🎨 Polished UI: light/dark, hero homepage, status badges, shadows, focus rings
- 🐳 Ships as a 2-service
docker-compose(Postgres + app)
Architecture
安装
npx -y mcp-remote https://<your-domain>/api/mcp配置
{
"mcpServers": {
"email-mcp": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://<your-domain>/api/mcp"]
}
}
}