Skip to content

Talk to your whole inbox.

mxr keeps your email history on your computer, indexed and in sync. Search across all your accounts, run analytics on your full history, or ask your agent to find a thread and draft the reply in your voice.
syncGmail · Outlook / Microsoft 365 · any IMAP server
sendGmail · Outlook / Microsoft 365 · any SMTP server
$brew install planetaryescape/mxr/mxrcargo and binary methods below
real mxr commands · demo inbox

A terminal session. mxr search returns matches from thousands of messages, the JSON output goes through jq to rank senders by volume, and mxr subscriptions lists newsletters by how often they get opened.

A keyboard-driven inbox filling the terminal, with a mailbox sidebar, a search across the whole index, and the rules and accounts screens.

An AI agent works the same inbox. It writes mxr search and jq pipelines to find the senders behind phishing attempts, then says which ones to be careful with.

Use mxr from the TUI, the CLI, or your agent. See examples →

These commands work after mxr demo or after you connect an account.

Terminal window
# search your whole mailbox from the local index
mxr search "from:supplier@example.com has:attachment after:2019"
# rank newsletters by how little you read them, then leave
mxr subscriptions --rank --format json
mxr unsubscribe newsletter@example.com --dry-run
# surface what you owe a reply to
mxr owed --since 7 --format json
# give an agent structured results
mxr search "from:sarah@example.com after:2026-04-23" --format json | jq '.results[0]'

Most reads can return JSON. Core mail mutations support --dry-run, so scripts and agents can show their work before changing your mailbox. Browse more examples →

Your synced mail stays available.

Open mxr on a plane with the wifi off. Read a thread, search the archive, and write the replies you owe. Opening a message is a SQLite read, and a draft saves straight to disk. When you reconnect, mxr pulls in new mail and you can send the drafts you wrote offline.

Years of messages and labels stay indexed locally. Attachment names, types, and sizes are part of the local record. mxr downloads an attachment into its cache when you open it.

~ $ mxr
19:42 opened, 47 unread, 11 threads
20:03 searched: supplier contract, 4 hits (local index)
20:18 drafted 3 replies (saved locally)
21:14 drafted: announcement-q3.md(saved locally)
◈ wifi reconnected, syncing
21:30 new mail pulled and indexed
21:31 sent the 3 replies (mxr send)
$mxr search "from:supplier@example.com subject:contract has:attachment after:2019"
2024-08-12Supplier Co.Contract revision v3, sign by Friday📎
2023-03-04Supplier Co.2023 framework agreement (signed PDF)📎
2019-11-22contracts@supplierContract terms · initial draft📎
2019-09-08Supplier Co.Onboarding contract for review📎

Find a 2019 contract by the supplier’s name. Pull every receipt from a vendor. List the apology email you sent in March. mxr indexes subject, body, sender, and attachment filenames with Tantivy. Lexical search runs against the index on your disk, without a provider round trip or provider rate limit. Optional local embeddings add hybrid and semantic search.

The same local record makes mailbox analytics cheap to run: storage by sender or attachment type, response times, stale threads, subscription activity, and a year-in-review.

Terminal window
mxr storage --by label --limit 20
mxr stale --mine --older-than-days 14
mxr wrapped
mxr search "subject:invoice" --format json | jq -r '.results[].from' | sort -u

Search and mail reads stay on your computer. Once your mail is synced, a hosted model call is the only network wait in this workflow. The agent can use the CLI or the first-party MCP server to search, read, draft, summarize, export, and preview changes.

◈ prompt
Find the latest thread with Sarah. Look at how I normally write to her, then draft a short reply in the same tone. Do not send it.
mxr search "from:sarah@example.com OR to:sarah@example.com" --format jsonmxr sender sarah@example.com --format jsonmxr draft-assist <thread-id> "short reply in my usual tone"
Relationship context and recent threads loaded ◈draft created, nothing sent.
◈ prompt
Find every CI failure email from last week. Cross-reference with my recent commits and archive the ones whose tests have since been fixed.
mxr search "from:ci@github.com after:2026-04-30" --format json | jq -r '.results[] | [.message_id, .subject] | @tsv'git log --since=1.week --pretty='%H %s'mxr search "from:ci@github.com after:2026-04-30 subject:upload" --format ids | mxr archive --yes
23 failures, 18 from the upload suite that a later commit fixed ◈18 archived, 5 left for review.

