Announcing CIMD support for MCP Client registration
Learn more

Should you use Mailtrap MCP or Mailtrap API for building AI Agents?

Nishant Choudhary
Tech Evangelist

TL;DR

  • Mailtrap authenticates both paths with the same object: a static, non-expiring API token. Unlike Notion or Slack, the MCP path does not force OAuth; Mailtrap has no OAuth for third-party apps at all. Auth method is not what separates the two.
  • The official MCP server (the open-source mcp-mailtrap package, still pre-1.0 at v0.9.0) is a local process you run and point at one API token. There is no hosted, remote Mailtrap MCP endpoint.
  • Capability coverage is close: the MCP server exposes over 100 tools, Scalekit's connector 92, and the REST API is the superset both wrap. Coverage rarely decides the choice; deployment and credentials do.
  • One static token per MCP config means every user of that agent shares one Mailtrap account. For a multi-tenant B2B agent sending on behalf of many customers, that is the blocker. The API path fixes it only if you build per-user token storage, rotation, and revocation yourself.
  • Scalekit's Mailtrap connector resolves a per-user token on every call, keeps it in a token vault, and can expose a scoped Virtual MCP endpoint, so the MCP vs API choice does not change your auth infrastructure.

Your agent needs to send email through Mailtrap: the order confirmation after checkout, the password reset, the test run you inspect before a launch. Mailtrap ships an official MCP server and a full REST API, and at a glance they look like two routes to the same destination. They are not. They deploy differently, they isolate users differently, and one of those differences decides whether your agent survives its second tenant. Here is how to pick.

What Mailtrap MCP and Mailtrap API actually are

Both paths call the same backend and carry the same kind of token. What differs is where the code runs and what it was built for.

Mailtrap's official MCP server

Mailtrap distributes its official MCP server as the open-source mcp-mailtrap package, maintained by Mailtrap. It first shipped in April 2025 and is still pre-1.0 (v0.9.0 as of September 2026). It runs as a local process: your MCP host, such as Claude Desktop, Cursor, or VS Code, launches it and talks to it over standard input and output. There is no remote URL to point an agent at.

Authentication is a static API token supplied through an environment variable, MAILTRAP_API_TOKEN, alongside MAILTRAP_ACCOUNT_ID for most read operations. The token does not expire. It is the same credential you would use against the REST API, sitting in a config file instead of a request header.

The Mailtrap REST API

The Mailtrap REST API is a standard HTTPS interface authenticated with an API token, sent as either the Api-Token header or Authorization: Bearer. Tokens have no expiration date and are reset manually; a token can be scoped to specific resources with access levels. Official SDKs exist for Node.js, Python, Ruby, PHP, Elixir, and Java.

The surface is broad: transactional and bulk sending, sandbox testing, templates, sending domains, suppressions, stats and email logs, contacts and campaigns, inbound email, and account management. It is the full surface that both the MCP server and Scalekit's connector wrap.

Comparing them where it matters for agents

For a Mailtrap agent, three things matter: what it can do, how it authenticates, and what you operate in production. Coverage turns out to be the least interesting of the three.

What your agent can actually do

The email actions line up across all three paths. The differences are structural, not functional, so a capability table is most useful when it also shows the operational rows.

Capability
Official Mailtrap MCP
Mailtrap REST API
Scalekit connector
Send transactional email
Yes
Yes
Yes (mailtrap_send_email)
Send bulk or marketing email
Yes
Yes
Yes (mailtrap_send_bulk_email)
Sandbox testing: send and inspect
Yes
Yes
Yes (mailtrap_sandbox_send_email)
Spam score and HTML analysis
Yes
Yes
Yes (mailtrap_get_message_spam_report)
Templates, domains, suppressions
Yes
Yes
Yes
Contacts, lists, campaigns
Yes
Yes
Yes
Inbound email, logs, and stats
Yes
Yes
Yes
Runs as a hosted endpoint
No
Yes
Yes
Per-user credential at call time
No
Manual
Yes
Scoped, least-privilege tool surface
No
Manual
Yes
Per-user audit trail of sends
No
Manual
Yes

The rows that separate the paths sit at the bottom of that table: where the code runs, whose credential each call carries, and whether every send is attributable. That is the real comparison for an agent, and it is why coverage rarely decides anything here.

The auth path each one puts you on

