官方邮戳MCP服务器](https://www.npmjs.com/package/@activecampaign/postmark-mcp) 
使用Claude和其他兼容MCP的AI助手使用Postmark发送电子邮件。
特性
- 暴露一个模型上下文协议(MCP)服务器,用于通过您的 邮戳帐户
- 通过环境变量进行简单配置
- 全面的错误处理和优雅的关机
- 安全的日志记录实践(无敏感数据泄露)
- 自动电子邮件跟踪配置
有用的文档
反馈
我们很乐意收到您的来信!请使用我们的 反馈表.
在X上关注我们- @邮戳
______________________________________________________________________
设置
需求
- Node.js(建议使用v16或更高版本)
- A. 邮戳帐户 服务器令牌
安装(本地开发)
克隆存储库:
git clone https://github.com/ActiveCampaign/postmark-mcp
cd postmark-mcp安装依赖项:
npm install
# or
yarn
# or
bun install配置(本地开发)
根据示例创建自己的环境文件
cp .env.example .env编辑您的 .env 包含您的邮戳凭据和设置。
重要提示: 这仅用于当地发展目的。秘密永远不应该存储在版本控制中 .env 类型文件应添加到 .gitignore.
| 变量 | 描述 | 必填 |
|---|---|---|
| POSTMAR_SERVER_TOKEN | 您的POSTMARK服务器API令牌 | 是 |
| DEFAULT_SENDER_EMAIL | 默认发件人电子邮件地址 | 是 |
| DEFAULT_MESSAGE_STREAM | 邮戳消息流(例如“出站”) | 是 |
运行服务器:
npm start
# or
yarn start
# or
bun start光标快速安装
安装MCP后,更新配置以设置:
POSTMARK_SERVER_TOKENDEFAULT_SENDER_EMAILDEFAULT_MESSAGE_STREAM(默认值:outbound)
Claude和Cursor MCP配置示例
{
"mcpServers": {
"postmark": {
"command": "node",
"args": ["path/to/postmark-mcp/index.js"],
"env": {
"POSTMARK_SERVER_TOKEN": "your-postmark-server-token",
"DEFAULT_SENDER_EMAIL": "your-sender-email@example.com",
"DEFAULT_MESSAGE_STREAM": "your-message-stream"
}
}
}
}工具
本节提供了Postmark MCP服务器工具的完整参考,包括示例提示和有效载荷。
目录
- send电子邮件 - sendEmailWithTemplate
- 列表模板
- 获取交货状态
电子邮件管理工具
1.发送电子邮件
发送一封短信电子邮件。
示例提示:
Send an email using Postmark to recipient@example.com with the subject "Meeting Reminder" and the message "Don't forget our team meeting tomorrow at 2 PM. Please bring your quarterly statistics report (and maybe some snacks).""预期有效载荷:
{
"to": "recipient@example.com",
"subject": "Meeting Reminder",
"textBody": "Don't forget our team meeting tomorrow at 2 PM. Please bring your quarterly statistics report (and maybe some snacks).",
"htmlBody": "HTML version of the email body", // Optional
"from": "sender@example.com", // Optional, uses DEFAULT_SENDER_EMAIL if not provided
"tag": "meetings" // Optional
}响应格式:
Email sent successfully!
MessageID: message-id-here
To: recipient@example.com
Subject: Meeting Reminder2.使用模板发送电子邮件
使用预定义的模板发送电子邮件。
示例提示:
Send an email with Postmark template alias "welcome" to customer@example.com with the following template variables:
{
"name": "John Doe",
"product_name": "MyApp",
"login_url": "https://myapp.com/login"
}预期有效载荷:
{
"to": "customer@example.com",
"templateId": 12345, // Either templateId or templateAlias must be provided, but not both
"templateAlias": "welcome", // Either templateId or templateAlias must be provided, but not both
"templateModel": {
"name": "John Doe",
"product_name": "MyApp",
"login_url": "https://myapp.com/login"
},
"from": "sender@example.com", // Optional, uses DEFAULT_SENDER_EMAIL if not provided
"tag": "onboarding" // Optional
}响应格式:
Template email sent successfully!
MessageID: message-id-here
To: recipient@example.com
Template: template-id-or-alias-here模板管理工具
3.列表模板
列出所有可用模板。
示例提示:
Show me a list of all the email templates available in our Postmark account.响应格式:
📋 Found 2 templates:
• Basic
- ID: 12345678
- Alias: basic
- Subject: none
• Welcome
- ID: 02345679
- Alias: welcome
- Subject: none统计和跟踪工具
4.获取交货状态
检索电子邮件传递统计信息。
示例提示:
Show me our Postmark email delivery statistics from 2025-05-01 to 2025-05-15 for the "marketing" tag.预期有效载荷:
{
"tag": "marketing", // Optional
"fromDate": "2025-05-01", // Optional, YYYY-MM-DD format
"toDate": "2025-05-15" // Optional, YYYY-MM-DD format
}响应格式:
Email Statistics Summary
Sent: 100 emails
Open Rate: 45.5% (45/99 tracked emails)
Click Rate: 15.2% (15/99 tracked links)
Period: 2025-05-01 to 2025-05-15
Tag: marketing实现细节
自动配置
所有电子邮件都会自动配置为:
TrackOpens: trueTrackLinks: "HtmlAndText"- 来自的消息流
DEFAULT_MESSAGE_STREAM环境变量
错误处理
服务器实现了全面的错误处理:
- 验证所有必需的环境变量
- SIGTERM和SIGINT的优雅关闭
- API调用的正确错误处理
- 日志中不暴露敏感信息
- 一致的错误消息格式
日志记录
- 使用适当的日志级别(
info对于正常操作,error错误) - 从日志中排除敏感信息
- 提供清晰的操作状态和结果
______________________________________________________________________
*有关API邮政标志的更多信息,请访问 Postmark的开发者文档.*
许可证
麻省理工学院 ©ActiveCampaign