The CLI, MCP server, web bridge, and TUI all call the same daemon. Most read commands can return JSON. Core mail mutations support --dry-run, and MCP mutation and send tools require confirm=true. See the automation contract →

◈ what your agent sees
Terminal window
mxr search "from:sarah@example.com after:2026-04-23" \
--mode lexical --sort relevance --format json | jq '.results[0]'
{
"message_id": "019706f4-9b6e-7c31-8a3f-2a1c4de50b91",
"from": "Sarah Chen <sarah@example.com>",
"subject": "1:1 prep, Friday",
"date": "2026-04-30T15:42:11+00:00",
"read": false,
"starred": false,
"score": 12.4
}

Use mxr with agents → · Run the MCP server →

mxr keeps a local copy and syncs changes in both directions. Read, label, and archive in another client; mxr picks up those changes. Make the same changes in mxr; your provider receives them.

◈ in your other client
  • read a thread in Gmail web on your phone
  • apply a label in Apple Mail
  • archive a newsletter from your watch
Gmail History API
Outlook OAuth2
+ IMAP / SMTP
IMAP CONDSTORE
+ IDLE
◈ in mxr after sync
  • mxr sees the read state
  • the label appears in mxr’s sidebar
  • the newsletter leaves the inbox

Gmail, Outlook, and your IMAP server remain upstream. The synced local archive stays readable on your computer when the provider or network is unavailable.

The daemon owns sync, storage, search, rules, and provider connections. The TUI, CLI, web app, MCP server, and agent skill use the same mail and the same permissions.

TUI
◈ default

Vim-native keys, Gmail-style chords, full-mailbox search, account setup, rules, and analytics. Compose in $EDITOR.

mxr
CLI
◈ scriptable

Search, read, draft, send, and manage mail from scripts or one-off commands. Pipe JSON through jq, xargs, or anything else in your shell.

mxr archive --search "from:noreply@example.com older_than:30d" --dry-run
would archive 142 messages.
HTTP
◈ browser-friendly

mxr web opens the browser app through the local HTTP and WebSocket bridge. The same bridge publishes OpenAPI and can support another client.

curl -H "Authorization: Bearer $TOKEN" \
  "http://mxr.localhost:42829/api/v1/mail/search?q=is:unread"
{"results": [...]}
MCP / agent
◈ typed tools

Run mxr mcp serve for typed MCP tools, or give a shell-capable agent the mxr skill. Both use daemon-enforced account scopes and safety gates.

mxr mcp serve
Compose in $EDITOR. Write Markdown with your own keybindings and plugins. mxr builds and sends the multipart message.
Reader mode. Remove tracking pixels, banners, signatures, and quoted text from the terminal view.
Follow-up queues. Track replies you owe, remind yourself when someone has not replied, snooze threads, and schedule sends.
Mailbox analytics. Inspect response times, stale relationships, subscription activity, and storage by sender or attachment type.
Mail rules. Preview and run rules that label, archive, star, mark, or route matching mail.
Saved searches. Keep useful mailbox queries in the TUI sidebar and rerun them without rebuilding the filter.

install

three methods

Homebrew

Terminal window
brew install planetaryescape/mxr/mxr

Cargo

Terminal window
cargo install --git \
https://github.com/planetaryescape/mxr \
--locked mxr

Binaries

macOS Apple Silicon · Linux x86_64

Download a release asset →

mxr demoopen a seeded two-account inbox
mxr accounts add gmailuse outlook or imap for another provider
mxropen your local inbox

mxr demo uses a separate config, database, and daemon. It seeds 50,000 messages across two accounts and warms search and analytics before opening the TUI.

open source ◈ MIT / Apache-2.0

Built in Rust as one binary for the supported macOS and Linux release targets. There is no telemetry and no mxr-operated server between you and your mail provider. If you use mxr and like it, star the repo so more people can find it. Contributions are welcome across provider adapters, clients, CLI commands, documentation, and tests.