Email Smtp Imap Mcp

io.github.samihalawa由 GitHub 帳號 samihalawa 發布v2.2.2更新於 Nov 1, 2026

Multi-account SMTP/IMAP email tools: search, read, send, reply, forward, flags and folders.

已驗證STDIO僅桌面效率與工作流溝通與協作

概覽

AI 產生的概覽

本機 MCP 伺服器,透過 SMTP/IMAP 讓助理在多個信箱帳號中搜尋、讀取、寄送、回覆、轉寄與整理郵件。

可以做什麼
  • 列出已設定的帳號與預設帳號,並列出資料夾及可選的總數與未讀數
  • 依文字、寄件者、收件者、主旨、日期、已讀或標記狀態、附件搜尋收件匣郵件,可選擇回傳內文與附件
  • 寄送純文字或 HTML 郵件,支援副本、密件副本、寄件者別名與 base64 附件
  • 依郵件 UID 回覆、全部回覆或轉寄,保留討論串並可附上原附件
  • 將郵件標為已讀或未讀、加上或取消標記,並在資料夾之間移動郵件
適用情境
適合想讓助理直接操作真實信箱的情況:整理收件匣、找出特定郵件、撰寫並寄出回覆,或用同一個伺服器處理多個工作與個人帳號。
執行需求
透過 npx 以 stdio 在本機執行(需要 Node.js)。需為每個帳號提供 SMTP 與 IMAP 的主機、連接埠、TLS 與憑證,可透過 EMAIL_ACCOUNTS_JSON 密鑰或單一帳號的 SMTP_/IMAP_ 變數提供,也可放在由 EMAIL_ENV_FILE 指向的 .env 檔案中。DEFAULT_EMAIL_ACCOUNT 為選用。需要能連線郵件伺服器的網路,並要求 TLS 1.2 以上。
安裝前請注意
EMAIL_ACCOUNTS_JSON 以明文保存各帳號的郵件密碼或應用程式專用密碼,應私下保存且不要提交到版本庫。此伺服器可寄送、回覆、轉寄、移動、加標記與標為已讀,會變更真實信箱並可能寄給他人,讓助理執行前應先確認。郵件內文與附件會進入助理的上下文,且郵件伺服器必須支援具有效憑證的 TLS。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Email Smtp Imap Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[One MCP server connecting multiple email accounts]

Email SMTP/IMAP MCP

One local MCP server for every inbox: search, read, send, reply, forward, and organize email across multiple accounts.

[release] [npm] [downloads] [CI] [OpenSSF Best Practices] [OpenSSF Baseline] [Node.js] [stars] [license]

Why this server

For third-party notices, licence enquiries and the version 2.2.2 supplement, see the open source licence compliance programme.

  • No account-count cap — add work, personal, support, or client inboxes and switch with account_name.
  • SMTP + IMAP together — send and receive through one small MCP server.
  • Complete everyday workflow — search, read, reply, forward, attach files, flag, archive, move, and list folders.
  • Provider-agnostic — works with Gmail, iCloud Mail, Fastmail, Outlook, self-hosted mail, and other standard SMTP/IMAP providers.
  • Local stdio transport — no hosted relay and no separate control panel.

[Search, send, respond, organize, and browse folders across accounts]

Quick start

1. Create your .env

Copy .env.example to a private location and add as many named accounts as you need:

dotenv
EMAIL_ACCOUNTS_JSON='{  "work": {    "smtp": {      "host": "smtp.gmail.com",      "port": 587,      "secure": false,      "user": "[email protected]",      "password": "app-password"    },    "imap": {      "host": "imap.gmail.com",      "port": 993,      "secure": true,      "user": "[email protected]",      "password": "app-password"    },    "default_from_name": "Your Name",    "sender_emails": ["[email protected]", "[email protected]"]  },  "personal": {    "smtp": {      "host": "smtp.mail.me.com",      "port": 587,      "secure": false,      "user": "[email protected]",      "password": "app-password"    },    "imap": {      "host": "imap.mail.me.com",      "port": 993,      "secure": true,      "user": "[email protected]",      "password": "app-password"    }  }}'
DEFAULT_EMAIL_ACCOUNT="work"

The server loads .env from its working directory automatically. EMAIL_ENV_FILE lets an MCP client use an .env stored anywhere.

2. Add the MCP server

For Claude Desktop, edit:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{  "mcpServers": {    "email": {      "command": "npx",      "args": ["-y", "email-smtp-imap-mcp"],      "env": {        "EMAIL_ENV_FILE": "/absolute/path/to/your/.env"      }    }  }}

Use an absolute path, restart your MCP client, then ask: “List my configured email accounts.”

Pass account JSON directly from the MCP client

You can skip the .env file and set EMAIL_ACCOUNTS_JSON plus DEFAULT_EMAIL_ACCOUNT directly in the MCP client’s env object. The JSON must be escaped into a single string.

