Read-only, self-hosted MCP access to IMAP email, mirrored locally and indexed by notmuch.
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.
Your mail already holds the answers: booking references, gate codes, invoices, warranty periods, promises people made in writing. This server lets your AI assistant find them, and it can only read.
Ask it things like:
Use it for:
Setup is two files and docker compose up -d. See Quick start.
A self-hosted MCP server. It mirrors one or more IMAP accounts into a local maildir with mbsync, indexes them with notmuch, and answers tool calls from that index. The Claude and ChatGPT apps attach over HTTPS with OAuth; Claude Code, Codex, Cursor and Claude Desktop attach over stdio on the same machine. Any MCP client works, so if you want full privacy you can attach one backed by a local LLM and your mail never leaves your machine.

Mail only ever moves left to right in that picture. The mirror is pull-only
by configuration. The one connection the Go code makes toward a provider is
an IMAP LIST per account, to learn what that server calls its junk and
trash folders; it never selects a mailbox and never fetches a message.
Security has the full list of what the process cannot do. The
diagram source is
docs/diagrams/how-it-works.html.
On your machine, for your machine. Docker is the only requirement; the image
at ghcr.io/wildsurfer/your-mail-mcp is built by CI for amd64 and arm64.
Put your accounts in accounts.json. ${WORK_PASS} is replaced from the
environment, so the file itself holds no password:
Put the passwords in .env next to compose.yaml:
compose.yaml passes WORK_PASS and PERSONAL_PASS into the container. An
account with another variable name needs that name added under
environment: there as well.
Two provider details cost people the most time. Gmail accepts only an app
password over IMAP, and app passwords need 2-step verification turned on
first. iCloud wants the short name before @icloud.com as user; the full
address fails to log in. Every key of the file is in
the reference.
These two files hold your mail passwords. Keep the directory out of version control and out of backups that leave the machine.
Today's INBOX mail is searchable within minutes. The full history follows at
whatever pace the provider allows, and the status tool reports how far it
has got. A large Gmail account takes days, because Google caps IMAP downloads
at about 2.5GB per day; set SYNC_TIMEOUT=8h in .env for that first
mirror. Provider notes has the details.
Then connect a client. Claude Code:
Cursor and VS Code add it in one click, once the stack is up:
Any client that starts an MCP server as a command:
Each session is a bridge into the running container, so every client sees the same index and the same sync. Close the client and the session goes with it.
Claude Code can also take it as a plugin, which adds the server and an
email skill that knows the query syntax:
Without a running stack,
docker run -i --rm --env-file .env -v index:/index -v mail:/mail -v ./accounts.json:/config/accounts.json:ro ghcr.io/wildsurfer/your-mail-mcp
starts a daemon for the life of one session. Fine for a look; use compose for
anything you want kept fresh.
The Claude and ChatGPT smartphone apps reach a connector through the vendor's servers, so the server needs a public HTTPS address. A tunnel gives it one: the tunnel dials out, nothing listens on your home network, and the mail stays on your machine.
With Tailscale installed, one command, the same on macOS and Linux:
It prints a hostname like https://your-machine.your-tailnet.ts.net, and
--bg keeps it running across reboots. Put that hostname in .env together
with a passphrase, then restart:
OAUTH_PASSPHRASE is the only credential between the internet and your
mail. A wrong guess costs one second and guesses are serialised, and neither
of those saves a short passphrase. Use a long one you can still type on a
phone.
Funnel needs HTTPS certificates and the Funnel node attribute enabled for
your tailnet; the CLI offers to add the policy line the first time.
tailscale funnel status shows what is exposed, and
tailscale funnel --https=443 off takes it down.
Now add the connector. Neither the Claude nor the ChatGPT smartphone app can add one, so you do it once on the web, and it then appears on the phone.
<PUBLIC_URL>/mcp. Leave the advanced OAuth
fields empty; the server registers clients itself.OAUTH_PASSPHRASE.PUBLIC_URL has to match what you type into the client exactly. The server
publishes PUBLIC_URL + /mcp as the resource in its OAuth metadata, and a
mismatch there is the most common reason a connector refuses to add.
Use this for a hostname on a domain you own. mail.example.com below has to
be your domain, already added to your Cloudflare account; Cloudflare does
not hand out hostnames for named tunnels.
create prints the tunnel's UUID and the path of the credentials file it
wrote; cloudflared tunnel list prints the UUID again if you lose it. Route
the hostname, then write ~/.cloudflared/config.yml:
To keep it running: on Linux, sudo cloudflared service install. On macOS,
install it through Homebrew and use brew services start cloudflared,
because the sudo install path looks for its certificate under the root
user's home and will not find the one cloudflared tunnel login wrote to
yours.
Then set PUBLIC_URL=https://mail.example.com in .env and
docker compose up -d.
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/your-mail-mcp)<a href="https://allmcps.com/mcp/your-mail-mcp"><img src="https://allmcps.com/api/badge/your-mail-mcp?style=directory" alt="Your Mail MCP on AllMCPs" /></a>