# Claude

[Claude](https://claude.ai/) 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:

* [Connect Mailtrap to your project](#sandbox-operations)
* [Perform Sandbox operations](#sandbox-operations)
* [Fetch, validate, and edit email templates](#template-validation)
* [Forward email templates to your teammates](#integrating-mailtrap-into-your-project)

**Prerequisites**:&#x20;

* 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](https://help.mailtrap.io/article/69-sending-domain-setup) as a guide.
* Install the [latest Node.js version](https://nodejs.org/en) since [Mailtrap MCP](https://www.npmjs.com/package/mcp-mailtrap) 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**.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FvIeYCVynyu4z4ZkftYNV%2FScreenshot%202026-03-18%20at%2011.41.18.png?alt=media&#x26;token=2c657c3c-2bbf-4ef3-a0c2-cefa0e890e23" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FNaWohdSlZjqgRIaiOH1O%2FScreenshot%202026-03-18%20at%2011.38.52.png?alt=media&#x26;token=e20fc9cb-f69f-4e86-8882-d572c2acca52" alt=""><figcaption></figcaption></figure>

Click on **Install** on the following page:

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FjDrwD6fvnyZVsZtmLZ4B%2FScreenshot%202026-03-18%20at%2011.54.32.png?alt=media&#x26;token=c288adbe-f2b3-462d-8c3a-09a6b41738ac" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2F0eGeZDG1nhin0vqwrnPz%2FScreenshot%202026-03-18%20at%2011.55.51.png?alt=media&#x26;token=ffd0eea8-ae13-4a3d-9e54-130cffa11ee3" alt=""><figcaption></figcaption></figure>

* `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**.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FwSRYm8n44mzptZLRoyV6%2F1.png?alt=media&#x26;token=be348203-de50-40ee-8885-6533b9c0704f" alt=""><figcaption></figcaption></figure>

* `MAILTRAP_ACCOUNT_ID` – This is required for template management purposes. You can find the account ID under **Settings** → **Account Settings**.&#x20;

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2F0I84dm1ecUPbKqK250UY%2F2.png?alt=media&#x26;token=6de468cf-9391-493a-ba2c-7b39d24d4cf7" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FYz1Buew4FK3qBAVEvc5l%2F3.png?alt=media&#x26;token=9fd0bffa-9b8e-456f-b08b-1d20fa5d7b3b" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2F6olqAYrbmfEMJxY8Uzok%2FScreenshot%202026-03-18%20at%2011.56.53.png?alt=media&#x26;token=b5b9b586-8703-4d41-8ee0-785ca7ff629e" alt=""><figcaption></figcaption></figure>

### Claude + Mailtrap MCP server use cases

#### Sandbox operations&#x20;

Reviewing code for sending emails or emails themselves in a staging environment using [Sandbox](https://mailtrap.io/email-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.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FYQiB5nu2K6JNfkoMDdLa%2Fuse%20case%201.png?alt=media&#x26;token=f0d2c32c-63fc-472d-b31e-b32f82f7a667" alt=""><figcaption></figcaption></figure>

#### Template validation&#x20;

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

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2Fw1dEejwaPZCTGCCumr1L%2Fuse%20case%202.png?alt=media&#x26;token=f4f2905e-e064-4c87-891c-29aadf765f18" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FHM6BwbbUskAvdv3YODlT%2Fuse%20case%203.png?alt=media&#x26;token=aa4a7849-8d96-4223-a539-83d746f86911" alt=""><figcaption></figcaption></figure>

#### 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:

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FmrXHVnTJR5fsv5WB5pdX%2Fuse%20case%204.png?alt=media&#x26;token=6c4c9289-6c00-4f87-91ce-7832d10c330b" alt=""><figcaption></figcaption></figure>

#### Integrating Mailtrap into your project

If you’re using [Claude Code](https://claude.com/product/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:

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FXuEkLE4o3tstZU1rMrRK%2FScreenshot%202026-03-17%20at%2009.48.11.png?alt=media&#x26;token=7c1e9fcc-af97-4e0d-8807-4d9c0871aab0" alt=""><figcaption></figcaption></figure>

And here is the same email in the [Mailtrap Email Logs](https://docs.mailtrap.io/email-api-smtp/analytics/logs):

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FheWw0CJrcy4nOItLBjdp%2FScreenshot%202026-03-17%20at%2009.48.32.png?alt=media&#x26;token=9c1dcdcf-37fc-4fbb-acdb-2764bb4c8ff6" alt=""><figcaption></figcaption></figure>
