Mailtrap MCP
Mailtrap MCP Server sends transactional emails and manages templates via Mailtrap seamlessly. It supports sandbox testing, email operations, and template management.
How to Install and Use Mailtrap MCP
Mailtrap MCP is a useful tool that helps you send emails and manage templates easily using the Mailtrap service. Below, you will find simple steps to set it up and start using it with examples of the required code.
Prerequisites: What You Need Before Installing
Before installing Mailtrap MCP, you need to prepare a few things. First, create a Mailtrap account on their website. Then, verify your domain to show you own your sending email address. After that, get your API token and Account ID from the Mailtrap dashboard. These three pieces of information are important to make Mailtrap MCP work correctly.
You will also need to set some environment variables:
MAILTRAP_API_TOKEN=your_api_token
[email protected]
MAILTRAP_ACCOUNT_ID=your_account_id
MAILTRAP_TEST_INBOX_ID=your_test_inbox_id # needed only for sandbox emails
Quick Install: Getting Mailtrap MCP Ready Fast
You can install Mailtrap MCP quickly using the Smithery CLI tool. It helps set up the server in just one step.
Run this command:
npx @smithery/cli install mailtrap
This will install Mailtrap MCP and handle most of the setup for you automatically. After this step, you just need to add your environment variables.
Set Up Configuration for Your Environment
Now, you need to configure how Mailtrap MCP runs. Depending on what app or editor you use (Claude Desktop, Cursor, or VS Code), add this configuration:
{
"mcpServers": {
"mailtrap": {
"command": "npx",
"args": ["-y", "mcp-mailtrap"],
"env": {
"MAILTRAP_API_TOKEN": "your_mailtrap_api_token",
"DEFAULT_FROM_EMAIL": "[email protected]",
"MAILTRAP_ACCOUNT_ID": "your_account_id",
"MAILTRAP_TEST_INBOX_ID": "your_test_inbox_id"
}
}
}
}
If you use Node.js version managers like asdf, you must use absolute paths to the npx command and add extra environment variables for PATH and others. This ensures Mailtrap MCP runs correctly in your system.
Using Mailtrap MCP: Send Emails and Manage Templates
Once Mailtrap MCP is installed and configured, you can start asking it to send emails or manage templates. Here are some examples you can use with the tool:
- Send an email
{
"tool": "send-email",
"parameters": {
"to": "[email protected]",
"subject": "Meeting Tomorrow",
"text": "Friendly reminder about our upcoming meeting.",
"category": "Transactional"
}
}
- Send a sandbox email (only works if
MAILTRAP_TEST_INBOX_IDis set)
{
"tool": "send-sandbox-email",
"parameters": {
"to": "[email protected]",
"subject": "Test Template",
"html": "<h1>Welcome!</h1><p>This is a test.</p>"
}
}
- List email templates
{
"tool": "list-templates"
}
- Create a new email template
{
"tool": "create-template",
"parameters": {
"name": "Welcome Email",
"subject": "Welcome to our platform!",
"html": "<h1>Hello!</h1><p>Thank you for joining us.</p>",
"category": "General"
}
}
Tips for Best Use
- After changing environment variables, always restart Mailtrap MCP to apply the updates.
- Enable debug logging by setting
DEBUG=trueif you want to see detailed logs, which helps when troubleshooting. - Remember that sandbox email features require the test inbox ID to be configured.
With these easy instructions and code examples, you can quickly install and use Mailtrap MCP to send emails and manage your email templates effectively!