Install
$ agentstack add mcp-hannokuegler-mailctx β scanned Β· β verified β works with Claude Code, Cursor, and more.
Security review
β PassedNo 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.
Verified badge
Passed review? Show it. Paste this badge into your README β it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming β see below.
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 β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.
- Author: hannokuegler
- Source: hannokuegler/mailctx
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet β be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.