Back to MCP Servers

Mailtrap MCP Server

Official Mailtrap MCP server for sending transactional emails, managing templates, inspecting sandbox inboxes, and viewing delivery logs.

Developer Tools by Railsware (Mailtrap) API Key active
Overview

The Mailtrap MCP server is the official integration maintained by Railsware (the company behind Mailtrap) that exposes Mailtrap's email API to AI agents over the Model Context Protocol. It lets assistants like Claude, Cursor, and VS Code Copilot send transactional emails, run safe sandbox tests, manage templates, inspect delivery logs, and configure sending domains directly through tool calls.

The server covers both production and development workflows. On the production side, it supports sending transactional email (with inline or template content), pulling sending statistics broken down by domain, category, or provider, and managing verified sending domains including DNS verification instructions. On the development side, the sandbox tools let agents send test messages and read back the full HTML and text content from a test inbox, which is useful for end-to-end QA of email-generating features.

Authentication uses a Mailtrap API token. MAILTRAP_API_TOKEN is mandatory for all operations, and MAILTRAP_ACCOUNT_ID is required for templates, statistics, email logs, sandbox listing, and sending domains. The package is published to npm as mcp-mailtrap and is typically run via npx.

Tools

Tool Description
send-email Send a transactional email with inline content or by referencing a template.
send-sandbox-email Send a test email to a Mailtrap sandbox inbox.
list-email-logs Retrieve sent message history with filtering options.
get-email-log-message View details and event history for a specific sent message.
get-sending-stats Return sending statistics broken down by domain, category, provider, or date.
create-template Add a new email template to the account.
list-templates List all email templates in the account.
update-template Modify properties of an existing template.
delete-template Remove a template from the account.
get-sandbox-messages List messages in a test inbox with search and pagination.
show-sandbox-email-message Display the full HTML and text content of a sandbox message.
list-sending-domains List verified sending domains and DNS verification status.
get-sending-domain Retrieve a sending domain by ID, including optional DNS setup instructions.
create-sending-domain Register a new sending domain on the account.
delete-sending-domain Remove a sending domain from the account.
Setup Guide

Prerequisites

  • Active Mailtrap account
  • API token from Mailtrap account settings
  • Account ID from the management portal (required for templates, stats, logs, and domains)

Install

Run directly via npx (no global install needed):

npx -y mcp-mailtrap

Alternative: install via Smithery:

npx @smithery/cli install mailtrap

Claude Desktop / Cursor config

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

VS Code config

{
  "mcp": {
    "servers": {
      "mailtrap": {
        "command": "npx",
        "args": ["-y", "mcp-mailtrap"],
        "env": {
          "MAILTRAP_API_TOKEN": "your_token_here",
          "DEFAULT_FROM_EMAIL": "sender@example.com",
          "MAILTRAP_ACCOUNT_ID": "your_account_id",
          "MAILTRAP_TEST_INBOX_ID": "your_test_inbox_id"
        }
      }
    }
  }
}

Environment variables

  • MAILTRAP_API_TOKEN (required): API token for all operations
  • MAILTRAP_ACCOUNT_ID (required for templates, stats, email logs, sandbox list/show, sending domains)
  • DEFAULT_FROM_EMAIL (optional): default sender if not passed per call
  • MAILTRAP_TEST_INBOX_ID (optional): default test inbox for sandbox tools
  • DEBUG=true (optional): enable debug logging to stderr
Use Cases
  • Send transactional emails (password resets, receipts, notifications) from inside an AI agent workflow using inline content or a stored Mailtrap template.
  • Run end-to-end QA on email-generating features by sending into a sandbox inbox and having the agent read back the rendered HTML and text body to verify content.
  • Audit deliverability by pulling sending statistics grouped by domain, category, or provider and surfacing trends or anomalies.
  • Manage email template content programmatically: create, update, list, and delete templates without leaving the editor.
  • Onboard and verify new sending domains by creating the domain, fetching DNS verification instructions, and checking status from an assistant.
Example Prompts
  • "Send a transactional email to alice@example.com with subject 'Welcome' using the onboarding template."
  • "Send a test email to my Mailtrap sandbox inbox and then show me the HTML body that was rendered."
  • "Show sending stats for the last 30 days grouped by category."
  • "List all my email templates and update the 'password-reset' template subject to 'Reset your password'."
  • "Create a new sending domain for marketing.example.com and give me the DNS records I need to add."
Pros
  • Official server maintained by Mailtrap/Railsware, so coverage tracks the real API.
  • Broad tool surface: send, sandbox testing, templates, logs, stats, and sending domain management in one server.
  • Simple npx install with clear config for Claude Desktop, Cursor, and VS Code.
  • Supports both production sending and safe sandbox QA from the same server.
Limitations
  • Requires a Mailtrap account, API token, and verified sending domain to use production send features.
  • MAILTRAP_ACCOUNT_ID is required for most tools beyond simple send, so partial setups have limited functionality.
  • Bound to the Mailtrap platform: useful only if you already send (or want to send) email through Mailtrap.
Alternatives