Filtered, read-only IMAP and Gmail archived to disk as .eml + markdown, served over MCP.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Give a program its own read-only mailbox, filtered down to exactly the mail it asked for, delivered as files on disk.
mail-muncher pulls messages from a mail provider, evaluates each one against
ordered rules, and writes the matches to a directory β byte-faithful .eml,
and optionally a markdown rendering with the headers as YAML frontmatter, the
body as text, and attachments extracted alongside. A rule can take its filter
input from a plain text file that some other program owns, which mail-muncher
re-reads at the start of every cycle. That other program changes one line in
that file, and the very next cycle delivers different mail β no config edit, no
restart, no redeploy.
It reads from any IMAP mailbox β Gmail, Fastmail, iCloud, Proton Bridge, a work account, your own server β or from Gmail's API with a read-only OAuth scope. It runs one-shot for cron, or as a polling daemon, or as a stdio MCP server an agent can query directly. Every mode emits the same machine-readable manifest of what it did, and no mode ever writes to your mailbox.
Pick one before you install anything. Both are supported, and everything downstream β rules, formats, filenames, the archive layout, the MCP tools β is identical either way.
provider: imap | provider: gmail | |
|---|---|---|
| Setup time | ~2 min | ~10 min in the Google Cloud Console |
| What you register | nothing | your own Google Cloud project and Desktop-app OAuth client |
| Credential | an app password from your provider's own settings page | an OAuth token, scope gmail.readonly |
| How wide that credential is | a full mail credential. An app password can send and delete | read-only, and nothing else |
| Who enforces read-only | mail-muncher's own code | |
| Expiry | none | every 7 days on a Testing-mode consent screen; mail-muncher auth has to be re-run weekly |
| Where the secret lives | wherever your password manager already keeps it: password_cmd is run and its stdout is the password. There is deliberately no password key | token.json, mode 0600, written by mail-muncher auth |
| Which mailboxes | the folders you list in mailboxes:; [INBOX] by default | the whole Gmail account, minus Spam and Trash unless you ask for them |
| Works with | Gmail, Fastmail, iCloud, Proton Bridge, work accounts, self-hosted | Gmail only |
| Extra steps | none. There is no auth command on this path | mail-muncher auth, after docs/gmail-setup.md |
The ~2 min / ~10 min / 7 days above are the same numbers mail-muncher init
and the unconfigured-run guidance print, because they are the numbers that
decide this.
The read-only guarantee is real on both paths, but it is not the same guarantee, and flattening the two would be dishonest.
gmail.readonly.
The token that comes back is incapable of sending, deleting, labelling or
modifying β not because mail-muncher declines to, but because Google will
refuse the call. A bug in this program cannot reach your mailbox.EXAMINE and never SELECT, every body is fetched with
BODY.PEEK[] and never BODY[] (so mail is never marked read), and there is
no code path anywhere in the provider that issues STORE, APPEND or
EXPUNGE. Both belts are worn because a server is not obliged to protect a
client from itself. That is a strong guarantee and an auditable one β it is
just this program's guarantee, not your mail provider's.If you have no specific reason to want the Gmail API, start with IMAP. It works on a Gmail account too, and it is the path the quickstart takes.
An automated process needs some mail. A job-search tracker wants replies from companies you applied to. A support bot wants messages from one vendor's domain. A research agent wants every newsletter from three publishers, as text it can actually read.
The usual answers are all bad. Hand the process your inbox credentials and it can read (and send, and delete) everything. Give it a mail API integration and you now maintain an OAuth flow, a sync cursor, MIME parsing, and a dedup story inside every process that wants mail. Or hard-code the filter into a config file, and every change to what it wants is a config edit and a redeploy.
mail-muncher splits that in half. It owns the credentials, the incremental sync, the parsing, and the dedup. The consuming program owns a text file listing what it wants and a directory it reads results from β and, if it prefers to ask rather than watch, a handful of MCP tools over that same directory.
There are two supported shapes, and they compose. Pick by whether your agent runs on a loop of its own or waits to be asked.
mail-muncher mcp over MCP and asks
questions directly: what am I subscribed to, what arrived, what does this
thread say, fetch now. See Shape 2: tool call.Both read the same archive, and running both at once is normal: a daemon fills the directory while the MCP server answers questions about it.
The loop is fully decoupled: mail-muncher never calls the agent, and the agent need never call mail-muncher. They share two paths on disk.
1. The agent declares what it wants. Append to a file it owns:
2. mail-muncher subscribes to that declaration. One rule, pointed at the file:
3. Every cycle re-reads the file. Run it from cron, or leave the daemon running:
4. Matched mail lands in dest as files the agent reads.
The .md is the consumable rendering β parse the frontmatter, feed the body
to a model, open the attachments from the sibling directory:
thread_id is on every message and is never empty, so grouping a directory into
conversations is a sort on one field β no reference chains to reassemble.
5. Optionally, take the manifest instead of walking the tree. --json
writes a machine-readable record of the cycle to stdout, one object per account,
while every log line goes to stderr:
Full contract: docs/manifest.md.
Three properties make this safe to put in an autonomous loop:
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/mail-muncher)<a href="https://allmcps.com/mcp/mail-muncher"><img src="https://allmcps.com/api/badge/mail-muncher?style=directory" alt="Mail Muncher on AllMCPs" /></a>