Mailctx

•

Transforms IMAP emails into token-optimized Markdown for AI agents and provides an MCP server for AI access to read and draft mail.

Mailctx addresses the challenge of providing AI agents with access to email by cleaning up the often-messy content of raw emails. It strips out unnecessary elements like HTML tags, deeply nested quotes, and tracking pixels, converting email into a compact, token-optimized Markdown format, achieving a significant 60-98% token reduction. Beyond just cleaning, it includes a Model Context Protocol (MCP) server, allowing tools like Claude Desktop to securely search, read, and draft email replies directly. A crucial design feature is its safety boundary: agents can read and draft but are structurally incapable of sending or deleting mail, ensuring users always retain final send authority.

Key Features

01Generates token-optimized Markdown from IMAP emails (60-98% token reduction)
02Supports per-account isolation, preventing one failed account from blocking others
031 GitHub stars
04Engineered for robustness, surviving connection drops with typed retry logic
05Includes a Model Context Protocol (MCP) server for AI agent integration
06Prevents AI agents from sending or deleting emails (read and draft only)

Use Cases

01Allowing AI agents to draft email replies based on inbox content
02Enabling AI agents to search and read emails from any IMAP account
03Providing AI agents with clean, token-efficient summaries of email threads