# Windsurf

[Windsurf](https://windsurf.com/) is an AI coding assistant for developers and enterprises that understands your entire codebase and can plan, execute, and iterate on complex multi-file tasks autonomously.

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](#connect-mailtrap-to-your-project)
* [Perform Sandbox operations](#sandbox-operations-during-debugging)&#x20;
* [Validate email templates](#template-validation)
* [Forward email templates to your teammates](#sending-emails-to-your-teammate)

#### Prerequisites

Before you start, make sure to:

* Set up your [sending domain](https://docs.mailtrap.io/email-api-smtp/setup/sending-domain) (this takes approximately 5 minutes).
* 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.

### Step 1. Add Mailtrap MCP config to Windsurf

Open Windsurf, then navigate to **Settings** → **Windsurf** **Settings**.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FPyfQNXhceeFDlGUQNhe7%2FScreenshot%202026-03-17%20at%2010.18.42.png?alt=media&#x26;token=77107098-3584-415b-ba10-e3d1fd7055bf" alt=""><figcaption></figcaption></figure>

Under **Cascade**, you will see the **Open MCP Marketplace** button. Click on it, and you’ll be taken to the MCP Marketplace page.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FP6vC5vksTVbBS955jrRk%2Fwindsurf%201.png?alt=media&#x26;token=85188afd-420f-4c96-af51-0befebd565c4" alt=""><figcaption></figcaption></figure>

On the MCP Marketplace page, click on the **Cogwheel** button, which will open the **mcp.config.json** file.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FA4mMpU5Ad6YjYflknKuN%2Fwindsurf%202.png?alt=media&#x26;token=f59c5e42-890f-45de-92ba-a0be904c9c3e" alt=""><figcaption></figcaption></figure>

Then, in the **mcp.config.json** file, copy/paste the following code snippet:

```json
{
  "mcpServers": {
    "mailtrap": {
      "command": "npx",
      "args": ["-y", "mcp-mailtrap"],
      "env": {
        "MAILTRAP_API_TOKEN": "your_mailtrap_api_token",
        "DEFAULT_FROM_EMAIL": "your_sender@example.com",
        "MAILTRAP_ACCOUNT_ID": "your_account_id",
        "MAILTRAP_TEST_INBOX_ID": "your_test_inbox_id"
      }
    }
  }
}
```

### Step 2. Insert Mailtrap credentials

Next, all you need to do is replace the following values in the **mcp\_config.json** file:

* `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%2FhscDv0pkXXPwtcBt9zNS%2F1.png?alt=media&#x26;token=78342fbe-f5ab-40ea-a582-431f71f5bae8" 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%2FfJAdy1IiKYOmWsXSAFR4%2F2.png?alt=media&#x26;token=5de71738-c038-43d6-ab3c-1fb0852f8ca5" 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%2FRcW4AP2NUMtXG9w4FZXq%2F3.png?alt=media&#x26;token=e3ba4e3d-276e-4dca-860b-36a8b8afa2a3" alt=""><figcaption></figcaption></figure>

Once you insert your Mailtrap credentials, hit save, and you should see the Mailtrap MCP on the MCP Marketplace page.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FJpukyS9uQx5ptkd7QyjD%2Fwindsurf%203.png?alt=media&#x26;token=9e01677e-8a6d-47c7-990b-f6493ca2cd6c" alt=""><figcaption></figcaption></figure>

If you click on the newly-installed Mailtrap MCP, you’ll see the list of available tools it comes with.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FVtFOC9jquLihbBhKyJ7a%2Fwindsurf%204.png?alt=media&#x26;token=d6cc88a9-b144-4ca4-ba9b-13d11a9f8907" alt=""><figcaption></figcaption></figure>

### Windsurf + Mailtrap MCP server use cases

#### Connect Mailtrap to your project

To integrate Mailtrap without manual coding, simply prompt the Windsurf AI to connect Mailtrap to your project with 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

Windsurf AI 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%2Fg7jqRfbcQxo06wacQgpH%2FScreenshot%202026-03-17%20at%2009.48.11.png?alt=media&#x26;token=fb48ac2d-40cc-4527-a264-3cc0705a60b9" 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%2FKLdgkOzoBS8q7kWNfs3Q%2FScreenshot%202026-03-17%20at%2009.48.32.png?alt=media&#x26;token=aaac6ff3-7adf-4639-b4bf-4ee405a72086" alt=""><figcaption></figcaption></figure>

#### Sandbox operations during debugging

Reviewing code for sending emails or emails themselves in a staging environment using [Sandbox](https://mailtrap.io/email-sandbox/)?&#x20;

With Windsurf 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%2FswnBgKvJvPmE3EGO7U9U%2Fuc%201.png?alt=media&#x26;token=56b89066-60ea-4ec7-8e55-4d9b1e4d732f" alt=""><figcaption></figcaption></figure>

#### Template validation&#x20;

If you want to edit your email templates without switching to the Mailtrap UI, you can prompt the Windsurf AI 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%2FhRAm9Zt9Bhkus7Yha7QM%2Fuc%202.png?alt=media&#x26;token=82bd7b07-a2b1-4b9b-bd0a-3e6c9adb2065" 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%2FsGa3zGds4ZOmFoBdsGSj%2Fuc%203.png?alt=media&#x26;token=34b87cfd-68d4-41d8-b982-39090ea701cd" alt=""><figcaption></figcaption></figure>

#### Sending emails to your teammate

Done revising your emails in Sandbox? If so, you can ask the Windsurf AI 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%2F8Nzrh2UZaXlaguLmKJWH%2Fuc%204.png?alt=media&#x26;token=dd84ce1d-3ed8-4b1b-b30c-6e69788207d4" alt=""><figcaption></figcaption></figure>
