
Email Mcp
io.github.marlinjai由 GitHub 帳號 marlinjai 發布v1.2.3更新於 Oct 24, 2026
Unified email MCP server for Gmail, Outlook, iCloud, and IMAP with batch operations
概覽
本機 MCP 伺服器,讓助理統一存取 Gmail、Outlook、iCloud 與一般 IMAP 信箱,進行搜尋、閱讀、寄送與整理郵件。
- 可以做什麼
- 搜尋與閱讀郵件:列出資料夾、精簡或含內文的搜尋、單封郵件、郵件串與附件(下載或存到磁碟)
- 撰寫與管理郵件:寄送、在原郵件串中回覆、轉寄、建立與更新草稿、列出草稿
- 整理郵件:移動、跨帳號轉移或複製、刪除、標示已讀/星號/旗標、標籤、資料夾
- 批次操作:一次呼叫批次刪除、移動、標示與加標籤,最多可處理數百封郵件
- 垃圾郵件與規則:回報垃圾郵件,建立、列出、刪除封鎖規則與轉寄規則(僅 Gmail 與 Outlook)
- 帳號管理:列出帳號、新增 IMAP/iCloud 帳號、測試連線、移除帳號及其儲存的憑證
- 適用情境
- 適合想讓助理直接操作多個服務商真實信箱的情境,例如整理收件匣、依條件搜尋郵件、起草或寄送回覆、批次清理電子報,或設定垃圾郵件與轉寄規則,而不必在多个網頁用戶端之間切換。
- 執行需求
- 透過 npx 或全域 npm 安裝後在本機執行(需要 Node.js)。帳號以互動式安裝精靈新增:Gmail 與 Outlook 使用瀏覽器 OAuth2 授權,iCloud 需要專用密碼,一般 IMAP 需要主機、連接埠與憑證。選用環境變數:EMAIL_MCP_GMAIL_CLIENT_ID 與 EMAIL_MCP_GMAIL_CLIENT_SECRET、EMAIL_MCP_OUTLOOK_CLIENT_ID、EMAIL_MCP_KEY、EMAIL_MCP_ATTACHMENTS_DIR、EMAIL_MCP_FORWARD_ALLOWLIST、EMAIL_MCP_DOWNLOADS_DIR。需要能連線到郵件服務商。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Email Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
@marlinjai/email-mcp
A unified MCP server for email access across Gmail, Outlook, iCloud, and generic IMAP providers.
Features
- Multi-provider support -- Gmail (REST API), Outlook (Microsoft Graph), iCloud (IMAP), and generic IMAP/SMTP
- OAuth2 authentication -- Browser-based OAuth flows for Gmail and Outlook, with automatic token refresh
- Full email client -- Search, read, send, reply, forward, organize, and manage drafts
- Batch operations -- Delete, move, or mark hundreds of emails in a single call
- Lightweight search -- Compact search results by default (~20KB vs ~1.4MB) with optional full body retrieval
- Encrypted credential storage -- AES-256-GCM encryption at rest with machine-derived keys
- Provider-native APIs -- Uses Gmail API and Microsoft Graph where available for richer features, falls back to IMAP for universal compatibility
Installation
Install globally from npm:
Or run directly with npx (no install needed):
Quick Start
- Run the interactive setup wizard to add your email accounts:
The
-p/--packageflag is required. This package declares two binaries (email-mcpfor the MCP server,email-mcp-setupfor this wizard). Without-p, npx runs the bin matching the package's own name (email-mcp, the server) and silently passesemail-mcp-setupto it as an ignored argument — the server then sits waiting for MCP protocol input on stdin forever, producing no output at all. It looks exactly like a hang.-ptells npx explicitly which package to resolve and which of its binaries to actually run.
The wizard will walk you through provider selection and authentication. After each account, it asks if you'd like to add another — so you can set up Gmail, Outlook, and iCloud all in one go.
- Add the server to your MCP configuration (
.mcp.json):
- Start using email tools in Claude Code — search your inbox, send emails, organize messages, and more.
Provider Setup Guides
Gmail
No configuration needed — the setup wizard handles everything using built-in OAuth credentials (PKCE):
The wizard asks which Gmail permission scope to authorize:
- Full (default) — everything below, plus immediate, Trash-bypassing permanent deletion (
https://mail.google.com/, Gmail's maximum-permission scope). - Restricted — read, send, label, archive, and move-to-trash (
gmail.modify+gmail.settings.basic), but no permanent deletion. Every tool in this server works identically under Restricted except an explicitpermanent: truedelete, which fails with a Gmail API error instead of succeeding.
Pass --scope full or --scope restricted to skip the prompt, or set EMAIL_MCP_GMAIL_SCOPE=restricted in the environment the wizard runs in.
Verification status (1 October 2026): Google's review of the shared OAuth app is still running, so Google currently only lets accounts on its test-user list sign in through it; everyone else sees the "has not completed the Google verification process" screen and needs their own OAuth app (next note). The last open step for the shared app is a yearly independent security assessment (CASA, Cloud Application Security Assessment) that Google has requested. Because email-mcp has no server of its own, its applicability is being clarified with Google. Details and current status: email.lumitra.co/privacy#google-verification, tracked in issue #1.
Note: If you prefer to use your own OAuth app instead of the shared one this package ships with, create a Desktop OAuth 2.0 Client in the Google Cloud Console with the Gmail API enabled, then set
EMAIL_MCP_GMAIL_CLIENT_IDandEMAIL_MCP_GMAIL_CLIENT_SECRETin the environment before running the setup wizard (and in the MCP server's environment, since re-authentication uses the same variables). This gives you your own token lifecycle, independent of the publisher's Cloud project, and sidesteps Google's unverified-app warning and 100-test-user cap for your own account(s) once you add yourself as a test user on your own app.
Outlook
No configuration needed — the setup wizard handles everything using built-in OAuth credentials (PKCE):
Note: If you prefer to use your own OAuth app, register one in the Azure Portal with
Mail.ReadWrite,Mail.Send,MailboxSettings.ReadWrite(needed foremail_create_block_rule), andoffline_accesspermissions, then setEMAIL_MCP_OUTLOOK_CLIENT_IDin the environment before running the setup wizard.
iCloud
- Go to appleid.apple.com and sign in.
- Navigate to App-Specific Passwords and generate a new password.
- Run the setup wizard:
Generic IMAP
Run the setup wizard with your IMAP/SMTP server details:
Available Tools (36)
Account Management (4)
Reading & Searching (6)
Sending & Drafts (6)
email_send, email_reply, email_forward, email_draft_create and email_draft_update take an optional attachments list. Each entry is either { path } (a file in the attachments folder, see below) or { content, filename } (base64), with an optional contentType (inferred from the extension otherwise). The total is capped at 25 MB; Outlook accepts up to 3 MB per message through this server. On email_draft_update a list replaces the draft's files, an empty list removes them, and no list keeps the files the draft has.
Gmail adds your signature, like Gmail's own editor. The Gmail API never appends one, so email_send, email_reply, email_forward, email_draft_create and email_draft_update read the signature of the send-as address the mail goes out from (Gmail settings, read on every call, so a changed signature applies at once) and add it in Gmail's own markup (gmail_signature), above any quoted history, plus a plain-text rendering in the text part. A text-only body gains an HTML part for it, as the signature's logo and links only exist as HTML. A body that already holds a signature (a gmail_signature block, or a -- line in text) is left alone, so passing a draft's body back to email_draft_update never stacks a second one. signature: false turns it off for one call. Each of these tools returns a signature field saying what happened: added, already_present, disabled, none_configured, unsupported, or skipped with the reason (for example a missing permission); a failed read never blocks the mail or draft.
Outlook, iCloud and IMAP add no signature. Microsoft Graph has no signature API for Outlook.com accounts (signatures live in the Outlook clients, out of reach for a server), and an IMAP or iCloud server keeps no signature at all. The tools report unsupported there instead of inventing one; put the signature in the body when the mail needs it. A signature stored in email-mcp's own account settings was considered and left out on purpose: it would be a second copy that drifts from the one in the mail client, which is exactly how old mail ends up with an outdated signature.
From names you. The From header carries a display name, not just the address: on Gmail the send-as display name from Gmail's settings, otherwise the account's name in email-mcp (unless that is only a label: a provider name such as "Gmail" or "iCloud", or the address's local part such as "founder"). Gmail often keeps no display name for an account's primary address (its web editor then uses the Google profile name, which this server cannot read); set one under Settings, Accounts, "Send mail as", edit info, and the tools use it. This also holds for a draft sent later from another mail program, which keeps the draft's From. Outlook sets From itself.
Replies stay in their thread: email_reply sends inside the original conversation on Gmail and Outlook (and sets the In-Reply-To and References headers everywhere), email_draft_create with inReplyToEmailId saves a reply draft in that thread, and email_draft_update keeps a reply draft there.
Forwarding the original message's attachments is opt-in. email_forward sends the text of the original; its files go along only with includeOriginalAttachments: true, so one call does not pass files the assistant never looked at on to another address. Forwarded files count against the 25 MB cap together with added ones.
Attaching files by path is off until you name a folder. The path comes from the assistant, and an assistant that reads mail can be asked by a mail to attach something it should not (a private key, for example). So files are only read from the one folder you set in EMAIL_MCP_ATTACHMENTS_DIR, in the environment of the server; no tool can change it. Put the file there and ask for it by name:
A path outside that folder is refused, as is a symbolic link that leads out of it, and email-mcp's own data files are never attachable.
Organization (8)
Batch Operations (4)
All batch tools accept a sourceFolder parameter for IMAP/iCloud and include a sequential fallback for maximum compatibility.
Spam Moderation (5)
Gmail and Outlook only for the rule tools; email_report_spam/email_batch_report_spam work on every provider (iCloud/IMAP fall back to a best-effort move into the account's Junk-typed folder, with no vendor ML training signal since generic IMAP has none to train).
Forwarding Rules (3)
Gmail and Outlook only. iCloud and generic IMAP have no server-side rule mechanism; set the rule in the provider's own settings there.
Forwarding is off until you allow a target. A standing forward rule copies future mail out of your mailbox, and an assistant that reads mail can be asked to create one by the mail it reads. So email_create_forward_rule only accepts addresses you listed yourself in EMAIL_MCP_FORWARD_ALLOWLIST (comma-separated), in the environment of the server. No tool can change that list:
On Gmail the target must also be a forwarding address of the account: add it once under Gmail Settings, "Forwarding and POP/IMAP", "Add a forwarding address", and confirm the email Google sends to it. Outlook needs no such step, which is why the allowlist exists. Outlook accounts authenticated before the block-rule tools existed need to re-run the setup wizard once, as for those tools.
Usage with Claude Code
Add the following to your .mcp.json file (project-level or global ~/.claude/.mcp.json):
Once configured, you can ask Claude to interact with your email:
- "Check my inbox for unread messages"
- "Search for emails from [email protected] in the last week"
- "Reply to the latest email from Bob and thank him"
- "Move all newsletters to the Archive folder"
- "Delete all spam emails" (uses batch operations for speed)
- "Draft a follow-up email to the team about the meeting"
Development
Credential Storage
Account credentials are encrypted at rest with AES-256-GCM in ~/.email-mcp/credentials.enc.
By default the encryption key is derived from a stable, machine-specific identifier
(the hardware UUID on macOS, /etc/machine-id on Linux, or the MachineGuid on
Windows), falling back to the hostname when none is available.
Set the EMAIL_MCP_KEY environment variable to supply your own passphrase instead.
This is recommended when the machine identifier may change (for example in
containers or CI), or when you want to move credentials.enc between machines:
When EMAIL_MCP_KEY is set, existing credential files are transparently
re-encrypted with the passphrase the next time they are read.
The Outlook refresh token lives in the token cache of Microsoft's authentication
library (MSAL), ~/.email-mcp/msal-cache.enc, encrypted with the same scheme and key
derivation as credentials.enc, so EMAIL_MCP_KEY protects both files. Versions before 1.8.0
kept this cache as plain JSON in ~/.email-mcp/msal-cache.json; 1.8.0 encrypts it and
deletes the plain file the first time it reads it, without signing you out. Going back
to an older version afterwards means signing in to Outlook again.
On macOS and Linux, attachments saved with email_save_attachment are written
owner-only (0600), and folders email-mcp creates for them are 0700. They are not
encrypted.
The OAuth sign-in callback started by email-mcp-setup listens on the loopback
addresses only (127.0.0.1, and ::1 when available), so nothing else on your network
can reach it.
Sending to a list?
email-mcp handles your own inbox. To reach a whole list, Lumitra Mail, from the same maker, does newsletters and product mail through your own sending provider, with a visual editor, one-click unsubscribe and contacts on servers in Germany. Free for up to 6,000 messages a month.
Support
email-mcp is free and has no paid tier. Its one fixed cost is the independent security assessment Google requires every year for the shared Gmail sign-in (CASA, Cloud Application Security Assessment): 675 US dollars a year. It is the last open step before Google lets everyone use the one-command Gmail setup. The project is not funded for it yet, so the assessment starts once donations reach that amount; until then Gmail needs your own Google Cloud project (see the note in the Gmail section). Progress is shown at email.lumitra.co.
License
MIT
來源:README.md,提交 3261b81
工具
0版本歷史
1- v1.2.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分