Docs Sign in Get started

MCP for agents

A hosted MCP server, so an agent can create traps, wait for what lands, and pull values out of it — without you writing any glue.

Connecting

Add this URL as an MCP server in your client:

https://mcp.trapit.io/mcp

Your client will send you here to sign in and approve the connection. There is no API key to paste: the client registers itself, and the token it gets is scoped to your workspace and refreshed automatically, so the connection keeps working without you touching it again.

Works with anything that speaks MCP — Claude, ChatGPT, Cursor, VS Code, Claude Code. Desktop clients that use a loopback callback need no configuration on our side; hosted clients are recognised by origin.

Tools

Creating traps

  • create_sandbox — one trap for both kinds, usable immediately. Returns the SMTP host, port, username and password to point an app at, and the capture URL for webhooks. Optionally ephemeral, which expires it by itself.
  • set_mock_response — the status, headers and body a sandbox replies with over HTTP. Omit pathPattern to set the catch-all every request gets; supply one (a regex over the request path, e.g. ^/webhooks/stripe$) to answer just those requests differently. Rules are matched top-down, and new ones are inserted ahead of the catch-all.
  • list_mock_responses — the sandbox's rules in the order they are matched.
  • delete_mock_response — drop a rule by its path pattern; the requests it used to answer fall through to the next match. The catch-all can't be deleted.

Mail is routed by the credentials a sender authenticates with, never by the recipient address. So an agent does not invent an address to sign up with — it configures the app under test with the sandbox's username and password, and whatever address the signup uses is trapped regardless.

Waiting for what lands

  • wait_for_email — blocks until a message arrives, with optional subject and sender substring filters plus an exact to filter (the envelope recipient). Returns an already-captured match immediately, so there is no race against a fast sender.
  • wait_for_request — the same, filtered by method and path.
  • get_latest_email / get_latest_request — the most recent, without waiting.

Pulling values out

  • extract_otp — finds a one-time passcode in the prose of an email.
  • extract_magic_link — the verification URL, query string intact.
  • extract_from_body — a value from a captured JSON body by dotted path (user.id, items.0.name).

Asserting

  • assert_email / assert_request — check the latest against subject, sender, method, path or body criteria. They return a pass/fail with the reason it failed, so a red test says what was actually wrong.

Housekeeping

  • clear_emails / clear_requests — empty one of a sandbox's two streams between runs. They stay separate, so clearing mail never discards captured webhooks.
  • whoami — which workspace this connection is bound to. ping — liveness.

A typical loop

"Create a throwaway sandbox, point staging's mailer at it, sign up, wait for the verification email, extract the code, submit it, then assert the welcome email arrived."

That is create_sandboxwait_for_emailextract_otpassert_email. The sandbox is its own isolated trap, so parallel runs cannot see each other's mail whatever addresses they use, and an ephemeral one expires on its own — no cleanup step to forget.

These tools read one-time passcodes and magic links out of captured mail. Only connect clients you trust, and only approve a connection you started yourself.