
Mail-MCP
io.github.Rixtayzv0.1.2更新於 Oct 1, 2026
Personal Outlook.com / Hotmail inbox: read, search, file, delete, unsubscribe via Microsoft Graph.
概覽
讓助理透過 Microsoft Graph 讀取、搜尋、歸檔、刪除個人 Outlook.com 或 Hotmail 信箱的郵件,並取消訂閱電子報。
- 功能
- 九個 mail_ 工具涵蓋資料夾列表與建立、依寄件者、日期、未讀狀態或全文列出與搜尋郵件、取得單封郵件全文並偵測取消訂閱方式、依寄件者彙整整個資料夾、移動最多 500 封郵件、刪除到「刪除的郵件」或永久刪除、依寄件者批次移動或刪除(支援 dryRun),以及透過 RFC 8058 一鍵 POST、mailto: 或連結取消訂閱。刪除預設進入「刪除的郵件」,永久刪除需要明確旗標。沒有一般寄信工具,Mail.Send 只用於 mailto: 取消訂閱請求。
- 適用情境
- 適合用助理清理爆滿的個人 Outlook.com、Hotmail、Live 或 MSN 收件匣:彙整寄件者、標記電子報、取消訂閱,以及批次歸檔或刪除郵件。
- 執行需求
- 透過 npx 從 npm 套件 @rixtay/mail-mcp 以 stdio 在本機執行;需要 Node.js 22 或更新版本、個人 Microsoft 帳戶,以及免費的 Microsoft Entra 應用程式註冊。必須設定 MAIL_MCP_CLIENT_ID,MAIL_MCP_CACHE_PATH 為選用。一次性登入指令會開啟瀏覽器並儲存權杖快取,權杖約可持續更新 90 天。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mail-MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Mail-MCP
[CI] [npm] [Node] [License: MIT] [MCP Registry]
[Mail-MCP: AI-powered inbox control for Outlook]
A small, focused MCP server that lets Claude (Claude Desktop, Cowork, Claude Code or any MCP client) work on a personal Outlook.com / Hotmail / Live mailbox through Microsoft Graph: read and search mail, file it into folders, delete it, and unsubscribe from newsletters.
Built for one job: clean up an overflowing personal inbox with an AI assistant, safely.
Tools
Nine tools, all prefixed mail_:
Design choices:
- Safe by default. Deletion goes to Deleted Items (visible and restorable in Outlook). Permanent deletion requires an explicit flag. Bulk actions support
dryRun. - Efficient on big mailboxes.
mail_senders_summaryscans thousands of messages in a few seconds (1,000-item pages, minimal$select) and only fetches headers for the top senders through$batch. - No generic send tool. The
Mail.Sendpermission is used solely to sendmailto:unsubscribe requests. - Every tool ships a strict input schema, an output schema and MCP annotations (
readOnlyHint,destructiveHint, …) so hosts can auto-approve read-only calls.
Requirements
- Node.js 22 or newer.
- A personal Microsoft account (outlook.com, hotmail.com, live.com, msn.com).
- A free Microsoft Entra app registration (5 minutes, below). Password-based IMAP was switched off for personal accounts in September 2024, so an OAuth app is the only supported way in.
1. Register an app in Microsoft Entra (once, free)
No Azure subscription is needed for a public client app.
- Go to https://entra.microsoft.com and sign in with your personal Microsoft account.
- Identity → Applications → App registrations → New registration.
- Fill in:
- Name:
Mail-MCP - Supported account types: Personal Microsoft accounts only
- Redirect URI: platform Mobile and desktop applications, value
http://localhost
- Name:
- Click Register and copy the Application (client) ID (
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). - Under Authentication, make sure
http://localhostis listed under "Mobile and desktop applications" and Allow public client flows is Yes. - Under API permissions, add Microsoft Graph delegated permissions:
Mail.ReadWrite,Mail.Send,User.Read,offline_access. No admin consent is needed; you consent at first sign-in.
No client secret is created: the server is a public client using the authorization code flow with PKCE.
2. Sign in
No install needed, npx fetches the package from npm (@rixtay/mail-mcp, the installed command is mail-mcp):
Or from a clone:
The login command opens your system browser, signs you in with Microsoft, then stores the token cache in ~/.mail-mcp/token-cache.json (file mode 600). Tokens refresh silently for 90 rolling days. If a tool ever answers "Token expired", run the same command again.
3. Connect to Claude Desktop / Cowork
Edit ~/Library/Application Support/Claude/claude_desktop_config.json on macOS (or %APPDATA%\Claude\claude_desktop_config.json on Windows), reachable through Settings → Developer → Edit Config.
If Claude Desktop cannot find npx (it does not inherit your shell PATH), use absolute paths instead: "command": "/absolute/path/to/node", "args": ["/absolute/path/to/Mail-MCP/dist/index.js"].
Quit Claude Desktop completely and start it again. Logs: ~/Library/Logs/Claude/mcp-server-mail.log.
Cowork runs local MCP servers only in local sessions, not in cloud sessions.
4. Connect to Claude Code
5. Example prompts
- "Summarise the senders in my inbox and flag the newsletters."
- "Unsubscribe me from every newsletter I haven't opened in six months, then move their messages to Deleted Items."
- "Create an Invoices folder and move everything from [email protected] into it."
- "Show me the latest email from my bank."
Typical flow: mail_senders_summary → the assistant proposes a list, you confirm → mail_unsubscribe(lastMessageId) per newsletter (when the answer is method: "browser", the assistant opens the URL in its browser and finishes there) → mail_bulk_by_sender(action: "delete").
Development
Layout:
Stack: @modelcontextprotocol/server v2, zod v4, @azure/msal-node v6, html-to-text.
Things worth knowing
- Message ids change whenever a message changes folder.
mail_moveandmail_deletereturn the old → new id mapping. - A normal delete is a move to Deleted Items. Graph's own
DELETEwould drop the item into Recoverable Items, which is invisible in Outlook, so it is deliberately not used. - Microsoft throttles Outlook to 10,000 requests per 10 minutes per mailbox and 4 concurrent requests. Batches are serialised and retried on 429.
mail_searchwithquery(full text) cannot be combined with the other filters (Graph limitation) and tops out at a few hundred results.- Whether an unsubscribe actually takes effect is up to the sender. One-click and
mailto:send the request; the assistant's browser handles the rest. - The authority is
login.microsoftonline.com/consumers. Withcommon, refresh tokens for personal accounts are rejected after the first refresh.
Contributing
Bug reports, fixes and focused new tools are welcome: see CONTRIBUTING.md. Please never paste real email content, addresses or tokens in an issue. Found a way the server could leak mail or tokens, or act without being asked? Please report it privately, as described in SECURITY.md.
Release history: CHANGELOG.md.
License
MIT
來源:README.md,提交 8b8f760
工具
0版本歷史
1- v0.1.2最新Oct 1, 2026


