Mailbrain MCP Server
Connects Gmail accounts through IMAP/SMTP using an app password so mail and attachments can be fetched, indexed, searched and managed, including drafts, sending, forwarding, moves, archiving, trash and flags within the account's permissions.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
OSULZER Mailbrain

English | Deutsch
Mailbrain fetches your mail over IMAP into a local database and makes every mailbox and every attachment searchable, by keyword and by meaning. Claude Code, Claude Desktop and other AI agents connect over MCP and can search, read and write drafts, send, move or forward mail, but only as far as you allow, and every step shows up in an activity log you can undo from.
A free tool by OSULZER for Windows, macOS and Linux.
Features
Search across all accounts and attachments: full-text and semantic search (local embedding model), text from PDF, Word, Excel, PowerPoint and text files, newest mail first
MCP server for agents: 22 tools to search, list, read mails, threads and attachments, create drafts and replies, send, forward with attachments, move, archive, trash, flag and mark as processed
Permission levels per account (read only, drafts, full) and a list of allowed recipients: agents never send to anyone else
Activity log with the agent's name for every call; moves, archiving, trash and flags can be undone for 7 days
Writing style: a formal and an informal style guide per account, built from your sent mail, so agents write like you
Instructions for agents, general and per account, which every agent reads at the start
Several signatures per account, import from Thunderbird and classic Outlook (Windows)
Several accounts, Gmail preset, start at login (in the tray), automatic updates from GitHub (signed), English and German user interface
Related MCP server: universal-email-mcp
Install
Download the file for your system from the latest release. The builds are not code-signed yet.
Windows
Download
…_x64-setup.exeand start it.Windows SmartScreen may warn that the app is unknown: click More info → Run anyway.
The setup installs Mailbrain for your user, together with the stdio bridge for agents. Mailbrain starts at login and keeps running in the tray when you close the window.
macOS
Download
…_aarch64.dmg(Apple Silicon) or…_x64.dmg(Intel), open it and drag Mailbrain to Applications.The app is not notarized by Apple. On first start macOS blocks it: open System Settings → Privacy & Security and click Open Anyway next to the message about Mailbrain.
Linux
Download
…_amd64.AppImage(thenchmod +xit and start it) or…_amd64.deb(sudo apt install ./…_amd64.deb).Passwords and keys are stored in the system keyring, which needs a Secret Service (GNOME Keyring or KWallet).
The AppImage updates itself; with the .deb, Mailbrain points you to the download page instead.
First steps
Connect account: email address, IMAP server and password (Gmail: choose the provider Gmail and use an app password). IMAP needs TLS on port 993; for sending, SMTP with TLS or STARTTLS. The password goes to the operating system's keychain, not into the database.
On first start Mailbrain downloads its embedding model once (about 465 MB).
Mailbrain fetches and indexes in the background, newest mail first; search already works while it runs. For large mailboxes the first run can take hours. New mail is fetched every 2 minutes. The number of CPU cores used for semantic search can be set on the home page under Status.
More accounts: Settings → Manage accounts → Add account.
Connecting agents
On the home page under Agents, enter a name and click Add agent. Mailbrain shows the access key once, together with the ready-to-copy setup. Each agent gets its own key, which you can revoke there at any time.
Recommended: the stdio bridge mailbrain-mcp-stdio, which is installed with the app. It survives
restarts and starts Mailbrain when it is not running. Claude Code (the app shows the full path):
claude mcp add mailbrain --env MAILBRAIN_TOKEN=<key> -- "<path to mailbrain-mcp-stdio>"Other clients (Claude Desktop, Cursor …), under Other clients (stdio):
{
"mcpServers": {
"mailbrain": {
"command": "<path to mailbrain-mcp-stdio>",
"env": { "MAILBRAIN_TOKEN": "<key>" }
}
}
}Alternative over HTTP (the app must be running):
claude mcp add --transport http mailbrain http://127.0.0.1:47600/mcp --header "Authorization: Bearer <key>"A good first instruction for the agent: call get_instructions, then work through
list_emails with unprocessed_only and close each mail with mark_processed. Before the first
automatic run, use Mark existing emails as processed (Settings, account page Processed
flag) so the agent does not work through your whole inbox.
Permission levels and allowed recipients
Set per account under Settings → Permissions & recipients. New accounts start at level 1; raising it needs a confirmation. The level is checked on every call.
Level | Agents may |
1 Read only | search and read mails, threads and attachment text, read instructions and style samples, mark mails as processed |
2 Create drafts | also create drafts and reply drafts, save attachments to a folder, save style guides |
3 Full: send, move, flag, trash | also send, forward, move, archive, move to trash, set read and flagged |
send_email and forward_email only send when every recipient (To, Cc, Bcc) is on the account's
Allowed recipients list: full addresses or whole domains (@example.com). Otherwise nothing is
sent; the mail is saved as a draft and the answer names the blocked addresses. Agents cannot change
the list. Nothing is ever deleted for good; trash is a folder move.
Writing style
Under Settings → Writing style (per account) Mailbrain builds two guides from the sent folder,
Formal and Informal (first name), which agents receive with get_instructions. They are
generated either by a Language model endpoint (Settings → Language model: any OpenAI-compatible
service, local ones such as LM Studio or Ollama work) or by your Connected agent. You can edit them
and regenerate them.
Privacy
Your mail stays on your computer: the database, the search index and the vectors live in the app's data folder (
%APPDATA%\at.osulzer.mailbrainon Windows). Passwords and API keys are in the system keyring.The embedding model runs locally. Only the model download itself goes to the internet (Hugging Face), apart from your mail servers and the update check on GitHub.
Mail text leaves your computer only in two cases: excerpts of sent mail go to the language-model endpoint you configure when you generate a writing style (a local LM Studio or Ollama keeps them on your machine; the page warns when the service is not in your network), and an agent you connect receives what it reads.
The MCP server listens on
127.0.0.1only and refuses every request without a valid access key.
System requirements
Windows (x64), macOS (Apple Silicon or Intel), Linux x86_64 with glibc 2.39 or newer (e.g. Ubuntu 24.04, Debian 13)
Disk space: the embedding model 465 MB, plus about 200 MB of database and about 70 MB of vector index per 10,000 mails (measured with 107,000 mails and 60,000 attachments: 2.2 GB database, 718 MB vectors). Before a database upgrade Mailbrain writes a backup copy of the database next to it; older backups can be deleted.
RAM: typically a few hundred MB while indexing, less when idle.
IMAP with implicit TLS (port 993); SMTP with TLS or STARTTLS. No IMAP IDLE yet.
Signature import from Thunderbird and Outlook is Windows only.
Updates
Mailbrain checks GitHub once a day (Settings → Updates, Check for updates automatically) and installs an update only when its signature is valid.
Building
Requirements: Rust 1.96, Node.js and pnpm 11, the Tauri prerequisites
for your system, and protoc (on Windows: powershell -File scripts/setup-protoc.ps1).
pnpm install
pnpm tauri dev # development build
pnpm build && pnpm test # UI build and tests
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warningsIntegration tests against a GreenMail server need Docker:
docker compose -f docker-compose.test.yml up -d
cargo test -p mailbrain-core --test greenmail -- --ignored --test-threads=1
docker compose -f docker-compose.test.yml downThe installers with the stdio bridge are built by GitHub Actions, see .github/workflows/release.yml.
License
Apache License 2.0 with the Commons Clause: you may use (also commercially), modify and share the
software, but you may not sell it or a service whose value derives substantially from it. The name
"OSULZER" and the OSULZER logo are not licensed and may not be used for modified versions. See
LICENSE and NOTICE. Third-party licenses are listed in THIRD-PARTY-LICENSES.html
in every release.
Made by OSULZER.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Policy-guarded Gmail for AI agents: search, read, draft and send under rules you set.
Give AI agents their own email inboxes: list, read and send mail via scoped, revocable OAuth grants.
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Business email on your domain for AI agents: read, draft and send with the permissions you choose.
Related MCP Servers
- AlicenseAqualityAmaintenanceMCP server that gives AI assistants your mailboxes: search and read mail, see what is new, look at attachments, sort, draft and, if allowed, send. Works through Mailbox, a self-hosted service with REST API and web UI that gives each token its own rights, folders and send limits. AI agents sort and tag mail within the same rights. Supports IMAP, POP3, JMAP, Gmail, Microsoft 365, Outlook.com.206MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to search, retrieve, and send email across multiple ordinary IMAP, POP3, and SMTP mailboxes, with per-account permissions and safe sending checks.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to search, read, organize, draft, send, and schedule email through a scoped token, with actions journaled and reversible. It also supports proposal queues, approval workflows, and undo operations for safe mailbox automation.9Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables an AI client to search Gmail, Outlook, Hotmail, iCloud and Fastmail mailboxes at once and read, draft, send and organise mail in each. It also supports attachments, labels, filters, signatures and vacation responders, with per-mailbox permissions controlling what may be sent.MIT