This is where Mailtrap breaks from the usual MCP-versus-API story. With Notion, Slack, or GitHub, the MCP path forces browser-based OAuth and the direct API lets you choose. Mailtrap offers no OAuth for third-party apps, so both paths present the same static API token.

On the MCP path, that token lives in the host config as an environment variable. On the API path, you attach it to each request. Same credential, same permissions, different place it sits. A non-expiring token in a config file is the credential you least want to leak, because nothing retires it on its own.

A token per config, not per user

You can narrow a Mailtrap token to specific resources, but that scopes it to a project or a domain, not to an individual end user. Both paths hand you a token per configuration, not a token per user. In a multi-tenant agent, that distinction is the whole game, and it is exactly the gap Scalekit's connected-account model is built to close.

What you own in production

On the MCP path, you run and supervise a local subprocess inside each host, and you manage the single token it carries. Because the server is local and single-token, it fits a developer's own machine well and a shared backend poorly.

On the API path, you own the full stack: request construction, pagination, retries, error handling, and the entire token lifecycle. Since Mailtrap tokens never expire, rotation and revocation are entirely your responsibility; there is no expiry to lean on.

Observability is the quiet cost on both paths. Mailtrap's own logs show the account a token belongs to, not the end user an agent acted for. If ten customers share one token, the log shows one account, and the send that mattered is indistinguishable from the rest.

When to use MCP, when to use the API

Use the official Mailtrap MCP server when:

  • You are wiring Mailtrap into an interactive coding host such as Claude Desktop, Cursor, or VS Code, for your own account
  • You want to send test emails, inspect sandbox messages, or check a spam score from your editor without writing API code
  • The agent is single-user and single-account, and one static token in a local config is acceptable
  • You are prototyping and want the tools available in the host immediately

Use the Mailtrap REST API directly when:

  • Your agent runs on a backend or a schedule, with no desktop host to launch a local process
  • You are sending on behalf of multiple customers, each with their own Mailtrap account or domain, and need a different token per tenant
  • You need deterministic control over retries, pagination, and request behavior
  • You want to attach per-request identity and build your own audit trail

The credential problem that exists on both paths

Strip away the transport and both paths leave the same gap: a Mailtrap token still has to be stored, resolved to the right user, and revoked when access ends. Neither path does that for you.

One static token cannot serve many tenants

The MCP server binds one token per config, so every run authenticates as that account. The API lets you pass a different token per request, but only if something resolves the right token for the current user first. With fifty customers you have fifty Mailtrap tokens to keep straight, and the path you picked does not keep them for you.

Non-expiring tokens make revocation your job

Because Mailtrap tokens never expire, there is no natural point at which a leaked or stale token stops working. When a customer churns or an employee leaves, someone has to find and reset every token tied to that relationship. A token generated months ago and left in a config keeps sending until you kill it. This is the same structural risk described in secure token management for AI agents at scale.

Where Scalekit fits

Scalekit's Mailtrap connector stores each user's Mailtrap token in a token vault, resolves it per identifier at call time, and keeps credentials out of the agent runtime. The same infrastructure works whether you call tools directly or expose them through a Virtual MCP endpoint, so the MCP-versus-API decision stops touching your auth layer.

Building a Mailtrap agent with Scalekit

Scalekit exposes Mailtrap as a single API connector, using Bearer Token auth with 92 prebuilt tools. There is no separate Mailtrap MCP connector to choose between; you get MCP-shaped access when you want it through a Virtual MCP server. The walkthrough below is Python with the Claude SDK, and it runs discovery, then scope, then execution.

Register a per-user Mailtrap credential

Create a connection named mailtrap in the Scalekit dashboard first, and set SCALEKIT_ENVIRONMENT_URL, SCALEKIT_CLIENT_ID, and SCALEKIT_CLIENT_SECRET. The connection_name in your code must match the connection you created, or tool calls resolve to nothing.

Because Mailtrap uses a token rather than OAuth, you attach each user's Mailtrap API token to their identity once, instead of running a browser consent flow.

pip install scalekit-sdk-python anthropic
import os from scalekit.client import ScalekitClient scalekit = ScalekitClient( env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"), client_id=os.getenv("SCALEKIT_CLIENT_ID"), client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"), ) actions = scalekit.actions # Link this user's Mailtrap API token to their identity (once per user). scalekit.connect.upsert_connected_account( connection_name="mailtrap", identifier="user_123", credentials={"token": "user-123-mailtrap-api-token"}, )

Load only the tools this user is authorized to call

