MCP (Model Context Protocol) server for sending emails using nodemailer.
- Implements
sendEmailtool for sending emails via MCP protocol - Uses nodemailer for email delivery
- Supports Gmail and other SMTP services
- Install dependencies:
npm install- Create a
.envfile with your email credentials:
cp .env.example .envEdit .env and add your Gmail credentials:
EMAIL_USER: Your Gmail addressEMAIL_PASS: Your Gmail App Password (generate at https://myaccount.google.com/apppasswords)
- Build the project:
npm run buildTo verify the MCP server is properly configured:
npm run verifyThis will display the sendEmail tool configuration and usage instructions.
Run the server:
npm startThe server runs on stdio and exposes the sendEmail tool with the following parameters:
to(string): Recipient email addresssubject(string): Email subjectbody(string): Email body content
To send a test email to srisowmyarupaputta@gmail.com:
npm run send-testThis will send an email with:
- To: srisowmyarupaputta@gmail.com
- Subject: Test
- Body: Hello from MCP
{
"name": "sendEmail",
"description": "Send an email using nodemailer",
"inputSchema": {
"type": "object",
"properties": {
"to": {
"type": "string",
"description": "Recipient email address"
},
"subject": {
"type": "string",
"description": "Email subject"
},
"body": {
"type": "string",
"description": "Email body content"
}
},
"required": ["to", "subject", "body"]
}
}