邮件发送服务

基于Rust的MCP服务器,通过LLM聊天界面简化邮件发送过程。

  • by AlvinHon
  • Rust
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 AlvinHon/rmcp-mailer

使用说明

MCP个人邮件服务器

防锈MCP的示例项目(模型上下文协议)个人邮件服务器。它使用户能够发送电子邮件,只需向Cursor和Copilot等LLM聊天界面发出提示即可。

这是通过使用官方 锈sdk MCP(正在积极开发中)。 它主要使用板条箱 信 作为引擎盖下的SMTP客户端。

用法

本节描述了一些用例,以表明MCP服务器比传统的电子邮件程序更有趣。

传统的电子邮件程序要求用户知道如何向程序输入数据才能工作(例如发送电子邮件)。在这里,我们可以使用简单的单词,LLM将帮助我们创建输入数据,以便将其拟合到“程序”中。

示例1:

send an formal email to Bob (bob@domain.com). invite him to my friend Chris's wedding. closing with my name "Alvin"
Sample Output

LLM

Email sent successfully!

SMTP:

From: test@test.com
Subject: Invitation to Chris's Wedding
Content-Type: text/plain; charset=utf-8
To: bob@domain.com
Content-Transfer-Encoding: quoted-printable
Date: Sun, 18 May 2025 12:59:33 +0000
X-Peer: ('127.0.0.1', 58769)

Dear Bob,

I hope this message finds you well. I am writing to formally invite you to =
my friend Chris's wedding. It would be a pleasure to have you join us for t=
his special occasion.

Please let me know if you are able to attend.

Best regards,
Alvin

示例2:

add a email template named "greeting". It is a greeting to a new customer.
Sample Output

LLM

Email template created successfully!

模板:

Hello {customer_name},

Welcome to our service! We are excited to have you as a new customer.

Best regards,
The Team
send greeting email to customer "abc"
Sample Output

LLM

Email sent with template successfully!

SMTP:

From: test@test.com
Subject: Welcome to our service!
Content-Type: text/plain; charset=utf-8
To: abc@abc.com
Content-Transfer-Encoding: 7bit
Date: Sun, 18 May 2025 12:28:52 +0000
X-Peer: ('127.0.0.1', 58333)

Hello abc,

Welcome to our service! We are excited to have you as a new customer.

Best regards,
The Team

本地测试运行

本节介绍如何在本地运行MCP服务器以进行测试。

先决条件:

  • python模块 aiosmtpd 作为SMTP服务器
  • visual studio代码,使用github copilot作为LLM聊天界面和MCP客户端

请按照以下步骤操作:

  1. 运行SMTP服务器。
    python -m aiosmtpd -n -l 127.0.0.1:2525
    
  2. 跟随这个 指南 在VSCode中设置MCP代理。
  3. 单击文件中的“开始”按钮启动MCP代理 mcp.json 在VSCode中。
  4. 运行MCP服务器:
    cargo run
    

最后,尝试在聊天界面中键入提示,例如“发送电子邮件至you@domain.com主题为“测试”,身体为“你好世界”。