Claude
Claude is Anthropic’s AI agent built to help you tackle complex challenges, analyze data, write code, and think through your work.
In this guide, you’ll learn how to integrate it with the Mailtrap MCP, which allows you to, amongst other things, perform the following actions:
Prerequisites:
If you haven’t set up your sending domain already, you’ll need to do it before we start — it takes ~5 minutes, and you can use our step-by-step article as a guide.
Install the latest Node.js version since Mailtrap MCP is implemented as a Node.js command line utility.
How to add Mailtrap MCP to Claude
To add Mailtrap MCP to Claude, simply go to Connectors → Manage Connectors, click on the + (plus) sign and then Browse connectors.

Then, search for Mailtrap and select it from the Connectors:

Click on Install on the following page:

Next, all you need to do is insert the following Mailtrap credentials:

MAILTRAP_API_TOKEN– Required for all functionality, used to authenticate API requests, which you can copy/paste from the credentials tab.DEFAULT_FROM_EMAIL– Required for email sending. Make sure the email’s domain matches your own domain from the Sending Domains tab in Mailtrap.
You can find these credentials in your Mailtrap account by navigating to Sending Domains → Integration → API.

MAILTRAP_ACCOUNT_ID– This is required for template management purposes. You can find the account ID under Settings → Account Settings.

MAILTRAP_TEST_INBOX_ID– If you need sandbox email functionality, you can find this ID in your Sandbox.

After you insert your Mailtrap credentials, make sure to enable the MCP on the following window, and you’re all set!

Claude + Mailtrap MCP server use cases
Sandbox operations
Reviewing code for sending emails or emails themselves in a staging environment using Sandbox
With Claude connected to Mailtrap MCP, you can complete the following actions by prompting the agent:
Verify what the code actually does without switching to the Mailtrap UI and back to the IDE
Inspect basic message metadata
Use the returned message ID to request full message details (content, headers, etc.), and more.

Template validation
To edit your email templates without switching to the Mailtrap UI, you can prompt Claude to list them and fetch a specific template ID:

Then, if you’re not satisfied with a subject line or two, you can also change them with a simple prompt, just like so:

Sending emails to your teammate
Done revising your emails in Sandbox? If so, you can ask Claude to send them to a teammate for a quick review:

Integrating Mailtrap into your project
If you’re using Claude Code to work on your project, you can ask the AI to integrate Mailtrap into your project or even migrate from another service provider by changing the configuration.
All you need to do is use a prompt like this one:
Integrate Mailtrap into my project so that it can send emails through the Mailtrap email API. Additionally, safely store the Mailtrap credentials from the MCP configuration into an .env file
Claude Code will then go through the Mailtrap documentation, integrate the email API, and safely store your credentials in a .env file. Then, you can proceed to test the configuration. For instance, here’s our contact form email in our Gmail inbox we used as our to address:

And here is the same email in the Mailtrap Email Logs:

Last updated
Was this helpful?

