AgentStack
MCP verified MIT Self-run

Mailctx

mcp-hannokuegler-mailctx Β· by hannokuegler

πŸ“¬ Give your AI agent your inbox. Provider-agnostic IMAP β†’ clean, token-cheap Markdown (60–98% fewer tokens), plus an MCP server so Claude Desktop can search, read and draft your mail. Reads and drafts β€” never sends.

β€” No reviews yet
0 installs
3 views
0.0% view→install

Install

$ agentstack add mcp-hannokuegler-mailctx

βœ“ scanned Β· βœ“ verified β€” works with Claude Code, Cursor, and more.

Security review

βœ“ Passed

No issues found. Passed automated security review. Β· v0.1.0 How review works β†’

  • βœ“ Prompt-injection patterns
  • βœ“ Secret / credential exfiltration
  • βœ“ Dangerous shell & filesystem operations
  • βœ“ Untrusted network calls
  • βœ“ Known-malicious package signatures

What it can access

  • βœ“ Network access No
  • βœ“ Filesystem access No
  • βœ“ Shell / process execution No
  • βœ“ Environment & secrets No
  • βœ“ Dynamic code execution No

From automated source analysis of v0.1.0. β€œUsed” means the capability is present in the source β€” more access means more to trust, not that it’s unsafe.

View the full security report β†’

Verified badge

Passed review? Show it. Paste this badge into your README β€” it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-hannokuegler-mailctx)

Reliability & compatibility

βœ“ Security review passed
0 installs to date
β€” no reviews yet
● 3d ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming β€” see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps β€” measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work β†’
Are you the author of Mailctx? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

mailctx

[](https://github.com/hannokuegler/mailctx/actions) [](https://www.python.org/downloads/release/python-3100/) [](https://opensource.org/licenses/MIT)

Give your agent your inbox β€” clean, token-cheap Markdown from any IMAP account, plus an MCP server so Claude Desktop can read and draft your mail.

LLMs drown in the ` tags, deeply nested quotes, and tracking pixels of raw email. mailctx` is a provider-agnostic IMAP engine that strips the garbage and emits bounded, token-optimized Markdown ready for context windows.

The Token Economy (Actual mailctx demo output)

                         mailctx Token Economy Demo                         
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ File                ┃ Orig Size ┃ Clean Size ┃ Tokens (est.) ┃ Reduction ┃
┑━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
β”‚ ugly_html.eml       β”‚    1208 c β”‚      151 c β”‚         ~37 t β”‚      -88% β”‚
β”‚ with_attachment.eml β”‚     761 c β”‚       33 c β”‚          ~8 t β”‚      -96% β”‚
β”‚ rich_html.eml       β”‚    2065 c β”‚      567 c β”‚        ~141 t β”‚      -73% β”‚
β”‚ quoted_thread.eml   β”‚     519 c β”‚       76 c β”‚         ~19 t β”‚      -85% β”‚
β”‚ tracking.eml        β”‚     659 c β”‚       17 c β”‚          ~4 t β”‚      -97% β”‚
β”‚ umlaut.eml          β”‚     445 c β”‚      153 c β”‚         ~38 t β”‚      -66% β”‚
β”‚ plain_text.eml      β”‚     346 c β”‚      143 c β”‚         ~35 t β”‚      -59% β”‚
β”‚ long_thread.eml     β”‚    1398 c β”‚       28 c β”‚          ~7 t β”‚      -98% β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

(Run mailctx demo to see this exact output on the bundled corpus.)

Quickstart

# 1. Install (with MCP support)
pip install "mailctx[mcp]"

# 2. See the token savings on bundled samples
mailctx demo

# 3. Connect your inbox
mailctx init

The Missing IMAP MCP Server for Claude Desktop

Connect mailctx via the Model Context Protocol (MCP) and your agent can answer "what did I miss this week?", "find the invoice from Flixbus", or "draft a reply to my landlord".

Safety Boundary: By design, mailctx can read mail and it can draft replies (appending to your Drafts folder). It can never send mail or delete mail. You always retain final send authority in your standard email client. For an agent touching your inbox, this constraint is the feature.

Add this snippet to your claude_desktop_config.json (or run mailctx mcp --print-config):

{
  "mcpServers": {
    "mailctx": {
      "command": "mailctx",
      "args": ["mcp"],
      "env": {
        "PATH": "/usr/local/bin:/usr/bin:/bin"
      }
    }
  }
}

Why not just use...

| | mailctx | roll your own imaplib | himalaya | mail2md scripts | |---|---|---|---|---| | Token-optimized output for LLMs | βœ… 85–97% reduction | ❌ | ❌ | partly | | MCP server included | βœ… | ❌ | ❌ | ❌ | | Survives VPN/travel disconnects | βœ… typed retry | ❌ | partly | ❌ | | Multi-account isolation | βœ… | ❌ | βœ… | ❌ | | Cannot send (safety boundary) | βœ… by design | β€” | ❌ sends | β€” |

Note: If you want a full terminal email client to read your own mail, use himalaya. If you need total control over raw MIME parts for a non-LLM pipeline, rolling your own imaplib wrapper might be better. mailctx is purpose-built for AI agents.

Built for Reality

Agents break when connections drop. mailctx is engineered to survive production:

  • Typed transient-vs-auth error handling: Born from real Gmail EOF drops on travel WLAN/VPNs. Uses 3-retry backoff with a fresh connection each attempt.
  • Per-account isolation: One broken account (e.g., expired app password) never blocks the others.
  • Watermark integrity: The read pointer (mailctx stream) advances only on success, so mail is never silently skipped during processing failures.
  • Autodraft safety model: Dry-run by default (requires --write), capped per run, idempotent, every draft explicitly marked, and structurally incapable of sending.

See it in Action

(To regenerate the demo recording locally, run scripts/record_demo.sh)

Development

Run mailctx doctor to verify your environment. For contribution guidelines and "good first issues", see [CONTRIBUTING.md](CONTRIBUTING.md).

License

MIT

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source β€” we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet β€” be the first.

Versions

  • v0.1.0 Imported from the upstream source.