Before the agent runs, ask Scalekit for the tools this user's connected account can call. You get back Mailtrap tools scoped to that identity, already in the schema shape Claude expects, rather than a flat catalog of everything Mailtrap can do.

from google.protobuf.json_format import MessageToDict scoped_response, _ = actions.tools.list_scoped_tools( identifier="user_123", filter={"connection_names": ["mailtrap"]}, page_size=100, # fetch beyond the default page so no tools are missed ) tools = [ { "name": MessageToDict(t.tool).get("definition", {}).get("name"), "description": MessageToDict(t.tool).get("definition", {}).get("description", ""), "input_schema": MessageToDict(t.tool).get("definition", {}).get("input_schema", {}), } for t in scoped_response.tools ]

Run the agent loop

Pass those tools to Claude and run the tool-use loop. When Claude calls a tool, execute it through Scalekit with the user's identifier, and Scalekit resolves that user's Mailtrap token, makes the call, and returns the result.

import anthropic client = anthropic.Anthropic() messages = [ {"role": "user", "content": "Send an order confirmation to jane@example.com for order 1234"} ] while True: response = client.messages.create( model="claude-sonnet-4-6", max_tokens=1024, tools=tools, messages=messages, ) if response.stop_reason == "end_turn": print(response.content[0].text) break tool_results = [] for block in response.content: if block.type == "tool_use": result = actions.execute_tool( tool_name=block.name, # e.g. mailtrap_send_email identifier="user_123", tool_input=block.input, ) tool_results.append({ "type": "tool_result", "tool_use_id": block.id, "content": str(result.data), }) messages.append({"role": "assistant", "content": response.content}) messages.append({"role": "user", "content": tool_results})

Every send in that loop runs against the user_123 Mailtrap token, resolved at call time; the agent code never sees the credential.

Scope the surface with a Virtual MCP server

The official server exposes over 100 tools, and an email agent needs maybe five. Loading all of them costs tokens on every turn and gives the model more ways to pick the wrong one. A server with 40 tools at roughly 200 tokens each burns about 8,000 tokens before the agent does any work, and Mailtrap's surface is larger than that.

A Scalekit Virtual MCP server lets you define one endpoint that exposes only the Mailtrap tools this agent role needs, for example mailtrap_send_email and mailtrap_list_email_logs, and nothing else. One server definition serves every user; each run gets a short-lived session token scoped to that user's connected account, so there is no MCP server for you to deploy or host. This is part of why MCP can be significantly more expensive than CLI without careful tool scoping.

{ "mcpServers": { "mailtrap": { "transport": "streamable-http", "url": "your-scalekit-mcp-url" } } }

See every send in the audit log

Because every call runs through a connected account tied to an identity, Scalekit records which user each Mailtrap action ran for. For a tool that sits at the end of the chain, that answers the question raw API logs cannot: did the agent send that password reset as customer A's account or customer B's, and who authorized it. The reasoning behind that model is in the posts on agent tool observability and audit trails for agent auth.

Which one to build against

The choice tracks one question: who is your agent sending on behalf of?

If the agent is yours, running in your editor against your own Mailtrap account, the official MCP server is the fastest route. Install it, point it at a token, and send from Claude Desktop or Cursor in minutes.

If the agent sends on behalf of customers, each with their own Mailtrap account, the single-token local server does not fit, and the raw API leaves you to build storage, rotation, and revocation for non-expiring tokens by hand. Put a per-user connected-account layer under either path; that is the part that must be production-grade, whether you call tools directly or through MCP. Understanding credential ownership across agent tool-calling patterns helps clarify why this layer matters.

Recommended Reading: MCP vs APIs: how are they different

Build Mailtrap agents with Scalekit

Start with the connector, scope it to your agent, then check the numbers before you scale.

Read the Scalekit Mailtrap connector docs for the full tool list and setup, see what the connected-account model unlocks on the AgentKit product page, and review the pricing page before you move to production.

For patterns that lean on transactional email, look at the outbound prospecting agent, the support ticket automation agent, and the incident response agent.

Talk to a Scalekit engineer

Building a Mailtrap agent and want a second pair of eyes on the auth model? Join the Scalekit community on Slack, or talk to us for immediate help.

No items found.
Agent
Auth Quickstart
On this page
Share this article
Agent
Auth Quickstart

Acquire enterprise customers with
‍zero upfront cost.

Every feature unlocked. No hidden fees.