phison-mail-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@phison-mail-mcp Show me my latest 5 emails in the inbox"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Mail MCP 工具
English Version (README-EN.md)
這是什麽
這是一個基於 MCP (Model Context Protocol) 的郵件工具,它能讓 AI 模型通過標準化接口訪問電子郵件服務。
簡單來說,它讓 AI 助手能夠執行各種郵件操作,如發送郵件、閱讀收件箱、處理附件等,無需用戶手動輸入覆雜的API調用或切換到郵件客戶端。
郵件發送:普通文本郵件、HTML郵件、帶附件郵件、群發郵件
郵件接收與查詢:獲取文件夾列表、列出郵件、高級搜索、獲取郵件詳情
郵件管理:標記已讀/未讀、刪除郵件、移動郵件
附件管理:查看附件列表、下載附件、查看附件內容
聯系人管理:獲取聯系人列表、搜索聯系人
以下是 Mail MCP 工具的一些核心特點:
高級搜索功能:支持多文件夾、關鍵詞、日期範圍、發件人、收件人等覆雜條件搜索
智能聯系人管理:自動從郵件歷史中提取聯系人信息,包括聯系頻率分析
內容範圍控制:可以分段查看大型郵件,避免加載過多內容
多種郵件格式:支持純文本和HTML格式郵件的發送和顯示
附件處理能力:智能識別附件類型,支持文本、圖片等不同類型的附件預覽
安全可靠:本地處理所有郵件操作,不通過第三方服務器轉發敏感信息
通過簡單的自然語言指令,AI 可以幫助你完成上述所有操作,無需手動編寫API調用或在郵件客戶端中執行覆雜操作。
Related MCP server: mcp-imap
快速上手
0. 環境準備
安裝 Node.js 和 npm
訪問 Node.js 官網
下載並安裝 LTS(長期支持)版本
安裝時選擇默認選項即可,安裝包會同時安裝 Node.js 和 npm
驗證安裝
安裝完成後,打開命令提示符(CMD)或 PowerShell
輸入以下命令確認安裝成功:
node --version npm --version如果顯示版本號,則表示安裝成功
1. 構建項目
npm install
npm run build2. 啟動服務
1. SSE
node dist/sse-server.js --port 22102 --host localhost
2. Stdio
{
"mcpServers": {
"phison-mail-mcp": {
"command": "node",
"args": [
"dist/index.js"
],
"env": {
"SMTP_HOST": "mail.phison.com",
"SMTP_PORT": "25",
"SMTP_SECURE": "false",
"SMTP_USER": "example@phison.com",
"SMTP_PASS": "example",
"SMTP_ALLOW_UNAUTHORIZED_CERT": "false",
"IMAP_HOST": "mail.phison.com",
"IMAP_PORT": "993",
"IMAP_SECURE": "true",
"IMAP_USER": "example@phison.com",
"IMAP_PASS": "example",
"DEFAULT_FROM_NAME": "example",
"DEFAULT_FROM_EMAIL": "example@phison.com"
}
}
}
}
配置好郵件服務器信息後,就可以開始使用了。
你可以要求 AI 執行以下操作:
"列出我的郵箱文件夾"
"顯示收件箱中的最新5封郵件"
"發送一封主題為'測試郵件'的郵件給example@example.com"
"測試SMTP連接"(新增功能,可測試郵件服務器連接狀態)
"搜索包含'發票'關鍵詞的郵件"
"查看UID為1234的郵件詳情"
"下載郵件中的附件"
工作原理
本工具基於 MCP (Model Context Protocol) 標準實現,作為 AI 模型與電子郵件服務之間的橋梁。它使用 nodemailer 和 node-imap 作為底層郵件客戶端,並通過 Zod 進行請求驗證和類型檢查。
主要技術組件包括:
SMTP 客戶端:負責所有郵件發送功能,支持HTML內容和附件,特別支持端口25的非TLS/SSL連接
IMAP 客戶端:負責連接郵箱服務器,獲取郵件列表、詳情和附件
郵件解析器:使用 mailparser 解析覆雜的電子郵件格式
內容處理:智能處理HTML和純文本內容,並支持分段加載大型郵件
聯系人提取:從郵件歷史中自動提取和整理聯系人信息
連接測試:內置SMTP連接測試功能,可驗證郵件服務器配置
每個郵件操作都被封裝為標準化的 MCP 工具,接收結構化參數並返回格式化結果。所有數據都經過處理,以確保以人類可讀的格式呈現,使 AI 模型能夠輕松理解電子郵件的內容結構。
由 kino_lian 開發維護
Available Tools
18 toolsdeleteEmailA
Delete a specific email from a folder using its UID. Permanently removes the email from the mail server.
Inputs: uid (required), folder.
getAttachmentC
Download and view email attachments by email UID and attachment index. Supports various attachment types with content preview capabilities.
Inputs: uid (required), attachmentIndex (required), folder, saveToFile.
getContactsC
Extract contact information from email history with frequency analysis. Searches through email addresses and provides contact usage statistics.
Inputs: maxResults, searchTerm.
getEmailDetailB
Get detailed information about a specific email including full content, headers, attachments list. Supports content range limiting for large emails.
Inputs: uid (required), folder, contentRange.
listEmailsB
List emails from a specific folder with pagination and read status filtering. Returns email summaries including subject, sender, date, and read status.
Inputs: to, from, limit, folder, +5 more.
listFoldersB
List all available email folders/mailboxes in the email account. Returns folder names and hierarchy for navigation.
Inputs: random_string.
markAsReadC
Mark a specific email as read using its UID. Updates the read status flag on the email server.
Inputs: uid (required), folder.
markAsUnreadC
Mark a specific email as unread using its UID. Updates the unread status flag on the email server.
Inputs: uid (required), folder.
markMultipleAsReadC
Mark multiple emails as read using their UIDs. Batch operation for efficiently updating read status of several emails at once.
Inputs: uids (required), folder.
markMultipleAsUnreadC
Mark multiple emails as unread using their UIDs. Batch operation for efficiently updating unread status of several emails at once.
Inputs: uids (required), folder.
moveEmailC
Move an email from one folder to another using its UID. Useful for organizing emails into different mailbox folders.
Inputs: uid (required), sourceFolder (required), targetFolder (required).
searchEmailsC
Search for emails across multiple folders using keywords, date ranges, sender/recipient filters. Provides comprehensive email search capabilities.
Inputs: to, from, endDate, folders, +6 more.
sendBulkMailB
Send bulk emails to multiple recipients with automatic batching and rate limiting. Supports text, HTML content, and attachments. Processes recipients in batches to avoid server limits.
Inputs: to (required), subject (required), cc, bcc, +3 more.
sendHtmlMailC
Send an HTML-formatted email to a single recipient with support for CC, BCC, and file attachments. Ideal for rich content emails.
Inputs: to (required), html (required), subject (required), cc, +2 more.
sendMailC
Send emails to one or more recipients with support for CC, BCC, text/HTML content, and file attachments. Provides comprehensive email sending functionality.
Inputs: to (required), subject (required), cc, bcc, +4 more.
sendSimpleMailB
Send a simple text email to a single recipient. A simplified version of sendMail for quick, basic email sending.
Inputs: to (required), body (required), subject (required).
testSmtpConnectionA
Test the SMTP server connection and authentication. Validates email server configuration and provides troubleshooting information.
Inputs: no named parameters.
waitForReplyC
Wait for new email replies in a specific folder for a specified timeout period. Monitors for incoming emails and returns them when detected.
Inputs: folder, timeout.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
The four send tools (sendMail, sendSimpleMail, sendHtmlMail, sendBulkMail) overlap heavily, with sendSimpleMail and sendHtmlMail being functional subsets of sendMail, so an agent may struggle to pick the right one. The remaining tools (list/search/get/delete/move/mark/attachment/folder) are otherwise clearly distinct.
All 18 tools use consistent camelCase verb_noun naming (sendMail, listEmails, getEmailDetail, deleteEmail, markAsRead, testSmtpConnection). Verb styles (send/list/get/delete/move/mark/test) are predictable and the Email/Emails variation is trivial.
18 tools is on the heavy side for an email server, and the count is partly inflated by four redundant send variants. Still, most tools map to genuine, distinct email operations, so it stays reasonable rather than bloated.
Coverage is broad: send, list, search, detail, delete, move, attachments, folders, read/unread marking, contacts, reply waiting, and SMTP testing. Minor gaps remain (folder creation/deletion, draft management, explicit reply/forward), but core workflows are covered.
Maintenance
Related MCP Connectors
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to read, search, compose, and send emails by connecting to any IMAP/SMTP provider. It supports comprehensive mailbox management, including draft handling and message deletion, directly through natural language.10239 npm11MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with email accounts via IMAP and SMTP, supporting mailbox listing, email search, retrieval, sending, and management.MIT
- AlicenseBqualityDmaintenanceEnables AI assistants to send, read, and manage emails via SMTP and IMAP, with support for attachments, threads, and mailbox organization.1652 npm1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to read, send, organize, and search emails across multiple IMAP/SMTP mailboxes.756 npmMIT