A complete email infrastructure where AI agents are the primary interface. Stalwart JMAP backend, REST API, MCP server, and CLI — one docker compose up away.
Every AI team hits the same wall. Email is locked behind OAuth flows, rate limits, and APIs designed for humans clicking buttons.
Gmail and Microsoft APIs require multi-step OAuth consent, refresh tokens, and per-user scoping. Agents need programmatic access — not browser redirects.
Existing email APIs weren't built for agents. No tool schemas, no structured parameters, no thread-aware operations. Just raw REST mapped to human mailbox concepts.
Google Workspace and Microsoft 365 own the mailbox. You can't self-host, you can't inspect, and you can't run it locally for development.
Stalwart handles the mail engine. Hono wraps it in REST. MCP and CLI give agents and humans equal access.
Production-grade mail server. JMAP for modern access, SMTP/IMAP for compatibility. Runs in Docker with persistent volumes.
TypeScript REST API. Account provisioning, domain management, Cloudflare DNS automation, JMAP email operations. Zod-validated.
10 typed MCP tools for Claude. CLI (sendbox) for humans. Same REST backend, different transports.
Every email operation an agent needs — exposed as MCP tools with Zod-validated parameters and structured responses.
JMAP is the modern replacement for IMAP — JSON over HTTP, stateless, push-capable, and designed for the way applications actually consume email.
Register a domain through the API or MCP. Cloudflare DNS records are created automatically — MX, SPF, DKIM, DMARC. No manual configuration.
Routes inbound mail
to Stalwart
Authorizes your server
to send
Cryptographic signing
for authenticity
Policy enforcement
+ reporting
Everything the MCP server can do, humans can do from the terminal. Interactive prompts, color output, config persistence.
account create
account list
account delete
domain add
domain list
domain verify
email send
email list
email read
email search
Docker Compose handles everything. Stalwart, Postgres, health checks, schema migrations. One copy-paste block.
Agents get a hashed API key. No refresh tokens, no browser redirects, no expiry headaches. Cloudflare tokens encrypted at rest.
npm run seed
→ generates nanoid key (iws_...)
→ bcrypt hash stored in api_keys
→ raw key printed to stdout (once)
Email works. Agents can send, read, search, and thread. Domains auto-configure via Cloudflare. The foundation is set.