wycCome/email-mcp-server
3.2
If you are the rightful owner of email-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Email MCP Server is a Model Context Protocol-based email server that enables large language models to send emails and manage attachments.
Tools
2
Resources
0
Prompts
0
Email MCP Server
基于 Model Context Protocol (MCP) 的电子邮件服务器,使大型语言模型能够发送电子邮件并管理附件。
功能特性
- ✉️ 支持多收件人邮件发送
- 📎 支持邮件附件功能
- 🔍 基于模式匹配的目录文件搜索
- 🔒 使用 SMTP 的安全邮件传输
- 📁 支持多种文件类型的附件
支持的附件类型
- 文档:doc, docx, xls, xlsx, ppt, pptx, pdf
- 压缩包:zip, rar, 7z, tar, gz
- 文本文件:txt, log, csv, json, xml, html
- 图片:jpg, jpeg, png, gif, bmp
- 其他:md
安装
- 克隆项目并安装依赖:
git clone <repository-url>
cd email-mcp-server
npm install
- 配置环境变量:
创建 .env
文件并添加以下配置:
SMTP_USER=your-email@163.com
SMTP_PASS=your-password
构建和运行
构建项目:
npm run build
启动服务器:
npm start
MCP 工具说明
1. send_email
发送电子邮件,支持附件。
参数:
receiver
(必填):收件人邮箱地址数组body
(必填):邮件正文内容subject
(必填):邮件主题行attachments
(可选):邮件附件文件路径(字符串或字符串数组)
示例:
{
"receiver": ["example@qq.com"],
"subject": "测试邮件",
"body": "这是一封测试邮件",
"attachments": ["path/to/file.pdf"]
}
2. search_attachments
在指定目录中搜索匹配给定模式的文件。
参数:
pattern
(必填):用于匹配文件名的文本模式
示例:
{
"pattern": "report"
}
项目结构
email-mcp-server/
├── src/
│ ├── assets/ # 资源文件
│ ├── config/ # 配置文件
│ │ └── types.ts # 类型定义
│ ├── services/ # 服务实现
│ │ └── email-service.ts # 邮件服务实现
│ ├── index.ts # 服务器入口
│ └── test-email.ts # 邮件发送测试
├── .env # 环境变量配置
├── package.json # 项目配置
├── tsconfig.json # TypeScript 配置
└── start.ps1 # 启动脚本
开发
- 修改配置:
在 src/config/types.ts
中定义了所有支持的文件类型和配置接口。
- 扩展功能:
主要的业务逻辑在 src/services/email-service.ts
中实现。
- 测试:
使用 src/test-email.ts
进行功能测试。
SMTP 服务器配置
默认使用 163 邮箱的 SMTP 服务器:
{
"server": "smtp.163.com",
"port": 465,
"provider": "163邮箱",
"instruction": "默认开启SMTP服务",
"domain": "@163.com"
}
注意事项
-
安全性:
- 不要将 .env 文件提交到版本控制系统
- 确保 SMTP 密码安全存储
-
性能:
- 大文件附件可能需要较长处理时间
- 建议限制附件大小
-
限制:
- 受 SMTP 服务器限制,可能有发送频率限制
- 附件大小可能受邮件服务器限制
调试
如果遇到问题,可以检查:
- 环境变量是否正确设置
- SMTP 服务器配置是否正确
- 网络连接是否正常
- 文件权限是否适当
贡献指南
欢迎提交 Pull Request 或提出 Issue。
许可证
ISC License
版本历史
- 1.0.0
- 初始版本
- 支持基本的邮件发送功能
- 支持文件附件
- 实现 MCP 协议接口