by railsware
An MCP server that provides tools for sending transactional emails and managing email templates via Mailtrap
Before using this MCP server, you need to:
Required Environment Variables:
MAILTRAP_API_TOKEN
- Required for all functionalityDEFAULT_FROM_EMAIL
- Required for all email sending operationsMAILTRAP_ACCOUNT_ID
- Required for template management operationsMAILTRAP_TEST_INBOX_ID
- Only required for sandbox email functionalityAdd the following configuration:
*Configuration content*
If you are using asdf
for managing Node.js you must use absolute path to executable (example for Mac)
*Configuration content*
Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Mac: ~/.cursor/mcp.json
Windows: %USERPROFILE%\.cursor\mcp.json
Run in Command Palette: Preferences: Open User Settings (JSON)
Then, in the settings file, add the following configuration:
*Configuration content*
[!TIP]
Don't forget to restart your MCP server after changing the "env" section.
Once configured, you can ask agent to send emails and manage templates, for example:
Email Operations:
Template Operations:
Sends a transactional email through Mailtrap.
Parameters:
to
(required): Email address(es) of the recipient(s) - can be a single email or array of emailssubject
(required): Email subject linefrom
(optional): Email address of the sender, if not provided "DEFAULT_FROM_EMAIL" will be usedtext
(optional): Email body text, required if "html" is emptyhtml
(optional): HTML version of the email body, required if "text" is emptycc
(optional): Array of CC recipient email addressesbcc
(optional): Array of BCC recipient email addressescategory
(required): Email category for tracking and analyticsSends an email to your Mailtrap test inbox for development and testing purposes. This is perfect for testing email templates without sending emails to real recipients.
Parameters:
to
(required): Email address(es) of the recipient(s) - can be a single email or array of emails (will be delivered to your test inbox)subject
(required): Email subject linefrom
(optional): Email address of the sender, if not provided "DEFAULT_FROM_EMAIL" will be usedtext
(optional): Email body text, required if "html" is emptyhtml
(optional): HTML version of the email body, required if "text" is emptycc
(optional): Array of CC recipient email addressesbcc
(optional): Array of BCC recipient email addressescategory
(optional): Email category for tracking[!NOTE]
TheMAILTRAP_TEST_INBOX_ID
environment variable must be configured for sandbox emails to work. This variable is only required for sandbox functionality and is not needed for regular transactional emails or template management.
Creates a new email template in your Mailtrap account.
Parameters:
name
(required): Name of the templatesubject
(required): Email subject linehtml
(or text
is required): HTML content of the templatetext
(or html
is required): Plain text version of the templatecategory
(optional): Template category (defaults to "General")Lists all email templates in your Mailtrap account.
Parameters:
Updates an existing email template.
Parameters:
template_id
(required): ID of the template to updatename
(optional): New name for the templatesubject
(optional): New email subject linehtml
(optional): New HTML content of the templatetext
(optional): New plain text version of the templatecategory
(optional): New category for the template[!NOTE]
At least one updatable field (name, subject, html, text, or category) must be provided when calling update-template to perform an update.
Deletes an existing email template.
Parameters:
template_id
(required): ID of the template to deletegit clone https://github.com/railsware/mailtrap-mcp.git cd mailtrap-mcp
npm install
[!TIP]
See the location of the config file in the Setup section.
Add the following configuration:
*Configuration content*
If you are using asdf
for managing Node.js you should use absolute path to executable:
(example for Mac)
*Configuration content*
[!TIP]
See the location of the config file in the Setup section.
*Configuration content*
You can test the server using the MCP Inspector:
npm run dev
Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The package is available as open source under the terms of the MIT License.
Everyone interacting in the Mailtrap project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
2 contributors