rubit-mcp-mail
This server provides read-only, provider-agnostic IMAP access to configured mail accounts.
List configured accounts and check whether each is authenticated.
List mailbox folders with normalized roles and unread counts.
Browse messages in a folder, newest first, with pagination.
Search server-side by text, sender, subject, date range, and unread status.
Read full message headers, body text, and attachment metadata without marking messages as read.
Download a specific attachment into the configured download directory.
Provides read-only access to Gmail mailboxes via IMAP, including listing folders, searching messages, reading email content, and downloading attachments.
Provides read-only access to iCloud Mail via IMAP, including listing folders, searching messages, reading email content, and downloading attachments.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@rubit-mcp-mail Search my inbox for unread emails from Sarah and show the latest one."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
rubit-mcp-mail
A read-only MCP server for reading your mail. Provider-agnostic: it speaks IMAP, so it works with Outlook.com, Gmail, Fastmail, iCloud, or a self-hosted server — the provider is a line of config, not a code change.
Read-only by construction. Folders are opened with EXAMINE, never SELECT,
and bodies are fetched with BODY.PEEK, so reading a message does not even mark
it as read. There are no send, move, delete, or flag code paths, and a test
asserts none are ever added.
📖 Full documentation: https://bgalmes.github.io/rubit-mcp-mail/
Quick install
Download the installer for your system from the latest release and run it:
System | File |
Windows |
|
Linux |
|
Nothing needs to be installed beforehand: Python and every dependency are inside that one file. A window asks for your provider and email address, signs you in, and registers the mail server with Claude Desktop and Claude Code if it finds them — restart Claude Desktop afterwards and your mail is there. It also leaves you a rubit-mcp-mail Settings shortcut for everything you want to change later. No terminal, at any point.
There is no macOS installer; on a Mac, install from source (below).
A note on antivirus warnings. Windows Defender or Avast may flag this .exe.
This is a known false positive common to unsigned PyInstaller-built applications,
not anything this project's code does — see
the install guide
for what to do about it. Every published SHA-256 is listed on
the changelog.
Related MCP server: mcpmail
Tools
Tool | What it does |
| Configured accounts and whether each is authenticated |
| Folders with normalized roles and unread counts |
| Browse a folder, newest first, paginated |
| Server-side search by text, sender, subject, date range, unread |
| Full headers, body text, attachment metadata |
| Save one attachment into the download directory |
Folders are addressed by role — inbox, sent, drafts, junk, trash,
archive — so you never need to know that Outlook calls it Junk Email while
Gmail calls it [Gmail]/Spam. Raw folder names work too.
Full arguments and return shapes: Tools reference.
Install with pip
If you already have Python 3.11+ and would rather not run an installer:
pip install rubit-mcp-mail
rubit-mcp-mail install # the same setup wizard, from the terminalInstall from source
cd /path/to/rubit-mcp-mail
conda create -p ./.venv python=3.12 pip -y # this machine has no python3-venv
./.venv/bin/python -m pip install -e .Then configure an account, rubit-mcp-mail auth <account>, and
rubit-mcp-mail doctor. The Windows variant and the full walkthrough are in
Install from source.
Setting up a mailbox
Microsoft has retired basic auth for Outlook.com, so Outlook needs a free Azure app registration — seven steps, done once, written out in Setting up Outlook. Everything else takes an app password:
[accounts.personal]
provider = "generic"
email = "you@fastmail.com"
host = "imap.fastmail.com"Known hosts: Gmail imap.gmail.com, Fastmail imap.fastmail.com,
iCloud imap.mail.me.com, Yahoo imap.mail.yahoo.com. Gmail and iCloud require
an app-specific password, not your login password.
Can't register your own Azure app?
If your Microsoft account genuinely can't register one, you can use the public
client ID that other open-source mail tools already share for this purpose —
Thunderbird's, 9e5f94bc-e8a4-4e73-b8be-63364c29d753. Paste it in as
client_id. The consent screen will say "Thunderbird", and because the ID is
outside our control Microsoft could rotate it. Details and caveats:
Can't register your own app?.
Permissions
Any account-scoped tool can be forbidden for a given account with
disabled_tools in config.toml, or by unticking a box on the settings
window's Permissions tab. A blocked call returns a plain Error: ... string to
the model rather than failing silently. See
Permissions.
Registering with Claude
claude mcp add rubit-mail --scope user -- "$(pwd)/.venv/bin/rubit-mcp-mail" serveClaude Desktop needs a JSON entry instead, and on Linux it needs the session environment passed explicitly or the keyring is unreachable — Register with Claude has both, and Troubleshooting has the logs.
Agent skill
skills/rubit-mail/SKILL.md tells an agent when
to reach for the mail tools and how to chain them, and reminds it that the
server is read-only and that mail content is untrusted. For Claude Code, copy it
into your user (or a project's .claude/) skills directory:
mkdir -p ~/.claude/skills && cp -r skills/rubit-mail ~/.claude/skills/Any other agent that reads SKILL.md files works the same way. See
Agent skill.
Development
ruff check .
ruff format --check .
pyright
pytest -qThose are the same checks CI runs. Commit messages follow Conventional Commits and drive automatic versioning — see CONTRIBUTING.md and AGENTS.md. Building the installers and adding a provider are covered in Contributing.
The website
website/ holds the documentation site (Nuxt), deployed to GitHub Pages by
.github/workflows/deploy-website.yml. It is the source of truth for the docs;
this README is deliberately the short version.
Website commits mustnot use feat: or fix:. python-semantic-release
parses the commit type, not the scope, so feat(site): … would bump the
Python package and cut an installer release. Use docs(site):,
chore(site): or ci(site):.
Layout
src/rubit_mcp_mail/
server.py MCP tool definitions
__main__.py CLI: serve | install | auth | doctor | gui
installer.py setup wizard: writes config, signs in, registers with Claude
installer_gui.py the setup window (tkinter), falling back to the terminal
shortcuts.py Start Menu / Desktop / .desktop entries for the GUI
claude_registration.py claude_desktop_config.json / `claude mcp add`
session.py wires config + auth + backend; attachment path safety
config.py TOML config -> Account models
diagnostics.py the doctor checks, as data (shared by the CLI and the GUI)
permissions.py registry of per-account-toggleable tool names
config_editor.py every write to config.toml: comment-preserving, validated
config_gui.py the settings window (tkinter): accounts, permissions, doctor
providers.py provider profile registry
secrets.py keyring with 0600-file fallback
models.py pydantic models + message handles
mime.py BODYSTRUCTURE walking, decoding, HTML->text
backends/
base.py MailBackend protocol
imap.py the IMAP implementation
auth/
password.py app passwords
oauth_microsoft.py MSAL device-code flow
skills/rubit-mail/SKILL.md agent skill: when and how to use the tools
website/ the documentation site (Nuxt); see "The website" aboveReleasing
Every merge to main prepares a release PR carrying only the pyproject.toml
and CHANGELOG.md diff; a maintainer merges it by hand, which publishes the
prerelease and builds the installers; promote-release.yml is dispatched
manually to drop the -rc.N suffix. The human merge is load-bearing — GitHub
raises no events for anything GITHUB_TOKEN does. Full flow:
CONTRIBUTING.md
and How releases work.
Notes and limits
IMAP search is substring-based, bodies are truncated at 20,000 characters, only text parts are downloaded, and Microsoft is actively tightening third-party mail access. The details are in Notes and limits.
Available Tools
6 toolsget_attachmentARead-only
Download one attachment into the configured download directory.
Returns the path it was saved to. Files are only ever written inside that one directory; the mailbox itself is not modified.
Inputs: handle (required), part_id (required), account. Returns: result
list_accountsARead-only
List configured mail accounts and whether each is authenticated.
Call this first if another tool reports an authentication problem.
Inputs: no named parameters. Returns: result
list_foldersARead-only
List the folders in a mailbox with message and unread counts.
Each folder has a normalized role that is stable across providers, so you
can ask for 'junk' without knowing the server calls it 'Junk Email'.
Inputs: account. Returns: result
list_messagesARead-only
Browse messages in a folder, newest first.
Returns summaries only (no bodies). Pass a returned handle to read_message
to get the full text.
Inputs: limit, folder, offset, account, +1 more. Returns: result
read_messageARead-only
Read one message in full: headers, body text, and attachment metadata.
HTML-only mail is converted to text. This does NOT mark the message as read.
Inputs: handle (required), account, max_chars. Returns: result
search_messagesARead-only
Search a folder. All supplied criteria are combined with AND.
Server-side IMAP search, so it works over the whole folder without downloading anything. Results are newest first.
Inputs: text, from_, limit, since, +6 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct operation: account auth, folder listing, message browsing, searching, reading, and attachment download. list_messages and search_messages are clearly separated as browse-all versus filtered-search, so there is no real ambiguity.
All tool names follow a consistent verb_noun pattern: list_accounts, list_folders, list_messages, search_messages, read_message, get_attachment. The naming style is uniform and predictable.
Six tools is well-scoped for a read-only email access server. Each tool covers a necessary part of the workflow without redundancy or bloat.
The tool set fully covers the apparent purpose of browsing and reading email: account discovery, folder navigation, message listing/search, full message retrieval, and attachment access. Since the descriptions explicitly indicate a read-only mailbox posture, the lack of send/delete/move tools is not a gap.
Maintenance
Related MCP Connectors
Never-stored live email: read, send and triage Gmail, Outlook / Microsoft 365, or any IMAP mailbox.
Read mail on your own domain, write drafts and tag conversations. It can't send.
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Connect Gmail, iCloud Mail, Outlook, Yahoo Mail, Fastmail and other IMAP inboxes to ChatGPT, Claude and compatible AI assistants. Find emails by meaning across languages with semantic search. Ask AI to find customer conversations, summarize deadlines and draft follow-ups. Give a sales rep access to a shared outreach inbox or bring email into a compatible CRM. Share an iCloud custom-domain inbox with teammates without their own Apple ID or iCloud+ plan. Search results may be incomplete or stale; separate permissions control mail actions.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to securely access IMAP mailboxes with read-focused tools for searching, reading, listing messages, and creating drafts, while deliberately preventing sending or deleting emails.MIT
- AlicenseNot gradedqualityBmaintenanceEnables read-only access to multiple email accounts, including Gmail via App Password and generic IMAP providers, so an agent can list accounts and folders, search messages, and fetch messages or attachments. All operations are strictly read-only, with no sending, writing, deleting, or moving.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables read-only IMAP email access through MCP, including listing accounts and folders, searching messages, retrieving message bodies and attachments, and viewing threads without modifying mail state.MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients and AI assistants to search and read email through read-only IMAP access, including bounded message reads and explicitly selected attachment retrieval.MIT