michaelguo1991/email-mcp-server-nodejs
3.2
If you are the rightful owner of email-mcp-server-nodejs 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 NodeJS-based server that simulates email sending using the Model Context Protocol (MCP).
Tools
1
Resources
0
Prompts
0
Email MCP Server (NodeJS)
一个基于 NodeJS 的 Model Context Protocol (MCP) 服务器,提供邮件发送功能(模拟发送)。
功能特性
- 邮件发送工具: 提供模拟邮件发送功能,支持自定义发件人、收件人、主题和正文
- 服务器信息资源: 展示服务器的基本信息和功能特性
- 邮件撰写提示模板: 用于辅助邮件内容撰写的提示模板
- 发送状态跟踪: 提供邮件发送状态和时间戳记录
- 安全模拟: 不会真实发送邮件,仅用于演示和测试
安装
从 npm 安装(推荐)
npm install -g @michaelguo91/email-mcp-server-nodejs
从源码安装
- 克隆或下载项目到本地
- 安装依赖:
npm install
构建
npm run build
运行
开发模式
npm run dev
生产模式
npm start
监听模式(自动重新编译)
npm run watch
使用方法
这个 MCP 服务器通过 stdio 传输层与客户端通信。它提供以下功能:
工具 (Tools)
send_email
发送邮件(模拟发送)。
参数:
to
(string): 收件人邮箱地址subject
(string): 邮件主题body
(string): 邮件正文内容from
(string, 可选): 发件人邮箱地址(默认为 system@example.com)config
(string): 配置信息
示例:
{
"name": "send_email",
"arguments": {
"to": "user@example.com",
"subject": "测试邮件",
"body": "这是一封测试邮件的内容。",
"from": "sender@example.com",
"config": "配置信息"
}
}
返回:
{
"content": [
{
"type": "text",
"text": "📧 邮件发送成功!\n\n邮件ID: email_1234567890_abc123\n发送时间: 2024-01-01T12:00:00.000Z\n发件人: sender@example.com\n收件人: user@example.com\n主题: 测试邮件\n正文长度: 15 字符\n\n状态: ✅ 已发送(模拟)\n\n注意:这是模拟发送,邮件并未真实发送到目标邮箱。"
}
]
}
资源 (Resources)
server-info
获取服务器的基本信息和功能特性。
URI: info://server
提示 (Prompts)
compose_email
用于邮件撰写的提示模板。
参数:
recipient
(string): 收件人邮箱地址purpose
(string): 邮件目的或类型tone
(string, 可选): 邮件语调(正式/非正式/友好等)
与 MCP 客户端集成
全局安装后使用
如果你全局安装了这个包,可以直接使用命令:
{
"mcpServers": {
"email-server": {
"command": "email-mcp-server"
}
}
}
本地安装使用
要在 MCP 客户端中使用此服务器,请将以下配置添加到客户端的配置文件中:
{
"mcpServers": {
"email-server": {
"command": "node",
"args": ["path/to/email-mcp-server-nodejs/dist/index.js"]
}
}
}
使用 npx(无需安装)
{
"mcpServers": {
"email-server": {
"command": "npx",
"args": ["@michaelguo91/email-mcp-server-nodejs"]
}
}
}
测试
你可以使用 MCP Inspector 来测试这个服务器:
npx @modelcontextprotocol/inspector node dist/index.js
或者使用项目自带的测试客户端:
npm test
项目结构
email-mcp-server-nodejs/
├── src/
│ └── index.ts # 主服务器文件
├── scripts/
│ └── publish.sh # 发布脚本
├── dist/ # 编译后的 JavaScript 文件
├── package.json # 项目配置和依赖
├── tsconfig.json # TypeScript 配置
├── test-client.js # 测试客户端
└── README.md # 项目说明
技术栈
- NodeJS: JavaScript 运行时
- TypeScript: 类型安全的 JavaScript
- MCP SDK: Model Context Protocol TypeScript SDK
- Zod: 运行时类型验证
安全说明
⚠️ 重要提醒: 这是一个模拟邮件发送服务器,不会真实发送邮件。所有的邮件发送操作都是模拟的,仅用于演示和测试目的。
如果需要真实的邮件发送功能,请:
- 集成真实的邮件服务提供商(如 SendGrid、AWS SES、Nodemailer 等)
- 添加适当的身份验证和授权机制
- 实施邮件发送限制和监控
许可证
MIT License
贡献
欢迎提交 Issue 和 Pull Request!
扩展功能
你可以轻松扩展这个服务器来添加更多邮件功能:
- 真实邮件发送集成
- 邮件模板系统
- 批量邮件发送
- 邮件发送历史记录
- 邮件附件支持
- HTML 邮件格式支持
只需在 src/index.ts
中添加新的工具定义即可。