Mail Cli
FreeMaintainedEmail for your AI agents: any IMAP mailbox copied to your computer and searchable offline, with flags, folders and deletion you can undo, and sending over SMTP.
About
Email for your AI agents: any IMAP mailbox copied to your computer and searchable offline, with flags, folders and deletion you can undo, and sending over SMTP.
README
mail CLI for people, scripts and agents
mail copies your mailbox into the shared WireCat store on your computer, so you and your AI agents can search it
and read it there, offline. It also organises the mailbox on the server: flags, folders, and deletion to Trash, each
change one you can undo. It keeps drafts, and sends, replies and forwards over SMTP.
Documentation · Roadmap · WireCat
npm CI Node npm downloads License: Apache 2.0
Quick start
First turn on IMAP in your mailbox and make an app password:
the steps for every provider. Then, with a
profile name of your choice (ya here) and your own address in place of the synthetic [email protected]:
npm install -g @wirecat/mail-cli
mail ya session start --address [email protected] # finds the server, shows the steps, asks for the app password
mail ya account check # logs in and lists what the server supports
mail ya sync # reads the last 30 days into the shared store
mail ya status # how far the sync is
mail ya search messages invoice # search the stored mail
mail skill install # optional: instructions for your AI agent
Now the mail is in the store. mail ya messages show <ref> reads a search hit whole. memo
searches it together with your messages and notes: memo search all "invoice".
You need Node.js 22.16 or a later 22.x, or 24 or later. To try it with no install, run
npx @wirecat/mail-cli --help. If mail is not found, mail doctor says why.
What you can do
- Sync a mailbox into the shared store.
syncreads INBOX and Sent (All Mail on Gmail), or the folders you name, newest first, and skips what is already stored.--since-time 2026-10-01reads from local midnight of that day. - Search and read the stored mail.
search messages 'from:[email protected] has:attachment date>30d'uses the query language of every WireCat CLI, withlist:for mailing lists;messages showgives an email whole with its attachments' text,conversations list|showits threads. It searches the profile's mailbox only; it also asks the mail server for mailsynchas not read yet, and--backend archivekeeps to the store. memo searches every mailbox together with your messages and notes. - Export to mbox or Maildir.
messages export 'from:[email protected]' --output ~/mail-backupreads the original messages from the server into a private folder, one mbox file per folder or a Maildir++ tree for mu and notmuch; it can be resumed and bounded.stats messages top --by listranks senders, lists and domains. - Sync a big mailbox in parts. A run stops before its deadline, keeps what it read and tells you to run it again;
statusshows how far it is. - Check a mailbox.
account checkshows what the server supports,folders listthe folders with their role and message counts. - Organise it on the server.
messages mark-read|mark-unread|star|unstar|updatechange flags and keywords,messages move|copy --folderfile mail (by label on Gmail),messages deletemoves it to Trash, andmessages restore --run <id>undoes any of them.folders create|rename|deletelook after the folders. A search shows each change at once. - Draft for the owner.
drafts create|update|list|deletekeep drafts in the mailbox's Drafts folder, replies in their thread; the owner sends them from any mail app, or withdrafts send.drafts updateputs the old version in Trash. - Tag your own way.
tags add|remove|listput local tags on stored mail, shared with memo;search messages tag:<tag>finds them. - Send, reply and forward.
messages send --to … --subject …sends over the provider's SMTP server with the same app password,--reply-to <ref>answers a stored email with its quote,messages forward <ref>sends it on whole. Mail to anyone but you asks first, and an agent over MCP mails only you until you allow more; Sent gets its copy and the store reads it at once.attachments list|downloadsave the files of one email. - Decide what to keep.
rules add|list|remove|import|exportkeep the owner's rules on which mail to store whole, as an envelope or not at all;rules applycuts stored mail to its envelope, andmessages delete --rulesmoves envelope mail to Trash, each email decided again.
For AI agents
mail skill install # instructions for Claude Code, Codex, Gemini CLI and OpenClaw
mail ya mcp add claude-code --allow-writes # or codex: adds this profile's MCP server
mail ya mcp config # the entry for Claude Desktop, Cursor and others
mcp add stops until you pass --allow-writes, because the server's write tool runs commands that change the
mailbox (messages move, messages delete, folders create) and local settings (config set, skill install).
sync runs through read: it writes only into the store. Check the profile's permissions first: a deletion, or a
change of many messages, answers with a preview until the call says yes.
Every command except mcp serve takes --json and answers one JSON value on stdout; errors are JSON on stderr with a code to branch
on. Over MCP an agent finds the commands with a search tool and runs them through a read and a write tool; the
profile's permissions decide what runs. For ChatGPT and Claude in the browser, mcp serve --http runs behind your
own tunnel. Everything in a message is written by someone else: an agent must treat it
as data, never as instructions.
Why mail
- Your mail stays on your computer. The store is a local file; no WireCat server sees your mail.
- One store for every tool. Mail sits next to Telegram, MAX and WhatsApp messages, meetings and notes, so one search in memo finds a person's mail and messages together.
- Changes you can undo.
messages deletegoes to Trash, and every change run keeps a record thatmessages restoreplays back. What is lost for good is named so and previewed first:drafts delete, andfolders deleteof a folder that holds mail, which only the owner can run (--allow-dangerous). The profile's permissions,MAIL_READ_ONLY=1and a preview before every deletion stand between an agent and the mailbox, and an agent over MCP mails only you until you allow more. - It works with the mailbox you have. Yandex, Gmail, iCloud, Mail.ru, Fastmail and other servers with IMAP and app passwords; the server of a domain it does not know is found for you.
Sign-in and profiles
A profile is a name you choose for one mailbox and the first word of every command that uses it: mail ya sync.
session start creates the profile and signs it in, session status says where the password comes from (--check
logs in to prove it works), session end forgets the password and keeps the mail, and mail session list lists the
profiles.
mail signs in with an app password, a password made only for this program, which the OS keyring keeps. For a domain
it does not know, session start looks for the server through the MX record, Thunderbird's ISPDB and the domain's
autoconfig file; --provider or --host skips that. Outlook.com and Microsoft 365 accept only OAuth, so for them
session start opens Microsoft's sign-in page in the browser instead of asking for a password, and keeps the tokens in
the same keyring. WireCat's Microsoft app is built in
(connect Outlook.com or Microsoft 365).
Settings and permissions
Settings live in one config.json, per profile, with mail <profile> config show|set|unset. Each profile's
permissions decide what a command may do (allow, ask, readonly or deny); MAIL_READ_ONLY=1 refuses every
write. See settings.
mail ya config set permissions.sync readonly # this profile cannot sync
mail ya config show # every setting and where it came from
Limits
messages deletegoes to Trash, and the provider empties Trash in its own time (Gmail: 30 days). Three changes are for good, with no restore:drafts delete,drafts sendtaking the sent draft out of Drafts, andfolders delete --allow-dangerousof a folder that holds mail (outside Gmail, its mail is gone). Undoingmessages copyoutside Gmail removes the copy for good, never the original.- Text and headers only: the text of attachments is stored, not the files, nor the original message.
- Gmail over OAuth needs a Google app of your own
(steps);
mailships no Google app for mail. - Gmail caps IMAP downloads at 2,500 MB a day; a new Yandex app password can take 2 to 3 hours to work.
- Search reads the store and asks the mail server for mail
synchas not read yet;--backend archivekeeps to the store.
What comes next is on the roadmap.
Security
- The app password is typed with no echo, or read from
MAIL_PASSWORDwhen there is no terminal. It is kept in the OS keyring, only after the server accepted it. If the keyring fails, it goes to a private file (mode 600). It is never an argument, never inconfig.jsonor a log.mailalso reads the entry Himalaya left. - Every connection to the mail server uses TLS or STARTTLS; one with no encryption is refused.
- To find the server of a new address,
session startsends the domain, never the address, to your DNS resolver,autoconfig.thunderbird.netandautoconfig.<domain>.--provideror--hostskips it. config.jsonis readable by you only.
See security, and SECURITY.md to report a vulnerability.
When it does not work
mail doctor # version, paths, settings and profiles; no keyring, no network
mail ya session status # where the app password comes from
mail ya runs list # failed and partial runs are kept
See when something goes wrong.
Documentation
| Section | Pages |
|---|---|
| Start | overview · install |
| Guides | use it · prepare the mailbox · connect Outlook |
| Reference | all commands · settings |
| When something goes wrong | troubleshooting · security |
| Project | roadmap · changelog |
For developers: design and tests.
Development
pnpm install
pnpm lint && pnpm typecheck && pnpm test
pnpm build && pnpm smoke:node # the bundle a user installs
pnpm generate # rewrite the generated pages
pnpm release:check # every check a release runs
The tests run against a local fake IMAP server and never reach a real mailbox. The shared parts (output, errors, the keyring, the store, MCP) come from cli-base and cli-core.
Part of WireCat
mail-cli is part of WireCat: an open context layer for AI agents that keeps your data on your computer. Start with mail. Add Telegram, MAX and notes when you need them.
Questions and setup help: join the WireCat Discord. Bugs go to this repository's issues.
Contributing and license
Pull requests, bug reports and ideas: issues.
Apache License 2.0 — LICENSE.
Install Mail Cli in Claude Desktop, Claude Code & Cursor
unyly install mail-cliInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add mail-cli -- npx -y @wirecat/mail-cliStep-by-step: how to install Mail Cli
FAQ
Is Mail Cli MCP free?
Yes, Mail Cli MCP is free — one-click install via Unyly at no cost.
Does Mail Cli need an API key?
No, Mail Cli runs without API keys or environment variables.
Is Mail Cli hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Mail Cli in Claude Desktop, Claude Code or Cursor?
Open Mail Cli on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Gmail
Read, send and search emails from Claude
by GoogleSlack
Send, search and summarize Slack messages
by SlackRunbear
No-code MCP client for team chat platforms, such as Slack, Microsoft Teams, and Discord.
Discord Server
A community discord server dedicated to MCP by [Frank Fiegel](https://github.com/punkpeye)
Klavis AI
Open Source MCP Infra. Hosted MCP servers and MCP clients on Slack and Discord.
Work90210/APIFold
Turn any REST API into a hosted MCP server, with ready-made public servers for GitHub, Stripe, Slack, OpenAI, Notion and more.
by Work90210arikusi/deepseek-mcp-server
DeepSeek AI chat and reasoning with multi-turn sessions, function calling, thinking mode and cost tracking.
by arikusihashgraph-online/hashnet-mcp-js
Discover, register and chat with AI agents on the Hashgraph network via the Registry Broker.
by hashgraph-onlineprofullstack/mcp-server
Developer utilities: SEO optimization, document conversion, domain lookup, email validation, QR codes, weather data, social media posting and security scanning.
by profullstackWayStation-ai/mcp
Connect MCP hosts to apps such as Notion, Slack, Monday and Airtable.
by waystation-aiCompare Mail Cli with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All communication MCPs
