AnyMail MCP
Connect all your email accounts to your AI agent — not just one. AnyMail MCP is a local MCP server that gives an agent full read/send/organize/delete access across multiple Gmail accounts at once, over IMAP/SMTP.
README
AnyMail MCP
Connect all your email accounts to your AI agent — not just one.
AnyMail MCP is a local MCP server that gives an agent (Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, …) full read / send / organize / delete access across multiple Gmail accounts at once, over IMAP/SMTP. Per-account App Passwords live in the macOS Keychain — nothing is hosted, and your credentials never leave your Mac.
Why AnyMail MCP exists
Today, connecting your mail to an AI agent generally means one account at a time — a single Gmail, or a single Microsoft 365 mailbox. But most people live across several inboxes: personal, work, a side project, an old address that still gets the important stuff. The agent can only ever see one of them.
AnyMail MCP removes that limit. Connect every Gmail account you have, and your agent can search, triage, draft, send, label, and clean up across all of them in a single session — while every credential stays on your machine.
Multi-provider support (Microsoft 365 / Outlook, generic IMAP, iCloud) and OAuth sign-in are on the roadmap. v0.3.0 is Gmail + App Passwords (generic IMAP providers are included but experimental).
What it can do
Full CRUD across every connected account:
| Kind | Operations |
|---|---|
| Read | list accounts · search (native Gmail syntax) · read message · read thread · list labels · fetch attachments |
| Create | send · save draft · create label |
| Update | add/remove labels · read/unread · star/unstar · archive · move |
| Delete | trash (reversible) · permanent delete (explicit confirm:true) |
Every tool takes an optional account (the email address); omit it to use your
default account.
Get started
AnyMail MCP runs two ways from one engine. Pick the track that fits you.
Prerequisite (every account, one-time)
- Turn on 2-Step Verification on the Google account.
- Create a 16-character App Password at https://myaccount.google.com/apppasswords. (IMAP is always-on for Gmail — nothing else to toggle.)
An App Password grants full mailbox access and is stored only in your Keychain. If a machine is lost, revoke it at the URL above — that instantly cuts AnyMail MCP off from that account. See SECURITY.md.
Track A — Command line (works today)
For developers and anyone comfortable in a terminal.
git clone https://github.com/MarcinWalendowski/anymail-mcp.git
cd anymail-mcp
npm install # @napi-rs/keyring ships prebuilt binaries — no compiler needed
npm run build # → dist/index.js
# add accounts (prompts for the App Password, hidden)
node dist/index.js add you@gmail.com --name "Personal" --default
node dist/index.js add work@company.com
node dist/index.js add archive@gmail.com --read-only # triage-only: refuses all writes
node dist/index.js list
node dist/index.js test you@gmail.com # verify IMAP + SMTP
# other providers (experimental — folder-based, limited search, no threads):
node dist/index.js add you@icloud.com --provider icloud
node dist/index.js add you@fastmail.com --provider fastmail
node dist/index.js add you@host.tld --provider imap --imap-host imap.host.tld --smtp-host smtp.host.tld
# register into every agent it can detect
node dist/index.js install
Tip: npm link once, then the commands are just anymail-mcp add …, anymail-mcp list, etc.
Track B — Menu-bar app (GUI)
For a no-terminal experience: a macOS menu-bar app that supervises the engine and
gives you an Add Account window, an Install into Agents button, and
Start at Login — the App Password never touches the app, it's posted once to
127.0.0.1 and the engine stores it in the Keychain.
The Add Account window supports Gmail, iCloud, Fastmail, or a custom IMAP host
(a provider picker reveals host/port fields for the custom case). Accounts can also
be added from an agent with the add_account MCP tool — though the GUI is the more
private path, since it posts the password straight to the local engine and the model
never sees it.
The window also has a "Create an App Password" assistant so you don't have to hunt through Google settings: one button opens Google's App Passwords page in your own browser, or you can hand the task to an AI agent — it copies a ready-to-run prompt and opens Claude for Chrome (runs locally in your browser) or ChatGPT / Claude.ai. The app never automates Google's page itself; the returned 16-character code is pasted back into the field (there's a Paste button) and verified as usual. Note: cloud agents create the password on a remote machine — prefer the local options; the window warns you inline.
The source and build steps live in app/. Today you build it
yourself (xcodegen generate + Xcode). A signed, notarized download that opens
with a double-click is on the roadmap — the full plan (self-contained
engine, DMG, notarization, CLI channels) is in DISTRIBUTION.md;
notarizing needs an Apple Developer account, so it can't be produced here.
Connect it to your agent
node dist/index.js install writes the right config for each agent it detects:
| Agent | Transport | What gets written |
|---|---|---|
| Cursor · Claude Code · VS Code · Windsurf | HTTP | local URL + Authorization: Bearer <token> |
| Claude Desktop | stdio | spawn command (its own engine, same Keychain) |
Restart the agent afterward, then ask it to list_accounts.
Security model
The engine can read, send, and delete your mail, so the always-on server is locked down (full detail in SECURITY.md):
- Binds
127.0.0.1only — never listens on the network. - Bearer token on every request (engine + admin API), minted on first run and
stored
0600outside the repo. App Passwords never appear in any response. - Origin validation — rejects browser origins (DNS-rebinding defense).
- App Passwords live only in the macOS Keychain.
- Per-account read-only mode; permanent delete requires
confirm:true. - Logs go to stderr with secret/body redaction.
Nothing secret is ever written into this repository — account config and the
server token live in ~/.gmail-mcp/ (outside the repo), passwords live in the
Keychain.
Roadmap
- [x] Generic IMAP providers — iCloud, Fastmail, and any IMAP host now work via
--provider(experimental: folder-based, limited search, no threads). - [ ] More providers — Microsoft 365 / Outlook (needs OAuth), Yahoo, so one agent spans every mailbox regardless of host.
- [ ] OAuth sign-in — connect an account with a normal "Sign in with Google / Microsoft" flow instead of manually creating App Passwords.
- [ ] One-click install — a signed & notarized DMG and a Homebrew cask so non-technical users download and run without Gatekeeper warnings.
- [ ]
npm/npxdistribution for the CLI/engine. - [ ] Windows & Linux engine builds (the engine is plain Node; the Keychain layer is the only platform-specific piece).
How it works
Agent (Claude Code / Desktop / Cursor …)
│ MCP over stdio or HTTP (127.0.0.1)
▼
AnyMail MCP engine (local Node process)
│ ImapFlow → imap.gmail.com:993 (search, labels, threads, delete)
│ Nodemailer→ smtp.gmail.com:465 (send, drafts)
▼
Gmail — authenticated per account with an App Password from the Keychain
Why IMAP/SMTP + App Passwords instead of the Gmail HTTP API: full-CRUD Gmail API
access needs restricted OAuth scopes, which for personal @gmail.com accounts
forces Google app verification + an annual CASA security assessment (or a 7-day
token expiry in Testing mode). App Passwords + IMAP sidestep all of it and run
fine in a local process — and IMAP needs a long-lived TCP socket, so this can't
be a serverless function anyway. See app/BUILD.md for the
macOS app internals.
Contributing
Issues and PRs welcome — see CONTRIBUTING.md. Release process is in RELEASING.md.
License
MIT © Marcin Walendowski
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。