Shubham-1068/MCP-Server-Email-Notifications-
If you are the rightful owner of MCP-Server-Email-Notifications- and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This project is an MCP server that facilitates sending email notifications via SMTP using Nodemailer.
MCP Server - Email Notifications
This project is an MCP (Model Context Protocol) server that sends email notifications via SMTP using Nodemailer.
It exposes a single tool called notificationViaEmail, which allows any MCP-compatible client (like MCP Inspector or Cursor) to send emails through your configured SMTP service.
🚀 Features
- Send plain-text emails easily
- Works with any SMTP provider (Gmail, Outlook, SendGrid, etc.)
- Simple integration with MCP clients
- Lightweight Node.js implementation
- Uses
stdiotransport for local or containerized communication
🧰 Tech Stack
- Node.js
- @modelcontextprotocol/sdk
- Nodemailer
📦 Installation
git clone https://github.com/Shubham-1068/MCP-Server-Email-Notifications-.git
cd MCP-Server-Email-Notifications-
npm install
⚙️ Configuration
Before running the server, create a .env file in your project root with your SMTP credentials:
EMAIL_HOST=smtp.yourmailserver.com
EMAIL_USER=youremail@example.com
EMAIL_PASS=yourpassword
⚠️ Note: If using Gmail, you may need to enable “App Passwords” and use that instead of your account password.
🧠 How It Works
The MCP server registers one tool named notificationViaEmail.
Tool: notificationViaEmail
Description: Send an email notification via SMTP.
Input Schema
| Field | Type | Required | Description |
|---|---|---|---|
to | string | ✅ | Recipient email address |
subject | string | ✅ | Subject line of the email |
text | string | ✅ | Plain text body of the email |
Example Input
{
"to": "recipient@example.com",
"subject": "MCP Email Test",
"text": "This is a test email sent from the MCP Server!"
}
Example Output
{
"success": true,
"message": "Email sent successfully!"
}
Example Error Output
{
"success": false,
"message": "Failed to send email: Missing email configuration."
}
🧪 Running the Server
To start the server locally:
node server.js
If you want to run it via MCP Inspector, configure your .cursor/config.json (or equivalent) as follows:
{
"mcpServers": {
"notificationViaEmail": {
"command": "node",
"args": ["path/to/server.js"]
}
}
}
Then open MCP Inspector → select your server → run notificationViaEmail tool.
🧹 Error Handling
- Checks environment variables before sending email
- Logs SMTP and validation errors to the console
- Returns structured JSON output with clear success/error states
🧩 Example Workflow (Using MCP Inspector)
- Open MCP Inspector.
- Connect to your MCP server (
notificationViaEmail). - Run the following JSON payload:
{
"to": "user@example.com",
"subject": "Hello from MCP!",
"text": "This is a test message sent via the MCP Server."
}
- Check your inbox for the sent email.
📜 Code Overview
server.js
The main entry point that:
- Initializes the MCP server
- Registers the
notificationViaEmailtool - Connects via
StdioServerTransport - Uses Nodemailer for email sending
Key Snippet
const transporter = nodemailer.createTransport({
host: process.env.EMAIL_HOST,
port: 587,
secure: false,
auth: {
user: process.env.EMAIL_USER,
pass: process.env.EMAIL_PASS
}
});
await transporter.sendMail({
from: process.env.EMAIL_USER,
to,
subject,
text,
});
🪪 License
MIT License © Shubham-1068
💬 Support
For issues or contributions, please open a GitHub issue or pull request in the repository.