Back to MCP directory
publicPublicdnsLocal runtime

Email Sender

MCP邮件服务器是一个为LLM提供电子邮件功能的协议服务,支持发送邮件和附件搜索。

article

README

🚀 MCP 邮件服务器

MCP 邮件服务器基于模型上下文协议(Model Context Protocol),为大型语言模型(LLM)赋能,使其具备编写、发送电子邮件的能力,还能在指定目录中搜索附件,极大拓展了语言模型的应用场景。

1742711978001

1742712768132

🚀 快速开始

安装

使用 pip

安装所需的依赖项:

pip install pydantic python-dotenv

邮件配置

包含 SMTP 服务器配置的 email.json 文件:

[
  {
    "domain": "@gmail.com",
    "server": "smtp.gmail.com", 
    "port": 587
  },
  {
    "domain": "@outlook.com",
    "server": "smtp.office365.com",
    "port": 587
  },
  {
    "domain": "@yahoo.com",
    "server": "smtp.mail.yahoo.com",
    "port": 587
  }
]

启动服务器

在终端中运行以下命令启动 MCP Email Server:

python server.py

✨ 主要特性

  • 支持多个收件人的邮件发送
  • 支持电子邮件附件
  • 在指定目录中根据模式匹配搜索文件
  • 使用 SMTP 进行安全的电子邮件传输

可用工具

  • send_email - 根据提供的主题、正文和接收者发送电子邮件。

    • receiver (字符串数组,必需):收件人电子邮箱地址列表
    • body (字符串,必需):邮件的主要内容
    • subject (字符串,必需):邮件的主题行
    • attachments (字符串或字符串数组,可选):电子邮件附件(文件名)
  • search_attachments - 在指定目录中搜索与给定模式匹配的文件。

    • pattern (字符串,必需):在文件名中搜索的文字模式

提示词

  • send_email

    • 发送带有可选附件的邮件
    • 参数:
      • receiver (必需):收件人电子邮箱地址列表
      • body (必需):邮件的主要内容
      • subject (必需):邮件的主题行
      • attachments (可选):电子邮件附件
  • search_attachments

    • 搜索与模式匹配的文件
    • 参数:
      • pattern (必需):在文件名中搜索的文字模式

💻 使用示例

发送邮件示例

要发送包含附件的邮件,请使用以下 JSON 格式请求:

{
  "receiver": "收件人电子邮箱",
  "subject": "邮件主题",
  "body": "邮件正文内容",
  "attachments": ["attachment1.pdf", "attachment2.jpg"]
}

搜索附件示例

要搜索与特定模式匹配的附件,请使用以下 JSON 格式请求:

{
  "pattern": "search_pattern"
}

🤝 贡献

我们欢迎任何贡献,以帮助扩展和改进 MCP 邮件服务器。无论您想添加新功能、增强现有功能还是改进文档,您的输入都很宝贵。

有关其他 MCP 服务器和实现模式的示例,请参见: https://github.com/modelcontextprotocol/servers

Pull Request 欢迎!请随时为 MCP 邮件服务器贡献新的想法、错误修复或增强,使其更加强大和有用。

📄 许可证

MCP 邮件服务器采用 MIT 许可证。这意味着您可以自由使用、修改和分发软件,但需遵守 MIT 许可证的条款和条件。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client