← Changelog

Agents Can Search the Archive and Draft Replies

The mail archive now has an MCP server, so an agent can search both accounts, read a thread, and leave a reply in Drafts. Nothing gets sent until a person sends it.

Why Care?

An archive you can only search from a terminal doesn't answer any mail. This is the first step toward agents that do: they can find the thread, read it, and write the reply. Sending stays with a person for now.

What's New?

  • mail/kaymcp.py, an MCP server with three tools: search_mail, read_message (with the rest of its thread), and draft_reply. Claude Code sessions in this repo pick it up from .mcp.json.

  • mail/drafts.py saves a reply in the Drafts folder of the account the mail arrived on. It sets the headers so the draft threads correctly, quotes the original, and can reply to just the sender or to everyone on the message.

  • A log of every call, in logs/mcp-calls.jsonl next to the archive.

How it Works

The sync stays read-only. Drafting lives in its own file and logs in with a second app password. Revoking that password stops drafting and leaves the archive syncing.

Email bodies come back marked as untrusted. read_message wraps the body in markers and says it was written by the sender. That won't stop a prompt injection on its own, but the worst an injected agent can do here is write a draft that someone reads before it goes anywhere.

It runs on the machine with the archive. It searches the full local index (about 400,000 messages across two accounts). A version reachable from the phone waits on making the copy in R2 searchable.