MCP Server for Personal Mailer について
MCP Server for Personal Mailerは、LLMチャットインターフェースのプロンプトからメールを送るRust製のサンプルサーバーです。SMTPクライアントにlettreを使用し、メールテンプレートの作成と利用も示します。
主な機能
- 01チャットのプロンプトからメールを送信
- 02メールテンプレートの作成と利用
- 03SMTPクライアント経由の送信
- 04Rust MCP SDKを使用
活用シーン
- 01招待メールの作成と送信
- 02再利用可能な顧客向け挨拶文の作成
- 03保存済みテンプレートを使ったメール送信
MCP 対応
メール送信とテンプレート操作をツールとしてMCPクライアントに公開し、LLMチャットから自然言語の依頼をメール操作に変換できます。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
パーソナルメーラー用 MCP サーバー
パーソナルメーラー向けの、Rust ベースの MCP(Model Context Protocol)サーバーのサンプルプロジェクトです。Cursor や Copilot などの LLM チャットインターフェースでプロンプトを入力するだけで、ユーザーがメールを送信できます。
MCP の公式 Rust SDK(活発に開発中)を使用して実装されています。 内部では主に、SMTP クライアントとしてクレート lettre を使用しています。
使い方
このセクションでは、MCP サーバーが従来のメールプログラムよりも便利であることを示すユースケースをいくつか紹介します。
従来のメールプログラムを使うには、ユーザーはプログラムを動作させるためのデータの入力方法(例:メールの送信)を知っている必要があります。ここでは、簡単な言葉を使うだけで、LLM がその「プログラム」に適した入力データの作成を手助けしてくれます。
例 1:
send an formal email to Bob ([email protected]). invite him to my friend Chris's wedding. closing with my name "Alvin"
出力例
LLM:
Email sent successfully!
SMTP:
From: [email protected]
Subject: Invitation to Chris's Wedding
Content-Type: text/plain; charset=utf-8
To: [email protected]
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.
出力例
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"
出力例
LLM:
Email sent with template successfully!
SMTP:
From: [email protected]
Subject: Welcome to our service!
Content-Type: text/plain; charset=utf-8
To: [email protected]
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 サーバーをローカルで実行する方法を説明します。
前提条件:
- SMTP サーバーとしての Python モジュール
aiosmtpd - LLM チャットインターフェースおよび MCP クライアントとしての、github copilot を備えた visual studio code
次の手順に従ってください:
- SMTP サーバーを実行します。
python -m aiosmtpd -n -l 127.0.0.1:2525 - このガイドに従って、VSCode で MCP エージェントを設定します。
- VSCode の
mcp.jsonファイルにある「start」ボタンをクリックして、MCP エージェントを起動します。 - MCP サーバーを実行します。
cargo run
最後に、「send an email to [email protected] with subject 'test' and body 'hello world'」などのプロンプトをチャットインターフェースに入力してみてください。
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。