send-email
Send an email to your recipient email address using Mailtrap Email API. You can send emails to multiple recipients at once.
cctobccfromhtmltextsubjectcategorytemplate_uuidtemplate_variablesio.mailtrapPublished by mailtrap.iov0.11.0Updated Nov 6, 2026
Official MCP Server for Mailtrap
Official Mailtrap MCP server that lets an assistant send transactional and bulk email, manage templates, and inspect test-inbox messages from a local client.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Follow the launch instructions in the repository.
The official MCP server for Mailtrap — the email delivery platform. It connects your Mailtrap account to Claude, Cursor, VS Code, and other MCP-compatible AI assistants.
Send transactional and bulk email, test messages safely in Email Sandbox, manage templates, contacts, sending domains, and webhooks, inspect email logs and delivery statistics, troubleshoot deliverability, and manage account resources — all using natural-language prompts.
Works with Claude Desktop, Claude Code, Cursor, VS Code, and any other MCP-compatible client. Setup instructions for each are below.
Before using this MCP server, you need to:
Required Environment Variables:
MAILTRAP_API_TOKEN - Required for all functionalityMAILTRAP_ACCOUNT_ID - Required for templates, get-sending-stats, email logs, sandbox list/show, sending domains, and suppressions. Optional only for the send tools (send-email, send-sandbox-email, and the batch-send-* tools), the email campaign tools, get-marketing-stats, the company info tools, and the tracking opt-out tools.Optional (can be passed as tool parameters instead):
DEFAULT_FROM_EMAIL - Default sender email when from is not provided to send-email, send-sandbox-email, or the batch-send-* tools (where it fills base.from). Enables switching sender per call via the from parameter.MAILTRAP_SANDBOX_ID - Default sandbox (test inbox) ID when a tool's sandbox_id is not provided (legacy test_inbox_id on send/list/show sandbox message tools still accepted). Enables switching inboxes per call via parameters.MAILTRAP_TEST_INBOX_ID - Legacy alias for MAILTRAP_SANDBOX_ID; still read as a fallback for existing configs.MAILTRAP_ORGANIZATION_ID - Required for organization tools (list-sub-accounts, create-sub-account).MAILTRAP_ORGANIZATION_API_TOKEN - Organization-scoped API token. Required for organization tools (separate from MAILTRAP_API_TOKEN).[Install with Node in VS Code]
Run the server over stdio with the Docker MCP Catalog image:
See Prerequisites for required and optional environment variables.
To build from this repository: docker build -t mcp/mailtrap .
Smithery is a registry and installer for MCP servers that works with AI clients.
Install the published server (mailtrap/mailtrap-mcp) into a local client (replace the client name as needed):
See the Smithery CLI docs for other clients (cursor, windsurf, etc.) and for publishing updates.
Use MCPB to install the Mailtrap server. You can find those files in Releases.
Download .MCPB file and open it. If you have Claude Desktop - it will open it and suggest to configure.
Add the following configuration:
If you are using asdf for managing Node.js you must use absolute path to executable (example for Mac)
Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Mac: ~/.cursor/mcp.json
Windows: %USERPROFILE%\.cursor\mcp.json
Run in Command Palette: Preferences: Open User Settings (JSON)
Then, in the settings file, add the following configuration:
[!TIP] Don't forget to restart your MCP server after changing the "env" section.
For easy installation in hosts that support MCP Bundles, you can distribute an .mcpb bundle file.
This creates mailtrap-mcp.mcpb. The script copies dist/, manifest.json, icon.png and the
license into mcpb-build/, installs production dependencies there, and packs only that directory.
Do not run mcpb pack . from the repository root.
Once configured, you can ask agent to send emails and manage templates, for example:
Email Sending Operations:
b81aabcd-1a1e-41cf-91b6-eca0254b3d96) to [email protected] with variables { name: 'Alex' }"Email Logs (debug delivery):
Statistics:
Sandbox Operations:
Template Operations:
Sending Domains:
Suppressions:
Tracking Opt-outs:
Contacts and Lists:
Webhooks:
Account and Billing:
API Tokens:
Organization and Sub-Accounts:
Sends a transactional email through Mailtrap. Supports two mutually exclusive modes — inline content (subject + text/html) or template-based (template_uuid).
Parameters:
from (optional): Sender as { email, name? } (a bare email string is also accepted at runtime). If not provided, DEFAULT_FROM_EMAIL is used.to (optional): Array of recipients as { email, name? } objects (bare email strings, or a single non-array address, are also accepted at runtime). Optional if cc or bcc is provided; at least one of to / cc / bcc must contain a recipient.cc (optional): Array of CC recipients as { email, name? } objects (bare email strings also accepted at runtime).bcc (optional): Array of BCC recipients as { email, name? } objects (bare email strings also accepted at runtime).subject (conditional): Email subject line. Required for inline sends; must be omitted when template_uuid is set.text (conditional): Email body text. Required (alongside or instead of html) for inline sends; must be omitted when template_uuid is set.html (conditional): HTML version of the email body. Required (alongside or instead of text) for inline sends; must be omitted when template_uuid is set.category (optional): Email category for tracking and analytics. Must be omitted when template_uuid is set.template_uuid (optional): Use a Mailtrap email template instead of inline content. When set, subject / text / html / category must be omitted (per Mailtrap API).template_variables (optional): Object of variables substituted into the template referenced by template_uuid. Only allowed together with template_uuid.Sends a batch of transactional emails in one Mailtrap API call (default sending stream). Shared fields go on base; per-recipient overrides go in requests[]. Each request must include at least one recipient via to, cc, or bcc. Same inline-vs-template mutual exclusion as send-email — checked after merging base with each request.
Parameters:
base (optional): Object with fields shared across the batch.
from (optional): Sender as { email, name? } (a bare email string is also accepted at runtime). Falls back to DEFAULT_FROM_EMAIL.reply_to (optional): Reply-to address.subject / text / html / category (optional, inline mode): Default content for every request.template_uuid / template_variables (optional, template mode): Default template + variables. Mutually exclusive with the inline fields.custom_variables (optional): Default custom variables (string-valued).headers (optional): Default custom headers.requests (required): Non-empty array of per-recipient messages. Each entry has:
to (optional): Array of recipients as { email, name? } objects (bare email strings, or a single non-array address, are also accepted at runtime). Optional if cc or bcc is provided; at least one of to / cc / bcc must contain a recipient.cc, bcc, reply_to (optional).subject/text/html/category) or template (template_uuid/template_variables) overrides; any field omitted falls back to the matching base value.custom_variables, headers (optional).Sends a batch of bulk emails through Mailtrap's bulk-stream API. Same base + requests[] shape, validation, and inline-vs-template rules as batch-send-transactional-email — the only difference is that this tool routes the call through the bulk endpoint instead of the transactional one. See the parameters above.
Lists sent email logs (delivery history) with optional pagination and filters. Use to debug delivery issues from the IDE.
Parameters:
search_after (optional): Pagination cursor from the previous response's next_page_cursorsent_after (optional): ISO 8601 date/time; only logs sent after this timesent_before (optional): ISO 8601 date/time; only logs sent before this timefrom_email (optional): Filter by sender email; use with from_operator (default: ci_equal)to_email (optional): Filter by recipient email; use with to_operator (default: ci_equal)status (optional): Filter by delivery status: delivered, not_delivered, enqueued, opted_out; use with status_operator (default: equal)subject (optional): Filter by email subject; use with subject_operator (default: ci_contain). Use subject_operator: empty/not_empty to filter by presence of subject.sending_domain_id (optional): Filter by sending domain ID (number); use with sending_domain_id_operator (default: equal)sending_stream (optional): Filter by stream: transactional or bulk; use with sending_stream_operator (default: equal)events (optional): Filter by event type(s): delivery, open, click, bounce, spam, unsubscribe, soft_bounce, reject, suspension; use with events_operator (include_event / not_include_event)clicks_count / opens_count (optional): Filter by click/open count; use with *_operator: equal, greater_than, less_thanclient_ip / sending_ip (optional): Filter by IP; use with *_operator: equal, not_equal, contain, not_containemail_service_provider_response (optional): Filter by provider response text; use with *_operator (ci_contain, etc.)email_service_provider (optional): Filter by provider (exact); use with *_operator: equal, not_equalrecipient_mx (optional): Filter by recipient MX; use with recipient_mx_operator (ci_contain, etc.)category (optional): Filter by email category; use with category_operator: equal, not_equalAll parameters are optional.
Gets a single email log message by ID (UUID): a readable summary (from, to, subject, sent time, status, category, stream, engagement, delivery context), then detailed event history. Optionally, with include_content: true, you can also load and show the message body (HTML and plain text) when Mailtrap exposes a raw message URL.
Parameters:
message_id (required): UUID of the email log message (from send response or list-email-logs). Use list-email-logs to find message IDs.include_content (optional): When true, fetches the raw EML (if raw_message_url is available) and appends parsed HTML and plain-text body sections, similar to show-sandbox-email-message.Get email sending statistics (delivery, bounce, open, click, spam rates) for a date range. Optionally break down by domain, category, email service provider, or date. Check delivery rates without leaving the editor.
Parameters:
start_date (required): Start date for the stats range (YYYY-MM-DD)end_date (required): End date for the stats range (YYYY-MM-DD)breakdown (optional): How to break down the stats: aggregated (default), by_domain, by_category, by_email_service_provider, or by_datesending_domain_ids (optional): Limit results to these sending domain IDs (array of integers)sending_streams (optional): Limit to transactional and/or bulk (array of strings)categories (optional): Limit to these email categories (array of strings)email_service_providers (optional): Limit to these providers, e.g. Google, Yahoo, Outlook (array of strings)Get aggregated Email Marketing statistics across campaigns and automations for a date range: sent, delivery, bounce, open, click, spam and unsubscription counts and rates. delivery_rate and bounce_rate are shares of sent_count; the other rates are shares of delivery_count.
Parameters:
start_date (required): Start of the date range (inclusive), YYYY-MM-DDend_date (required): End of the date range (inclusive), YYYY-MM-DDsending_domain_ids (optional): Limit results to these sending domain IDs (array of integers)sources (optional): campaigns or automations narrows the stats to that source; omit it, or pass both, for all Email Marketing traffic (array of strings)email_service_providers (optional): Limit to these providers, e.g. Google, Yahoo, Outlook (array of strings)Creates a new email template in your Mailtrap account.
Parameters:
name (required): Name of the templatesubject (required): Email subject linehtml (or text is required): HTML content of the templatetext (or html is required): Plain text version of the templatecategory (optional): Template category (defaults to "General")Lists the email templates in your Mailtrap account with page-token pagination. When more templates exist, the result names the token for the next page. Pages are offsets over the newest-first list, so after deleting templates list again from token 1 instead of continuing with the next token; an empty page names the last page that still has templates.
Parameters:
token (optional): Page number to retrieve (page-token pagination). Defaults to 1per_page (optional): Number of templates per page. Defaults to 50, maximum 100. Pass the same value on every pageGet a single email template by ID, including subject, category, and HTML/text body.
Parameters:
template_id (required): ID of the template to fetchUpdates an existing email template.
Parameters:
template_id (required): ID of the template to updatename (optional): New name for the templatesubject (optional): New email subject linehtml (optional): New HTML content of the templatetext (optional): New plain text version of the templatecategory (optional): New category for the template[!NOTE] At least one updatable field (name, subject, html, text, or category) must be provided when calling update-template to perform an update.
Deletes an existing email template.
Parameters:
template_id (required): ID of the template to deleteSends an email to your Mailtrap test inbox for development and testing purposes. This is perfect for testing email templates without sending emails to real recipients. Supports the same two modes as send-email — inline content or template-based (template_uuid).
Parameters:
sandbox_id (optional): Preferred. Mailtrap sandbox (test inbox) ID. Required unless MAILTRAP_SANDBOX_ID is set.test_inbox_id (optional): Legacy alias for sandbox_id when sandbox_id is omitted.from (optional): Sender as { email, name? } (a bare email string is also accepted at runtime). If not provided, DEFAULT_FROM_EMAIL is used.to (optional): Array of recipients as { email, name? } objects (bare email strings in the array, or a comma-separated string of plain emails, are also accepted at runtime). Optional if cc or bcc is provided; at least one of to / cc / bcc must contain a recipient.cc (optional): Array of CC recipients as { email, name? } objects (bare email strings also accepted at runtime).bcc (optional): Array of BCC recipients as { email, name? } objects (bare email strings also accepted at runtime).subject (conditional): Email subject line. Required for inline sends; must be omitted when template_uuid is set.text (conditional): Email body text. Required (alongside or instead of html) for inline sends; must be omitted when template_uuid is set.html (conditional): HTML version of the email body. Required (alongside or instead of text) for inline sends; must be omitted when template_uuid is set.category (optional): Email category for tracking. Must be omitted when template_uuid is set.template_uuid (optional): Use a Mailtrap email template instead of inline content. When set, subject / text / html / category must be omitted.template_variables (optional): Object of variables substituted into the template referenced by template_uuid. Only allowed together with template_uuid.Sends a batch of emails to your Mailtrap test inbox in one API call, without delivering to real recipients. Same base + requests[] shape, validation, and inline-vs-template rules as batch-send-transactional-email — the difference is that this tool routes the call through the sandbox endpoint for a single test inbox.
Parameters:
sandbox_id (optional): Mailtrap sandbox (test inbox) ID. Required unless MAILTRAP_SANDBOX_ID is set; pass per call to target a specific sandbox.base (optional), requests (required): See batch-send-transactional-email above.[!NOTE] Most sandbox tools take
sandbox_id(or fall back toMAILTRAP_SANDBOX_ID; legacy envMAILTRAP_TEST_INBOX_IDstill works).send-sandbox-email,get-sandbox-messages, andshow-sandbox-email-messagealso accept legacytest_inbox_id.get-sandbox-inbox,update-sandbox-inbox,delete-sandbox-inbox, andclean-sandbox-inboxusesandbox_idwith legacyinbox_id(same ID;inbox_idis not used on message tools). Inbound email tools useinbox_idfor a different product (received mail), not the sandbox.
Retrieves a list of messages from your Mailtrap test inbox. Useful for checking what emails have been received in your sandbox during testing.
Parameters:
sandbox_id (optional): Preferred. Sandbox (test inbox) ID unless MAILTRAP_SANDBOX_ID is set.test_inbox_id (optional): Legacy alias for sandbox_id.page (optional): Page number for pagination (minimum: 1)last_id (optional): Pagination using last message ID. Returns messages after the specified message ID (minimum: 1)search (optional): Search query to filter messages[!NOTE] Inbox ID parameters are optional when
MAILTRAP_SANDBOX_IDis set. If none ofsandbox_id,test_inbox_id, or env are provided, the call fails. Pagination: usepage,last_id, orsearchas needed.
Shows detailed information and content of a specific email message from your Mailtrap test inbox, including HTML and text body content.
Parameters:
sandbox_id (optional): Preferred. Sandbox (test inbox) ID unless MAILTRAP_SANDBOX_ID is set.test_inbox_id (optional): Legacy alias for sandbox_id.message_id (required): ID of the sandbox email message to retrieve[!NOTE] Use
get-sandbox-messagesfirst to get message IDs, then this tool for full content.
Get a sandbox project by ID, including its inboxes and email counts.
Parameters:
project_id (required): ID of the project to fetchRename an existing sandbox project.
Parameters:
project_id (required): ID of the project to updatename (required): New name for the project (2–100 characters)List every sandbox accessible to the API token across all projects.
Parameters:
Mark all messages in a sandbox as read.
Parameters:
sandbox_id (required): ID of the sandbox to act onReset the SMTP credentials for a sandbox. Returns the new username/password.
Parameters:
sandbox_id (required): ID of the sandbox to act onEnable the receive-by-email address for a sandbox (turns on the Mailtrap address that delivers messages to the sandbox via SMTP).
Parameters:
sandbox_id (required): ID of the sandbox to act onGenerate a new receive-by-email address for a sandbox.
Parameters:
sandbox_id (required): ID of the sandbox to act onForward a sandbox message to an external email address. Counts against your monthly forwarding quota.
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox message to forwardemail (required): Email address to forward the message toMark a sandbox message as read or unread.
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox message to updateis_read (required): true marks as read, false marks as unreadDelete a single sandbox message.
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox message to deleteGet the SpamAssassin spam report for a sandbox message (score, rules, full report). Standalone alternative to include_spam_report: true on show-sandbox-email-message.
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox messageGet the HTML analysis report for a sandbox message (client compatibility scores, problematic elements). Standalone alternative to include_html_analysis: true on show-sandbox-email-message.
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox messageGet the parsed mail headers for a sandbox message.
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox messageGet the rendered HTML body of a sandbox message.
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox messageGet the plain-text body of a sandbox message.
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox messageGet the raw, MIME-formatted message (headers + body) for a sandbox message.
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox messageGet the message rendered as an EML file payload (suitable for attaching to a ticket or importing into another mail client).
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox messageGet the unrendered HTML source of a sandbox message (HTML before any Mailtrap-side transformations like CID-link rewrites).
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox messageList all attachments on a sandbox message (filename, content type, size, download path).
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox messageGet metadata and download URL for a single attachment.
Parameters:
sandbox_id (optional): Sandbox ID. Falls back to MAILTRAP_SANDBOX_ID.message_id (required): ID of the sandbox message that contains the attachmentattachment_id (required): ID of the attachment to fetchList sending domains and their DNS verification status.
Parameters:
Get a sending domain by ID and its verification status (including DNS records). Optionally include DNS setup instructions by setting include_setup_instructions to true.
Parameters:
sending_domain_id (required): Sending domain IDinclude_setup_instructions (optional): If true, append DNS setup instructions to the response. Default: falseCreate a new sending domain. After creation, add DNS records to verify the domain (use get-sending-domain with include_setup_instructions: true to see the records).
Parameters:
domain_name (required): Domain name (e.g. example.com)Update a sending domain's tracking and inbound settings.
Parameters:
sending_domain_id (required): Sending domain IDopen_tracking_enabled (optional): Track opens on emails sent from this domainclick_tracking_enabled (optional): Track clicks on links in emails sent from this domaintracking_opt_out_enabled (optional): Add the tracking opt-out link to tracked emails. Requires open or click trackingauto_unsubscribe_link_enabled (optional): Automatically add an unsubscribe link to emailsinbound_enabled (optional): Allow the domain to be attached to an inbound inbox as a catch-allAt least one setting besides sending_domain_id must be provided.
Delete a sending domain.
Parameters:
sending_domain_id (required): Sending domain ID to deleteEmail DNS setup instructions for a sending domain to a given address. Useful for forwarding DNS records to a DevOps teammate.
Parameters:
sending_domain_id (required): Sending domain IDemail (required): Email address to send DNS setup instructions toGet the company info of a sending domain, used for domain compliance verification.
Parameters:
sending_domain_id (required): Sending domain IDSet the company info of a sending domain, required for domain compliance verification.
Parameters:
sending_domain_id (required): Sending domain IDname (required): Company or individual nameaddress (required): Street addresscity (required): Citycountry (required): Countryzip_code (required): ZIP or postal codewebsite_url (required): Company website URLphone (optional): Phone numberprivacy_policy_url (optional): URL of the privacy policy pageterms_of_service_url (optional): URL of the terms of service pageinfo_level (optional): business or individualUpdate the company info of a sending domain.
Parameters:
sending_domain_id (required): Sending domain IDList or search suppressions (hard bounces, spam complaints, unsubscriptions, manual imports). Returns up to 1000 results per call.
Parameters:
email (optional): Email filter. Returns only suppressions matching this address.Add an email address to the account's suppression list, so Mailtrap stops delivering to it.
Parameters:
email (required): Email address to suppressdomain_id (required): ID of the sending domain the suppression applies tosending_stream (required): transactional or bulktype (optional): hard bounce, spam complaint, unsubscription or manual import. Defaults to manual importDelete a suppression by ID. Mailtrap will resume delivery to this email unless it gets suppressed again.
Parameters:
suppression_id (required): ID of the suppression to deleteList email addresses excluded from open and click tracking. Returns up to 1000 records per call.
Parameters:
email (optional): Email filter. Returns only opt-outs matching this addressstart_time (optional): Only opt-outs created at or after this time (ISO 8601)end_time (optional): Only opt-outs created at or before this time (ISO 8601)last_id (optional): Pagination cursor — the last_id from the previous responseExclude an email address from open and click tracking for a sending domain.
Parameters:
email (required): Email address to opt out of trackingdomain_id (required): ID of the sending domain the opt-out applies toRemove an email address from the tracking opt-out list, so open and click tracking applies to it again.
Parameters:
tracking_opt_out_id (required): ID of the tracking opt-out to deleteList all webhooks configured for the account. Returns the full webhook records as JSON.
Parameters:
Get a single webhook by ID. Returns the full webhook record as JSON. Note: signing_secret is not returned here — it is only available in the response from create-webhook.
Parameters:
webhook_id (required): ID of the webhook to fetchCreate a webhook. The response includes a signing_secret for verifying webhook payload signatures — this secret is returned only on creation, so store it now. If you lose it, recreate the webhook.
Parameters:
url (required): URL Mailtrap will POST webhook events towebhook_type (required): "email_sending", "audit_log", or "inbound_receiving"active (optional, boolean): defaults to truepayload_format (optional): "json" or "jsonlines". Defaults to "json"sending_stream (optional, email_sending only): "transactional" or "bulk"event_types (optional, email_sending only): array of delivery, soft_bounce, bounce, suspension, unsubscribe, open, spam_complaint, click, rejectdomain_id (optional, email_sending only): sending domain ID to scope this webhook toinbound_inbox_id (optional, inbound_receiving only): ID of the inbound inbox the webhook is linked to; omit to apply to all inboxes in the accountUpdate a webhook's mutable fields. webhook_type, sending_stream, and domain_id cannot be changed after creation — recreate the webhook if you need to change those.
Parameters:
webhook_id (required): ID of the webhook to updateurl (optional): New webhook URLactive (optional, boolean): Enable or disable the webhookpayload_format (optional): "json" or "jsonlines"event_types (optional, email_sending only): array of delivery, soft_bounce, bounce, suspension, unsubscribe, open, spam_complaint, click, rejectinbound_inbox_id (optional, inbound_receiving only): ID of the inbound inbox the webhook is linked toPermanently delete a webhook by ID. Returns the deleted webhook record.
Parameters:
webhook_id (required): ID of the webhook to deleteGet a contact by ID or email. Returns the full contact record (list memberships, status, custom fields).
Parameters:
contact_identifier (required): Contact ID or email addressCreate a new contact.
Parameters:
email (required): Email addressfields (optional): Custom field values keyed by merge tag (e.g. first_name). String, number, or boolean valueslist_ids (optional): IDs of contact lists to subscribe this contact tounsubscribed (optional, boolean): Create the contact in unsubscribed statusUpdate an existing contact identified by ID or email. list_ids replaces the contact's full membership set; list_ids_included/list_ids_excluded add/remove without disturbing the rest.
Parameters:
contact_identifier (required): Contact ID or emailemail (optional): New email addressfields (optional): Custom field values keyed by merge taglist_ids (optional): Replace membership set with this exact listlist_ids_included (optional): List IDs to add (additive)list_ids_excluded (optional): List IDs to removeunsubscribed (optional, boolean): Set to unsubscribed (true) or subscribed (false)Permanently delete a contact by ID or email. Returns the deleted contact record when the API responds with one; otherwise returns a confirmation payload.
Parameters:
contact_identifier (required): Contact ID or emailRecord a contact event against a contact (by ID or email). Used to trigger contact-list automations.
Parameters:
contact_identifier (required): Contact ID or emailname (required): Event name (matches automation triggers)params (required): Object of arbitrary key/value pairs. Values may be string, number, boolean, or nullList all contact lists for the account.
Parameters:
search (optional): Filter contact lists by name (case-insensitive match), e.g. newsGet a contact list by ID.
Parameters:
list_id (required): ID of the contact list to fetchCreate a new contact list.
Parameters:
name (required): Name for the new listRename an existing contact list.
Parameters:
list_id (required): ID of the contact listname (required): New name for the listPermanently delete a contact list by ID.
Parameters:
list_id (required): ID of the contact list to deleteList all contact field definitions for the account.
Parameters:
Get a contact field definition by ID.
Parameters:
field_id (required): ID of the contact fieldCreate a new contact field definition. merge_tag must be unique within the account and is used as the placeholder name in template variables.
Parameters:
name (required): Display name (e.g. "First Name")merge_tag (required): Unique placeholder name (e.g. first_name)data_type (required): One of text, number, boolean, dateUpdate a contact field definition. Any combination of name, merge_tag, and data_type can be changed.
Parameters:
field_id (required): ID of the contact fieldname (optional): New display namemerge_tag (optional): New merge tag (must remain unique)data_type (optional): One of text, number, boolean, datePermanently delete a contact field definition by ID.
Parameters:
field_id (required): ID of the contact field to deleteBulk import contacts. Returns an import job record; poll its status with get-contact-import.
Parameters:
contacts (required): Array of contact entries. Each entry needs:
email (required): Contact email addressfields (optional): Custom field values keyed by merge tag (string or number values)list_ids_included (optional): List IDs to add the contact tolist_ids_excluded (optional): List IDs to remove the contact fromGet the status of a contact import job (created/started/finished/failed) with created/updated/over-limit counts.
Parameters:
import_id (required): ID of the contact import jobExport contacts matching a set of AND-combined filters. Returns an export job record; poll status with get-contact-export to retrieve the download URL once status is finished.
Parameters:
filters (required): Array of filter objects. Each has:
name (required): Field to filter on (list_id, subscription_status, email, etc.)operator (required): One of equal, not_equal, contains, not_contains, is_empty, is_not_emptyvalue (required): Comparison value (string, number, boolean, or array)Get the status of a contact export job. Once status is finished, the url field holds the CSV download link.
Parameters:
export_id (required): ID of the contact export jobList the account's email campaigns, newest first, with page-token pagination. Optionally filter by name with search.
Parameters:
token (optional): Page number to retrieve (page-token pagination). Defaults to 1per_page (optional): Number of campaigns per page. Defaults to 50, maximum 100search (optional): Filter campaigns by name (case-insensitive partial match)Get an email campaign by ID.
Parameters:
email_campaign_id (required): ID of the email campaignCreate a new email campaign. The campaign is always created in the draft state; scheduling and starting are separate tools (schedule-email-campaign, start-email-campaign).
Parameters:
name (required): Campaign namedomain_id (required): ID of the verified sending domain used for the campaign, as returned by the Sending Domains endpointsfrom_local_part (required): Local part (before the @) of the From addresstemplate_attributes (required): Inline email template. Has:
subject (required): Email subject line (max 255 chars). Supports merge tags, e.g. Hi {{first_name}}body_html (optional): HTML body (the design). Required before the campaign can be scheduled or started. Include an unsubscribe link via an anchor whose href contains the __unsubscribe_url__ placeholderbody_text (optional): Plain-text alternative of the email bodymerge_tags (optional): Bare names of the merge tags referenced in the subject/body, e.g. ["first_name"]from_display_name (optional): Display name shown in the From headerreply_to (optional): Reply-To address parts (display_name, local_part, domain)delivery_mode (optional): rapid (send as fast as possible) or gradual (throttle to delivery_options.emails_per_hour)delivery_options (optional): Delivery throttling options (emails_per_hour)contact_list_ids (optional): IDs of contact lists to send to (treated as the full set of included lists)contact_segment_ids (optional): IDs of contact segments to send to (treated as the full set of included segments)Update a draft email campaign. Only the provided fields change; the template is edited in place. Campaigns in any other state cannot be updated.
Parameters:
email_campaign_id (required): ID of the email campaign to updatecreate-email-campaign (name, domain_id, from_local_part, from_display_name, reply_to, template_attributes, delivery_mode, delivery_options, contact_list_ids, contact_segment_ids)Delete an email campaign by ID. Only a campaign in the draft state can be deleted.
Parameters:
email_campaign_id (required): ID of the email campaign to deleteStart sending a draft email campaign immediately. Only draft campaigns can be started; the template must have a body_html design and the audience and verified sending domain must be set.
Parameters:
email_campaign_id (required): ID of the email campaign to startSchedule a draft email campaign to start sending at a future time. Only draft campaigns can be scheduled.
Parameters:
email_campaign_id (required): ID of the email campaign to scheduledatetime (required): When to send the campaign (ISO 8601). Must be in the future and no more than 1 month aheadCancel a scheduled email campaign, returning it to draft. Only scheduled campaigns can be cancelled.
Parameters:
email_campaign_id (required): ID of the email campaign to cancelTerminate an email campaign that is currently sending (started, queued, or paused), aborting the in-flight send.
Parameters:
email_campaign_id (required): ID of the email campaign to terminateReset a scheduled email campaign back to draft. Only scheduled campaigns can be reset.
Parameters:
email_campaign_id (required): ID of the email campaign to resetGet aggregated performance statistics for an email campaign (counts and rates for deliveries, opens, clicks, bounces, spam complaints, and unsubscriptions).
Parameters:
email_campaign_id (required): ID of the email campaignstart_date (optional): Start of the aggregation window (inclusive), YYYY-MM-DD. Defaults to the day the campaign was last startedend_date (optional): End of the aggregation window (inclusive), YYYY-MM-DD. Defaults to the current dateList Mailtrap accounts the current API token can access, with each account's access levels.
Parameters:
Get the current billing cycle usage for the account: sending and testing plans, limits, and current counts.
Parameters:
List account accesses (users, invites, API tokens) for the account. Optional filters narrow the result to specific resources. Requires account admin/owner permissions.
Parameters:
domain_uuids (optional): Filter by sending domain UUIDs (array of strings)inbox_ids (optional): Filter by sandbox inbox IDs (array of strings)project_ids (optional): Filter by sandbox project IDs (array of strings)Remove an account access by ID. For User specifiers this revokes their permissions; for Invite or ApiToken specifiers it removes the specifier entirely. Requires admin/owner.
Parameters:
account_access_id (required): ID of the access record to removeGet all resources (inboxes, projects, domains, billing, account) to which the API token has admin access, nested by hierarchy.
Parameters:
Bulk create, update, or destroy permissions for a single account access. Existing (resource_type, resource_id) pairs are updated; new ones are created. Set destroy: true on an entry to remove it.
Parameters:
account_access_id (required): Target account access IDpermissions (required): Array of permission entries. Each has:
resource_id (required): Resource ID (number or string)resource_type (required): One of account, project, inbox, domain, billingaccess_level (optional): admin/100 or viewer/10destroy (optional, boolean): When true, removes this permission instead of creating/updating itList all API tokens for the account.
Parameters:
Create a new API token. The response includes the secret token value — this is the only time the full token is returned, so store it immediately. If you lose it, recreate the token.
Parameters:
name (required): Display name for the tokenexpires_at (optional): Token expiration as an ISO 8601 date-time. Omit for the server default (1 year); pass an explicit null for a token that never expires. Past values or values more than 5 years ahead are rejectedresources (optional): Array of resource permissions to scope the token to. Each entry has:
resource_type (required): One of account, project, inbox, domain, billingresource_id (required): ID of the resourceaccess_level (required): 100 (admin) or 10 (viewer)Get an API token by ID. Returns metadata only — the secret token value is not returned here (only from create-api-token / reset-api-token).
Parameters:
api_token_id (required): ID of the API tokenReset (rotate) an API token by ID. The response includes the new secret token value — returned only on this call, so store it immediately. The previous token is invalidated.
Parameters:
api_token_id (required): ID of the API token to resetexpires_at (optional): Expiration for the new token as an ISO 8601 date-time. Omit for the server default (1 year); pass an explicit null for a token that never expires. Past values or values more than 5 years ahead are rejectedPermanently delete an API token by ID. The token can no longer authenticate after deletion.
Parameters:
api_token_id (required): ID of the API token to deleteList sub-accounts in the organization. Requires MAILTRAP_ORGANIZATION_ID env var and sub-account management permissions.
Parameters:
Create a new sub-account under the organization. Requires MAILTRAP_ORGANIZATION_ID env var and sub-account management permissions.
Parameters:
name (required): Display name for the new sub-accountList all inbound folders in the account. Returns a formatted summary.
Parameters:
Get a single inbound folder by ID. Returns the full folder record as JSON.
Parameters:
folder_id (required): ID of the inbound folderCreate a new inbound folder.
Parameters:
name (required): The folder nameRename an inbound folder.
Parameters:
folder_id (required): ID of the inbound foldername (required): The new folder namePermanently delete an inbound folder along with all of its inboxes.
Parameters:
folder_id (required): ID of the inbound folderList all inboxes in an inbound folder. Returns a formatted summary.
Parameters:
folder_id (required): ID of the inbound folderGet a single inbound inbox by ID. Returns the full inbox record as JSON.
Parameters:
folder_id (required): ID of the inbound folderinbox_id (required): ID of the inboxCreate a new inbound inbox in a folder.
Parameters:
folder_id (required): ID of the inbound foldername (required): The inbox namedomain_id (optional): Attach to a custom sending domain (catch-all inbox). Omit for a Mailtrap-hosted inboxRename an inbound inbox.
Parameters:
folder_id (required): ID of the inbound folderinbox_id (required): ID of the inboxname (required): The new inbox namePermanently delete an inbound inbox.
Parameters:
folder_id (required): ID of the inbound folderinbox_id (required): ID of the inboxList received messages in an inbound inbox (cursor-paginated). Returns a formatted summary with a next-page hint when more results exist.
Parameters:
inbox_id (required): ID of the inboxlast_id (optional): Pagination cursor from a previous response's last_idGet a single inbound message with its full body and attachment download URLs. Returns the full message record as JSON.
Parameters:
inbox_id (required): ID of the inboxmessage_id (required): ID of the messagePermanently delete an inbound message.
Parameters:
inbox_id (required): ID of the inboxmessage_id (required): ID of the messageReply to an inbound message (sends to the original sender). Sends a real email. Addresses accept a bare email string or { email, name? }.
Parameters:
inbox_id (required): ID of the inboxmessage_id (required): ID of the message to reply totext / html (at least one recommended): Reply bodyfrom (optional): Sender. Rejected for Mailtrap-hosted inboxes; required for custom-domain inboxescc / bcc / reply_to (optional): Additional addressescategory (optional): Message categoryattachments (optional): Array of { content (base64), filename, type?, disposition?, content_id? }headers / custom_variables (optional): Objects of string valuesReply to an inbound message and copy the original's other recipients. Sends a real email. Same parameters as reply-to-inbound-message.
Parameters:
inbox_id (required): ID of the inboxmessage_id (required): ID of the message to reply toreply-to-inbound-messageForward an inbound message to new recipients. Sends a real email.
Parameters:
inbox_id (required): ID of the inboxmessage_id (required): ID of the message to forwardto (required): At least one recipient (bare email string or { email, name? }, or an array)reply-to-inbound-messageList conversation threads in an inbound inbox (cursor-paginated), optionally filtered by search. Returns a formatted summary with a next-page hint when more results exist.
Parameters:
inbox_id (required): ID of the inboxlast_id (optional): Pagination cursor from a previous response's last_idsearch (optional): Case-insensitive text matched against the thread subject and the from/to/cc/bcc addresses of its messages. Pass the same value when paginatingGet a single inbound thread with its messages embedded (oldest first). Returns the full thread record as JSON.
Parameters:
inbox_id (required): ID of the inboxthread_id (required): ID of the threadPermanently delete an inbound thread.
Parameters:
inbox_id (required): ID of the inboxthread_id (required): ID of the threadList the forward rules of an inbound inbox. Returns a formatted summary.
Parameters:
inbox_id (required): ID of the inboxGet a single inbound forward rule by ID. Returns the full rule record, including its conditions and destinations, as JSON.
Parameters:
inbox_id (required): ID of the inboxforward_rule_id (required): ID of the forward ruleCreate a forward rule on an inbound inbox. Received messages matching all conditions are forwarded to the rule's destinations.
Parameters:
inbox_id (required): ID of the inboxname (required): Rule name, unique within the inboxconditions (optional): Array of { match_type, operator, value?, header_key? }. match_type is sender, recipient, or header; operator is equal, not_equal, contains, starts_with, ends_with, empty, or not_empty (empty/not_empty only for header, and take no value); header_key is required for header. Omit or pass [] to match every messagedestinations (optional): Array of { email } to forward matching messages toUpdate an inbound forward rule. Only the provided fields change; a provided conditions or destinations array replaces the whole set.
Parameters:
inbox_id (required): ID of the inboxforward_rule_id (required): ID of the forward rulename (optional): New rule nameconditions (optional): Replacement condition set (same shape as on create); [] removes all conditions, so the rule matches every messagedestinations (optional): Replacement destination set; [] removes all destinationsPermanently delete an inbound forward rule.
Parameters:
inbox_id (required): ID of the inboxforward_rule_id (required): ID of the forward rule[!TIP] See the location of the config file in the Setup section.
Add the following configuration:
If you are using asdf for managing Node.js you should use absolute path to executable:
(example for Mac)
[!TIP] See the location of the config file in the Setup section.
There are two ways to exercise a tool end-to-end against a real Mailtrap account: the MCP Inspector browser UI for interactive exploration, or its CLI mode for one-shot calls from the shell.
Both require the bundle to be built first:
and MAILTRAP_API_TOKEN + MAILTRAP_ACCOUNT_ID exported in your shell (the mcp:cli script forwards both to the spawned server).
The Inspector prints a URL like http://localhost:6274. Open it, switch to the Tools tab, pick a tool (e.g. get-template), fill the parameters as JSON, and hit Run. The Mailtrap response appears in the panel below.
For one-shot calls without the UI, use npm run mcp:cli. Pass the Inspector's CLI flags after -- so npm forwards them verbatim:
[!TIP] For development with the MCP Inspector:
This server uses structured error handling aligned with MCP conventions:
VALIDATION_ERROR: Input validation failuresCONFIGURATION_ERROR: Missing or invalid configurationEXECUTION_ERROR: Runtime execution errorsTIMEOUT: Operation timeout (30 seconds default)Errors include actionable messages and are logged in structured form.
Structured JSON logs with levels: INFO, WARN, ERROR, DEBUG.
Enable debug logging by setting DEBUG=true.
Important: The server writes logs to stderr so stdout remains reserved for JSON-RPC frames. This prevents hosts from encountering JSON parsing errors due to interleaved logs.
Log analysis example using jq:
Common issues:
MAILTRAP_API_TOKEN is setsandbox_id in the tool call (or legacy test_inbox_id on send/list/show message tools), or set MAILTRAP_SANDBOX_ID envBug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The package is available as open source under the terms of the MIT License.
Everyone interacting in the Mailtrap project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
Source: README.md at commit 6e58ee7
Send an email to your recipient email address using Mailtrap Email API. You can send emails to multiple recipients at once.
cctobccfromhtmltextsubjectcategorytemplate_uuidtemplate_variablesSend a batch of transactional emails in one Mailtrap API call. Shared fields go on `base`; per-recipient overrides go in `requests[]`. Each request must include `to`.
baserequestsrequiredSend a batch of bulk emails (Mailtrap bulk-stream API) in one call. Shared fields go on `base`; per-recipient overrides go in `requests[]`. Each request must include at least one of `to`/`cc`/`bcc`.
baserequestsrequiredCreate a new email template
htmlnamerequiredtextsubjectrequiredcategoryList the account's email templates with page-token pagination (`token`, `per_page`). Pages are offsets over the newest-first list, so after deleting templates list again from token 1 instead of continuing with the next token.
tokenper_pageGet a single email template by ID, including subject, category, and HTML/text body.
template_idrequiredUpdate an existing email template
htmlnametextsubjectcategorytemplate_idrequiredDelete an existing email template
template_idrequiredSend an email in sandbox mode to a test inbox without delivering to your recipients
cctobccfromhtmltextsubjectcategorysandbox_idtemplate_uuidtest_inbox_idtemplate_variablesSend a batch of emails in sandbox mode to a test inbox in one Mailtrap API call. Shared fields go on `base`; per-recipient overrides go in `requests[]`. Requires `sandbox_id` or the MAILTRAP_SANDBOX_ID env var.
baserequestsrequiredsandbox_idGet list of messages from the sandbox test inbox
pagesearchlast_idsandbox_idtest_inbox_idShow sandbox email message details and content from the sandbox test inbox. Optionally include spam report (SpamAssassin score) and HTML analysis (client compatibility) for email testing workflows.
message_idrequiredsandbox_idtest_inbox_idinclude_spam_reportinclude_html_analysisList all sandbox projects and their inboxes in your Mailtrap account
Takes no parameters.
Create a new sandbox project to group test inboxes
namerequiredGet a sandbox project by ID, including its inboxes and email counts
project_idrequiredRename an existing sandbox project
namerequiredproject_idrequiredDelete a sandbox project and all its inboxes
project_idrequiredCreate a new sandbox test inbox within a project. Returns SMTP credentials for the new inbox.
namerequiredproject_idrequiredGet sandbox inbox details including SMTP credentials, email counts, and status
inbox_idsandbox_idUpdate a sandbox inbox name or email username
nameinbox_idsandbox_idemail_usernameDelete a sandbox inbox and all its messages
inbox_idsandbox_idDelete all messages from a sandbox inbox without deleting the inbox itself
inbox_idsandbox_idList all sandboxes accessible to the API token across projects
Takes no parameters.
Mark all messages in a sandbox as read
sandbox_idrequiredReset the SMTP credentials for a sandbox
sandbox_idrequiredEnable the receive-by-email address for a sandbox
sandbox_idrequiredGenerate a new receive-by-email address for a sandbox
sandbox_idrequiredForward a sandbox message to an email address (counts against your monthly forwarding quota)
emailrequiredmessage_idrequiredsandbox_idMark a sandbox message as read or unread
is_readrequiredmessage_idrequiredsandbox_idDelete a single sandbox message
message_idrequiredsandbox_idGet the SpamAssassin spam report for a sandbox message (score, rules, report).
message_idrequiredsandbox_idGet HTML analysis for a sandbox message (client compatibility, problematic elements).
message_idrequiredsandbox_idGet the parsed mail headers for a sandbox message.
message_idrequiredsandbox_idGet the rendered HTML body of a sandbox message.
message_idrequiredsandbox_idGet the plain-text body of a sandbox message.
message_idrequiredsandbox_idGet the raw message (MIME-formatted) for a sandbox message.
message_idrequiredsandbox_idGet a sandbox message as an EML file payload.
message_idrequiredsandbox_idGet the unrendered HTML source of a sandbox message.
message_idrequiredsandbox_idList all attachments on a sandbox message.
message_idrequiredsandbox_idGet the metadata and download URL for a single sandbox attachment.
message_idrequiredsandbox_idattachment_idrequiredGet email sending statistics (delivery, bounce, open, click, spam rates) for a date range. Optionally break down by domain, category, email service provider, or date.
end_daterequiredbreakdowncategoriesstart_daterequiredsending_streamssending_domain_idsemail_service_providersList sent email logs (delivery history) with optional pagination and filters; use to debug delivery issues.
eventsstatussubjectcategoryto_emailclient_ipfrom_emailsending_ipsent_afteropens_countsent_beforeto_operator+21 moreGet a single email log message by ID (UUID) to inspect delivery status and event history.
message_idrequiredinclude_contentList sending domains and their DNS verification status
Takes no parameters.
Get a sending domain by ID and its verification status. Optionally include DNS setup instructions via include_setup_instructions.
sending_domain_idrequiredinclude_setup_instructionsCreate a new sending domain
domain_namerequiredUpdate a sending domain's tracking and inbound settings.
inbound_enabledsending_domain_idrequiredopen_tracking_enabledclick_tracking_enabledtracking_opt_out_enabledauto_unsubscribe_link_enabledDelete a sending domain
sending_domain_idrequiredEmail DNS setup instructions for a sending domain to a given address.
emailrequiredsending_domain_idrequiredGet the company info of a sending domain, used for domain compliance verification.
sending_domain_idrequiredSet the company info of a sending domain, required for domain compliance verification.
cityrequirednamerequiredphoneaddressrequiredcountryrequiredzip_coderequiredinfo_levelwebsite_urlrequiredsending_domain_idrequiredprivacy_policy_urlterms_of_service_urlUpdate the company info of a sending domain.
citynamephoneaddresscountryzip_codeinfo_levelwebsite_urlsending_domain_idrequiredprivacy_policy_urlterms_of_service_urlList or search suppressions. Optionally filter by email. Returns up to 1000 suppressions per call.
emailAdd an email address to the account's suppression list, so Mailtrap stops delivering to it.
typeemailrequireddomain_idrequiredsending_streamrequiredDelete a suppression by ID. Mailtrap will resume delivery to this email unless it gets suppressed again.
suppression_idrequiredList email addresses excluded from open and click tracking. Returns up to 1000 records per call.
emaillast_idend_timestart_timeExclude an email address from open and click tracking for a sending domain.
emailrequireddomain_idrequiredRemove an email address from the tracking opt-out list, so open and click tracking applies to it again.
tracking_opt_out_idrequiredList all webhooks for the account.
Takes no parameters.
Get a single webhook by ID.
webhook_idrequiredCreate a webhook. `webhook_type` may be `email_sending`, `audit_log`, or `inbound_receiving`; for `inbound_receiving`, `inbound_inbox_id` is optional (scopes the webhook to one inbox — omit to apply to all inboxes). The response includes a `signing_secret` for verifying webhook payload signatures — this secret is returned only on creation, so store it now.
urlrequiredactivedomain_idevent_typeswebhook_typerequiredpayload_formatsending_streaminbound_inbox_idUpdate a webhook's mutable fields (`url`, `active`, `payload_format`, `event_types`, `inbound_inbox_id`). `webhook_type`, `sending_stream`, and `domain_id` cannot be changed after creation.
urlactivewebhook_idrequiredevent_typespayload_formatinbound_inbox_idPermanently delete a webhook by ID. Returns the deleted webhook record.
webhook_idrequiredGet a contact by ID or email address. Returns the full contact record including list memberships, status, and custom fields.
contact_identifierrequiredCreate a new contact. Requires `email`; optionally accepts custom `fields`, `list_ids` to subscribe to, and `unsubscribed` to start in unsubscribed status.
emailrequiredfieldslist_idsunsubscribedUpdate a contact (identified by ID or email). `list_ids` replaces the membership set; `list_ids_included`/`list_ids_excluded` add/remove without disturbing the rest.
emailfieldslist_idsunsubscribedlist_ids_excludedlist_ids_includedcontact_identifierrequiredPermanently delete a contact by ID or email. Returns the deleted contact record when available.
contact_identifierrequiredRecord a contact event (by `name` + arbitrary `params`) against a contact ID or email. Used to trigger automations.
namerequiredparamsrequiredcontact_identifierrequiredList all contact lists for the account. Optionally filter by name with `search` (case-insensitive match).
searchGet a contact list by ID.
list_idrequiredCreate a new contact list.
namerequiredRename an existing contact list.
namerequiredlist_idrequiredPermanently delete a contact list by ID.
list_idrequiredList all contact field definitions for the account.
Takes no parameters.
Get a contact field definition by ID.
field_idrequiredCreate a new contact field definition. `merge_tag` must be unique and is used in template variables.
namerequireddata_typerequiredmerge_tagrequiredUpdate a contact field definition. Any combination of `name`, `merge_tag`, or `data_type` can be changed.
namefield_idrequireddata_typemerge_tagPermanently delete a contact field definition by ID.
field_idrequiredBulk import contacts. Returns an import job record; poll status via `get-contact-import`.
contactsrequiredGet the status of a contact import job, including created/updated/over-limit counts.
import_idrequiredExport contacts matching a set of AND-combined filters. Returns an export job; poll status with `get-contact-export` to retrieve the download URL.
filtersrequiredGet the status of a contact export job. Once `status` is `finished`, the `url` field holds the download link.
export_idrequiredList the account's email campaigns, newest first, with page-token pagination (`token`, `per_page`). Optionally filter by name with `search`.
tokensearchper_pageGet an email campaign by ID.
email_campaign_idrequiredCreate a new email campaign in the `draft` state; requires `name`, `domain_id`, `from_local_part`, and a `template_attributes.subject`.
namerequiredreply_todomain_idrequireddelivery_modefrom_local_partrequiredcontact_list_idsdelivery_optionsfrom_display_namecontact_segment_idstemplate_attributesrequiredUpdate a `draft` email campaign; only the provided fields change, and campaigns in any other state cannot be updated.
namereply_todomain_iddelivery_modefrom_local_partcontact_list_idsdelivery_optionsemail_campaign_idrequiredfrom_display_namecontact_segment_idstemplate_attributesDelete an email campaign by ID; only a campaign in the `draft` state can be deleted.
email_campaign_idrequiredStart sending a `draft` email campaign immediately; only `draft` campaigns can be started.
email_campaign_idrequiredSchedule a `draft` email campaign to start sending at `datetime` (ISO 8601, must be in the future and no more than 1 month ahead); only `draft` campaigns can be scheduled.
datetimerequiredemail_campaign_idrequiredCancel a `scheduled` email campaign, returning it to `draft`; only `scheduled` campaigns can be cancelled.
email_campaign_idrequiredTerminate an email campaign that is currently sending (`started`, `queued`, or `paused`), aborting the in-flight send.
email_campaign_idrequiredReset a `scheduled` email campaign back to `draft`; only `scheduled` campaigns can be reset.
email_campaign_idrequiredGet aggregated performance statistics for an email campaign; optionally narrow the window with `start_date`/`end_date` (`YYYY-MM-DD`).
end_datestart_dateemail_campaign_idrequiredList Mailtrap accounts accessible to the API token, with each account's access levels.
Takes no parameters.
Get the current billing cycle usage for the account (sending and testing plans, limits, and current counts).
Takes no parameters.
List account accesses (users, invites, API tokens) for the account. Optionally scope by domain UUIDs, inbox IDs, or project IDs. Requires account admin/owner permissions.
inbox_idsproject_idsdomain_uuidsRemove an account access by ID. For User specifiers this revokes permissions; for Invite or ApiToken specifiers it removes the specifier itself. Requires admin/owner.
account_access_idrequiredGet all resources (inboxes, projects, domains, billing, account) to which the API token has admin access, nested by hierarchy.
Takes no parameters.
Bulk create, update, or destroy permissions for an account access. Existing (resource_type, resource_id) pairs are updated; new ones are created. Set `destroy: true` to remove.
permissionsrequiredaccount_access_idrequiredList all API tokens for the account.
Takes no parameters.
Create a new API token. The response includes the secret `token` value — this is the **only time** the full token is returned, so store it immediately.
namerequiredresourcesexpires_atGet an API token by ID. The secret token value is NOT returned here — only the metadata (name, last 4 digits, resources).
api_token_idrequiredReset (rotate) an API token by ID. The response includes the **new** secret `token` value — returned only on this call, so store it immediately. The previous token is invalidated.
expires_atapi_token_idrequiredPermanently delete an API token by ID. The token can no longer authenticate after deletion.
api_token_idrequiredList sub-accounts in the organization. Requires `MAILTRAP_ORGANIZATION_ID` env var and sub-account management permissions.
Takes no parameters.
Create a new sub-account under the organization. Requires `MAILTRAP_ORGANIZATION_ID` and sub-account management permissions.
namerequiredList all inbound folders in the account.
Takes no parameters.
Get a single inbound folder by ID.
folder_idrequiredCreate a new inbound folder.
namerequiredRename an inbound folder.
namerequiredfolder_idrequiredPermanently delete an inbound folder along with all of its inboxes.
folder_idrequiredList all inboxes in an inbound folder.
folder_idrequiredGet a single inbound inbox by ID.
inbox_idrequiredfolder_idrequiredCreate a new inbound inbox in a folder. Omit `domain_id` for a Mailtrap-hosted inbox; pass it for a custom-domain (catch-all) inbox.
namerequireddomain_idfolder_idrequiredRename an inbound inbox.
namerequiredinbox_idrequiredfolder_idrequiredPermanently delete an inbound inbox.
inbox_idrequiredfolder_idrequiredList received messages in an inbound inbox (paginated). Pass `last_id` from a previous response to fetch the next page.
last_idinbox_idrequiredGet a single inbound message with its full body and attachment download URLs.
inbox_idrequiredmessage_idrequiredPermanently delete an inbound message.
inbox_idrequiredmessage_idrequiredReply to an inbound message (sends to the original sender). Sends a real email.
cctobccfromhtmltextheaderscategoryinbox_idrequiredreply_tomessage_idrequiredattachments+1 moreReply to an inbound message and copy the original's other recipients. Sends a real email.
cctobccfromhtmltextheaderscategoryinbox_idrequiredreply_tomessage_idrequiredattachments+1 moreForward an inbound message to new recipients (at least one `to` is required). Sends a real email.
cctorequiredbccfromhtmltextheaderscategoryinbox_idrequiredreply_tomessage_idrequiredattachments+1 moreList conversation threads in an inbound inbox (paginated), optionally filtered by `search` (subject or from/to/cc/bcc address). Pass `last_id` from a previous response to fetch the next page.
searchlast_idinbox_idrequiredGet a single inbound thread with its messages embedded (oldest first).
inbox_idrequiredthread_idrequiredPermanently delete an inbound thread.
inbox_idrequiredthread_idrequiredList the forward rules of an inbound inbox. Forward rules automatically forward copies of received messages to other addresses.
inbox_idrequiredGet a single inbound forward rule by ID, with its conditions and destinations.
inbox_idrequiredforward_rule_idrequiredCreate a forward rule on an inbound inbox. Received messages matching all `conditions` (none = every message) are forwarded to the `destinations`.
namerequiredinbox_idrequiredconditionsdestinationsUpdate an inbound forward rule. Only the provided fields change; a provided `conditions` or `destinations` array replaces the whole set (`[]` clears it).
nameinbox_idrequiredconditionsdestinationsforward_rule_idrequiredPermanently delete an inbound forward rule.
inbox_idrequiredforward_rule_idrequired90% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
docker run --rm -i \ -e MAILTRAP_API_TOKEN="${MAILTRAP_API_TOKEN}" \ -e MAILTRAP_ACCOUNT_ID="${MAILTRAP_ACCOUNT_ID}" \ -e DEFAULT_FROM_EMAIL="${DEFAULT_FROM_EMAIL}" \ -e MAILTRAP_SANDBOX_ID="${MAILTRAP_SANDBOX_ID}" \ -e MAILTRAP_ORGANIZATION_ID="${MAILTRAP_ORGANIZATION_ID}" \ -e MAILTRAP_ORGANIZATION_API_TOKEN="${MAILTRAP_ORGANIZATION_API_TOKEN}" \ mcp/mailtrapnpx -y smithery mcp add mailtrap/mailtrap-mcp --client claude{ "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_SANDBOX_ID": "your_sandbox_id" } } }}{ "mcpServers": { "mailtrap": { "command": "/Users/<username>/.asdf/shims/npx", "args": ["-y", "mcp-mailtrap"], "env": { "PATH": "/Users/<username>/.asdf/shims:/usr/bin:/bin", "ASDF_DIR": "/opt/homebrew/opt/asdf/libexec", "ASDF_DATA_DIR": "/Users/<username>/.asdf", "ASDF_NODEJS_VERSION": "22.14.0", "MAILTRAP_API_TOKEN": "your_mailtrap_api_token", "DEFAULT_FROM_EMAIL": "[email protected]", "MAILTRAP_ACCOUNT_ID": "your_account_id", "MAILTRAP_SANDBOX_ID": "your_sandbox_id" } } }}{ "mcp": { "servers": { "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_SANDBOX_ID": "your_sandbox_id" } } } }}# Build TypeScript and pack the MCPB bundlenpm run mcpb:pack
# Inspect bundle metadatanpm run mcpb:info
# Sign the bundle for distribution (optional)npm run mcpb:signgit clone https://github.com/mailtrap/mailtrap-mcp.gitcd mailtrap-mcpnpm install{ "mcpServers": { "mailtrap": { "command": "node", "args": ["/path/to/mailtrap-mcp/dist/index.js"], "env": { "MAILTRAP_API_TOKEN": "your_mailtrap_api_token", "DEFAULT_FROM_EMAIL": "[email protected]", "MAILTRAP_ACCOUNT_ID": "your_account_id", "MAILTRAP_SANDBOX_ID": "your_sandbox_id" } } }}{ "mcpServers": { "mailtrap": { "command": "/Users/<username>/.asdf/shims/node", "args": ["/path/to/mailtrap-mcp/dist/index.js"], "env": { "PATH": "/Users/<username>/.asdf/shims:/usr/bin:/bin", "ASDF_DIR": "/opt/homebrew/opt/asdf/libexec", "ASDF_DATA_DIR": "/Users/<username>/.asdf", "ASDF_NODEJS_VERSION": "22.14.0", "MAILTRAP_API_TOKEN": "your_mailtrap_api_token", "DEFAULT_FROM_EMAIL": "[email protected]", "MAILTRAP_ACCOUNT_ID": "your_account_id", "MAILTRAP_SANDBOX_ID": "your_sandbox_id" } } }}{ "mcp": { "servers": { "mailtrap": { "command": "node", "args": ["/path/to/mailtrap-mcp/dist/index.js"], "env": { "MAILTRAP_API_TOKEN": "your_mailtrap_api_token", "DEFAULT_FROM_EMAIL": "[email protected]", "MAILTRAP_ACCOUNT_ID": "your_account_id", "MAILTRAP_SANDBOX_ID": "your_sandbox_id" } } } }}npm run buildnpm run dev# List all toolsnpm run mcp:cli -- --method tools/list
# Call a tool — flags after the `--`npm run mcp:cli -- \ --method tools/call \ --tool-name get-template \ --tool-arg template_id=12345
# Multiple --tool-arg flags for tools with several paramsnpm run mcp:cli -- \ --method tools/call \ --tool-name send-sending-domain-setup-instructions \ --tool-arg sending_domain_id=3938 \ --tool-arg [email protected]# Run the MCPB server directlynode dist/mcpb-server.js
# Or use the provided binarymailtrap-mcpb-servernpm run dev:mcpb# Example: enable debug loggingDEBUG=true node dist/mcpb-server.js# Filter error logsnode dist/mcpb-server.js 2>&1 | jq 'select(.level == "error")'
# Filter debug logsnode dist/mcpb-server.js 2>&1 | jq 'select(.level == "debug")'