json
{  "env": {    "EMAIL_ACCOUNTS_JSON": "{\"work\":{\"smtp\":{\"host\":\"smtp.gmail.com\",\"port\":587,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.gmail.com\",\"port\":993,\"user\":\"[email protected]\",\"password\":\"app-password\"}}}",    "DEFAULT_EMAIL_ACCOUNT": "work"  }}
Single-account `.env` variables

Use SMTP_HOST, SMTP_PORT, SMTP_SECURE, SMTP_USER, SMTP_PASS, IMAP_HOST, IMAP_PORT, IMAP_SECURE, IMAP_USER, and IMAP_PASS instead of EMAIL_ACCOUNTS_JSON.

SMTP_USERNAME/SMTP_PASSWORD and IMAP_USERNAME/IMAP_PASSWORD are accepted aliases. IMAP credentials default to the SMTP credentials when omitted. Use SENDER_EMAILS as a comma-separated allowlist for optional from_email selection.

Tools

See the tool reference for every input, default, response field and error format.

ToolWhat it does
accounts_listList every configured account and identify the default without exposing credentials.
emails_findSearch by text, sender, recipient, subject, date, read state, flag state, or attachments. Optionally return bodies and attachments.
email_sendSend plain-text or HTML email with CC, BCC, sender aliases, and base64 attachments.
email_respondReply, reply-all, or forward by email UID with threading and optional original attachments.
emails_modifyMark read/unread, flag/unflag, or move messages to another folder.
folders_listList folders with optional total and unread counts.

All tools except accounts_list accept an optional account_name. Without it, the server uses DEFAULT_EMAIL_ACCOUNT or the first configured account. There is no application-level account-count limit.

Verify your setup

After restarting the MCP client, try these in order:

  1. “List my configured email accounts.”
  2. “List folders for my work account.”
  3. “Find the five newest unread emails in my personal account.”
  4. “Send a plain-text email from my work account.”

Provider settings

ProviderSMTPIMAPCredential
Gmailsmtp.gmail.com:587imap.gmail.com:993App password
iCloud Mailsmtp.mail.me.com:587imap.mail.me.com:993App-specific password
Other providersUse the provider's SMTP hostUse the provider's IMAP hostProvider password or app password

Use secure: true for implicit TLS ports such as 465/993. Port 587 normally uses secure: false and upgrades with STARTTLS. Both SMTP and IMAP require TLS 1.2 or newer and a valid server certificate. With secure: false, STARTTLS is mandatory before authentication; servers without STARTTLS are rejected. Plaintext-only relays are not supported.

Development

bash
git clone https://github.com/samihalawa/email-smtp-imap-mcp.gitcd email-smtp-imap-mcpnpm cinpm test

Run the compiled stdio server with npm start. Build a production container with docker build -t email-smtp-imap-mcp ..

Contributing

Issues and focused pull requests are welcome. See CONTRIBUTING.md for the development workflow and SECURITY.md for vulnerability reports.

License

MIT © Sami Halawa

Security and release assurance

Report vulnerabilities through the private route in SECURITY.md. The security assurance programme and source-bound review describe the controls, evidence and publication boundaries for this project. They do not claim an external ISO certificate or completed OpenChain conformance.

Maintainers can run npm run assurance to build the package, run security checks, archive pinned component inputs and verify an offline recovery. The generated release assets include platform-specific build inputs and are intended for durable release retention.

來源:README.md,提交 dc32584

工具

6

accounts_list

List every configured email account and show which account is the default. Use this before other tools when multiple SMTP/IMAP accounts are configured.

無需輸入參數。

emails_find

Search for emails in your inbox with flexible filters. Optionally get full email content and attachments. Use this to find specific emails, check for unread messages, or browse your inbox.

輸入參數limitqueryfiltersaccount_nameinclude_contentinclude_attachments

emails_modify

Change email states like read/unread, flagged, or move between folders. Use this to organize your inbox, mark emails as read, archive messages, or flag important emails.

輸入參數flagunflagemail_ids必填mark_readmark_unreadaccount_namemove_to_folder

email_send

Send a new email with HTML support and file attachments. Use this to send messages, project updates, or any new email conversation.

輸入參數ccto必填bccbody必填subject必填body_typefrom_emailattachmentsaccount_name

email_respond

Reply to or forward an existing email. Use this to continue email conversations, respond to messages, or forward information to others.

輸入參數tobody必填email_id必填body_typeaccount_nameresponse_typeinclude_originalinclude_attachmentsadditional_attachments

folders_list

List all available email folders/labels in your account. Use this to see your folder structure and organize emails.

輸入參數account_nameinclude_counts

版本歷史

1
  1. v2.2.2最新Nov 1, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分