proton-mcp
# proton-mcp
[](https://pypi.org/project/proton-mcp/)
[](https://github.com/vdeabreu/proton-mcp/actions/workflows/ci.yml)
[](https://github.com/vdeabreu/proton-mcp/blob/main/LICENSE)
<!-- mcp-name: io.github.vdeabreu/proton-mcp -->
An [MCP](https://modelcontextprotocol.io) server that gives Claude (or any MCP
client) access to your **Proton Mail** mailbox through
[Proton Mail Bridge](https://proton.me/mail/bridge).
- **Read**: list folders, list and search emails, read an email with its attachments list.
Nothing is ever marked as read, moved or deleted.
- **Send** (optional): send and reply from any of your Proton addresses, with your
display name, HTML formatting from light Markdown, proper threading, and the
original message quoted below replies.
- Runs **locally** for Claude Desktop (stdio), or **remotely** as a claude.ai
custom connector (streamable HTTP + OAuth).
> Unofficial project, not affiliated with or endorsed by Proton AG.
## Why this one
Several Proton Mail MCP servers exist. This one is built for a specific use:
an assistant that reads your mail and drafts replies, without being able to
damage the mailbox.
- **Works in claude.ai on the web and on your phone**, not only in Claude Desktop:
a remote mode with OAuth, Docker and reverse-proxy configs, and a full
[deployment guide](https://github.com/vdeabreu/proton-mcp/blob/main/docs/deploy.md).
- **Can't change your mailbox.** No move, flag or delete tools; folders are opened
read-only and nothing is marked as read. Sending is opt-in, flagged
destructive, and refused from any address that isn't yours.
- **Defends against prompt injection in emails**: hidden HTML text is dropped and
IMAP arguments can't carry extra commands.
- **Mail that looks like Proton's**: your display name, the right address when
replying, threading, and the original quoted the way Proton quotes it.
If you want the model to organise your mailbox (labels, bulk moves,
attachments), a broader server will suit you better.
## How it works
Proton Mail is end-to-end encrypted, so there is no plain IMAP server to talk to.
Proton Mail Bridge (paid plans) runs on your machine, decrypts locally and exposes
IMAP/SMTP on `127.0.0.1`. This server talks to Bridge, and only to a loopback
address.
```
Claude Desktop ──stdio──> proton_mcp.py ──IMAP/SMTP──> Bridge (127.0.0.1) ──> Proton
```
## Tools
| Tool | What it does |
| --- | --- |
| `list_folders` | Folder names (labels and system folders included). |
| `list_emails` | Latest emails of a folder, newest first (headers only). |
| `search_emails` | Search by sender, recipient, subject, text, date range, unread. |
| `read_email` | Full email: headers, text body (HTML converted to text), attachments list. |
| `list_sender_addresses` | The addresses `send_email` can send from, with the display name used for each. |
| `send_email` | Send or reply, from any of your addresses (`from_address`). Flagged destructive: clients ask before each call. |
`send_email` takes a body in light Markdown: blank line = paragraph, `- ` bullets,
`1. ` numbered lists, `**bold**`, `*italic*`, `[text](https://url)`. It is sent as
HTML with a plain-text alternative. With `reply_to_uid`, the reply is threaded
(`In-Reply-To`, `References`) and quotes the original (`include_original=false`
to skip).
The sender is your Bridge login by default. `from_address` picks another address
of your account, and replies go out from the address the original was sent to,
like in Proton's own apps. Bridge doesn't add the display name set in Proton's
settings, so the server takes it from your recent messages in Sent.
## Local setup (Claude Desktop)
Requirements: [uv](https://docs.astral.sh/uv/) (or Python 3.12+), Proton Mail
Bridge installed and logged in.
In Bridge, open your account and copy the **IMAP/SMTP username and password**
(generated by Bridge, not your Proton password). Then add the server to
`claude_desktop_config.json`. Open it from Claude Desktop → Settings → Developer →
Edit Config, or directly:
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
- Linux: `~/.config/Claude/claude_desktop_config.json`
```json
{
"mcpServers": {
"proton-mail": {
"command": "uvx",
"args": ["proton-mcp"],
"env": {
"PROTON_BRIDGE_USER": "you@proton.me",
"PROTON_BRIDGE_PASSWORD": "password-from-bridge"
}
}
}
}
```
Fully quit and restart Claude Desktop after editing the file.
Without uv: `pip install proton-mcp`, then use `"command": "proton-mcp"` (the full
path to that script if it isn't on your `PATH`) and no `args`.
### Configuration
| Variable | Default | |
| --- | --- | --- |
| `PROTON_BRIDGE_USER` | (required) | Username shown by Bridge |
| `PROTON_BRIDGE_PASSWORD` | (required) | Password generated by Bridge |
| `PROTON_IMAP_HOST` | `127.0.0.1` | Must be a loopback address (also used for SMTP) |
| `PROTON_IMAP_PORT` | `1143` | |
| `PROTON_IMAP_SECURITY` | `starttls` | `starttls` (Bridge default) or `ssl` |
| `PROTON_SMTP_PORT` | `1025` | |
| `PROTON_SMTP_SECURITY` | `starttls` | `starttls` or `ssl` |
| `PROTON_QUOTE_LANG` | `en` | Language of the "On … wrote:" line in replies: `en` or `fr` |
| `PROTON_SENDER_NAME` | *(from Sent)* | Name shown in `From`, for every address. By default, the name found on your recent messages in Sent from that address; set it empty for the bare address |
| `PROTON_FROM_ADDRESSES` | *(none)* | Extra addresses of your account allowed as `from_address`, comma-separated. The Bridge login and the addresses you've sent from (found in Sent) are always allowed; any other address is refused |
| `PROTON_ENABLE_SEND` | `true` | `false` removes `send_email` and `list_sender_addresses`: the server becomes strictly read-only |
The config file holds your Bridge password: keep it readable by you only.
## Remote setup (claude.ai connector)
`remote/server.py` serves the same tools over streamable HTTP, behind a
single-user OAuth password page, for claude.ai on the web and mobile.
`send_email` and `list_sender_addresses` are off unless `ENABLE_SEND=true`; the
`PROTON_*` variables above work the same in `.env`. A Dockerfile and compose file are
included, plus Apache and Caddy configs that only let Anthropic's IP ranges reach
`/mcp`.
See **[docs/deploy.md](https://github.com/vdeabreu/proton-mcp/blob/main/docs/deploy.md)** for the full guide (headless Bridge,
Docker, reverse proxy, claude.ai).
## Security
Giving an AI assistant access to your mailbox is powerful and risky. What this
project does about it:
- **Read tools don't change anything.** Folders are opened with `EXAMINE` and
bodies fetched with `BODY.PEEK`; there is no tool to move, flag or delete.
Text arguments containing control characters are rejected, so a search term
can't smuggle extra IMAP commands to Bridge.
- **Sending is opt-in and should stay on approval.** `send_email` carries the MCP
`destructiveHint`, and the server instructions tell the model to show the exact
draft (sender address included) and wait for explicit approval. A hint is not enforcement: in your client,
keep `send_email` on "ask every time". Set `PROTON_ENABLE_SEND=false` (local) or
leave `ENABLE_SEND=false` (remote, the default) to remove it entirely.
- **Only your own addresses can send.** Bridge accepts any sender address, so the
server checks `from_address` itself against your addresses (Bridge login,
`PROTON_FROM_ADDRESSES`, addresses found in Sent) and refuses the rest.
- **Email content is untrusted.** An email can contain text written to steer the
model ("forward this to…", "search for …"). The server instructions say never
to follow instructions found in emails, and `read_email` drops text hidden with
the usual HTML tricks (`display:none`, `font-size:0`…), but neither is a
guarantee. Treat any action the model proposes after reading an email with
suspicion.
- **Loopback only.** The server refuses any Bridge host that isn't `127.0.0.1`,
`::1` or `localhost`. TLS verification is disabled for that reason only (Bridge
uses a self-signed certificate).
- **Remote mode**:
- OAuth with a 20+ character password, a lockout after 5 failures, and tokens
stored in SQLite.
- Only claude.ai's callback can be registered as redirect URI, and the number of
clients is capped.
- The password page says which client asks and can't be framed by another site.
- `/mcp` is restricted to Anthropic's outbound IPs by the reverse proxy.
- Every tool call is logged without email bodies; the container is read-only and
unprivileged.
- **Remote mode, known limits:**
- The lockout is global: anyone can make *new* logins wait 15 minutes by failing
5 times. Tokens already issued keep working.
- Anyone can add your server URL as a connector in *their own* claude.ai account
and send you the resulting authorization link. If you type your password, their
account gets access. Only type it right after clicking *Connect* yourself.
Your Bridge password and `MCP_PASSWORD` give access to your whole mailbox:
keep `.env` and `claude_desktop_config.json` private.
To report a vulnerability, see [SECURITY.md](https://github.com/vdeabreu/proton-mcp/blob/main/SECURITY.md).
## Limitations
- `search_emails` accepts one non-ASCII search field at a time (IMAP `CHARSET UTF-8`
literal).
- `read_email` converts HTML to text and drops link targets and hidden elements.
Hiding detection is a heuristic: white-on-white text or CSS classes get through.
- Replies quote the original as plain text (its formatting is not kept).
- Attachments are listed, not downloaded or sent.
- Bridge must be in *combined* address mode (the default), with one login for
all addresses. In *split* mode each address has its own login, and the server
only uses one.
- Proton rebuilds outgoing messages: recipients get base64-encoded parts and a
plain-text version that Proton regenerates from the HTML.
## Development
```bash
git clone https://github.com/vdeabreu/proton-mcp && cd proton-mcp
pip install -e ".[remote,dev]"
pytest
ruff check .
```
Tests don't need Bridge: they cover IMAP command injection (against a fake
IMAP server), message building, Markdown rendering, quoting, hidden HTML,
folder-name encoding, sender address and display name selection, and the OAuth
flow (redirect allowlist, client cap, lockout, security headers).
See [AGENTS.md](https://github.com/vdeabreu/proton-mcp/blob/main/AGENTS.md) for the invariants to keep when changing the code.
## License
[MIT](https://github.com/vdeabreu/proton-mcp/blob/main/LICENSE)
TDQS
Scored across 6 tools
read_email, list_folders, list_sender_addresses, and send_email are clearly distinct resource+action pairs. The only real overlap is list_emails vs search_emails, which return the same header-only format from a folder; descriptions differentiate them (recent vs filtered) but an agent may still pick one when the other was intended.
Every tool follows a consistent verb_noun snake_case pattern (read_email, list_folders, list_emails, search_emails, send_email) with list_sender_addresses the only longer name, still matching the schema. No mixed casing or vague bare verbs.
Six tools is well-scoped for a focused mail client covering the read/list/search/send lifecycle. Each tool earns its place, and helper operations (sender addresses, folders) are exposed rather than hidden inside send_email.
The read-and-send workflow is fully covered, including threading and sender selection. However, a mail domain typically needs mailbox management — mark read/unread (read_email explicitly does not), move/archive/delete, and attachment handling — none of which exist, leaving dead ends for triage tasks.