Docs

Install Stuntmail on your Cloudflare account, connect your agent over MCP, and use the REST API.

Overview

Stuntmail gives your AI agents unlimited throwaway inboxes on a test domain you own. It runs in your own Cloudflare account. You get a dashboard to see every inbox and email, an MCP server your agent connects to, and a REST API for scripts and CI, all behind one API key.

It only receives. Your app keeps sending through its usual provider; the mail goes to a real address on your test domain and shows up in Stuntmail.

Prerequisites

  • Node.js, to run the installer with npx.
  • A Stuntmail license key. It is emailed to you right after checkout and stays in your Polar customer portal. Just bought it? See Start here.
  • A Cloudflare account and a domain used only for testing, added to Cloudflare. Any cheap domain works. It has to be a whole domain, not a subdomain of your main one.
  • A Cloudflare API token. The installer opens the token page for you with everything filled in, so you only confirm it and paste the token back.

The installer refuses a domain that already receives email somewhere else, so your real mail is never touched.

Install

Run the installer from any folder:

bash
npx stuntmail@latest

It asks for your license key, the Cloudflare API token and the domain, then sets everything up in about two minutes. It checks before it changes anything, and you can run it again at any time: if an install stops halfway, the same command picks up where it left off.

At the end it prints the dashboard URL, the MCP URL and your API key (also copied to the clipboard).

Non-interactive mode

For CI or scripted setups, pass everything as flags:

bash
npx stuntmail@latest --license <key> --token <cloudflare-api-token> --domain testmail.dev --yes
FlagDoes
--licenseYour license key.
--tokenA Cloudflare API token, skipping the browser step.
--domainThe test domain that receives mail.
--accountCloudflare account id, when the token can see several.
--hostnameHostname for the dashboard, API and MCP (default inbox.<domain>).
--yesNever prompt: fail with a clear message instead. The API key is not printed; use npx stuntmail key show.

Other commands

CommandDoes
npx stuntmailInstall, or finish an install that stopped.
npx stuntmail updateUpdate to the latest version.
npx stuntmail statusShow the domain, version, inbox count and health.
npx stuntmail key showPrint the API key.
npx stuntmail key rotateIssue a new API key and revoke the old one.
npx stuntmail uninstallRemove Stuntmail from your Cloudflare account, asking before it deletes your mail.

Connect your agent

The quickest way is the dashboard: open Connect an agent, pick your agent and copy the prompt or the snippet. Your URL and key are already filled in.

To do it by hand, the MCP server is at /mcp on your Stuntmail address and takes the same key as the API. Replace <domain> and <key> with the values the installer printed. If a config file already lists servers, add the stuntmail entry next to them.

Claude Code

Run in your terminal:

bash
claude mcp add stuntmail https://inbox.<domain>/mcp --transport http --header "Authorization: Bearer <key>"

Run /mcp in Claude Code to see the tools.

Codex

Add to ~/.codex/config.toml:

~/.codex/config.toml
[mcp_servers.stuntmail]
url = "https://inbox.<domain>/mcp"
http_headers = { Authorization = "Bearer <key>" }

Run codex mcp list to check it.

Cursor

Add to ~/.cursor/mcp.json, or .cursor/mcp.json in a project:

~/.cursor/mcp.json
{
  "mcpServers": {
    "stuntmail": {
      "url": "https://inbox.<domain>/mcp",
      "headers": {
        "Authorization": "Bearer <key>"
      }
    }
  }
}

Open Cursor Settings, MCP, to see the tools.

Gemini CLI

Add to ~/.gemini/settings.json:

~/.gemini/settings.json
{
  "mcpServers": {
    "stuntmail": {
      "httpUrl": "https://inbox.<domain>/mcp",
      "headers": {
        "Authorization": "Bearer <key>"
      }
    }
  }
}

Run /mcp in Gemini CLI to see the tools.

OpenCode

Add to opencode.jsonc in your project:

opencode.jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "stuntmail": {
        "type": "remote",
        "url": "https://inbox.<domain>/mcp",
        "oauth": false,
        "headers": {
          "Authorization": "Bearer <key>"
        }
      }
    }
  }
}

Run opencode mcp list to check it.

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

mcp_config.json
{
  "mcpServers": {
    "stuntmail": {
      "serverUrl": "https://inbox.<domain>/mcp",
      "headers": {
        "Authorization": "Bearer <key>"
      }
    }
  }
}

Refresh the MCP list in Cascade.

VS Code

Add to .vscode/mcp.json in your project:

.vscode/mcp.json
{
  "servers": {
    "stuntmail": {
      "type": "http",
      "url": "https://inbox.<domain>/mcp",
      "headers": {
        "Authorization": "Bearer <key>"
      }
    }
  }
}

Run MCP: List Servers from the command palette.

Other clients

Any client that can reach a remote MCP server over streamable HTTP with a custom header works. Give it the URL https://inbox.<domain>/mcp and the header Authorization: Bearer <key>.

MCP tools

Your agent sees each tool and its inputs when it connects, so you rarely call them by name. Use a run to group the inboxes of one test and delete them together.

ToolDoes
create_inboxMake a new address, optionally with a label or as part of a run.
create_inboxesMake many addresses in one call, for a test run.
list_inboxesList addresses with their unread counts.
wait_for_emailWait for the next matching email, by sender or subject.
list_emailsList the emails in an inbox, newest first.
read_emailRead one email as text, with its links and code.
get_verification_linkGet the confirmation or sign-in link from an email.
get_verification_codeGet the one-time code from an email.
delete_emailDelete one email. The inbox keeps receiving.
delete_inboxDelete an inbox and its mail.
delete_runDelete every inbox in a run.

REST API reference

Base URL is your Stuntmail address, for example https://inbox.<domain>. Every route except /api/health needs the header Authorization: Bearer <api key>. Requests without a valid key get 401.

MethodPathDoes
POST/api/inboxes
body: { local_part?, label?, ttl_hours?, run? }
Create an inbox (random or chosen local part). Returns the inbox.
POST/api/inboxes/batch
body: { count, run?, labels? }
Create up to 100 inboxes at once.
GET/api/inboxes?run=List inboxes with unread counts, optionally filtered by run.
DELETE/api/inboxes/:addressDelete an inbox and its emails.
GET/api/inboxes/:address/emails?limit=List emails in an inbox, newest first.
GET/api/emails/:idOne full email: text, html, links, extracted code and attachments. Marks it read.
GET/api/emails/:id/rawThe original message source, without attachments.
GET/api/emails?limit=Newest emails across all inboxes, with snippet and code.
DELETE/api/emails/:idDelete one email.
DELETE/api/inboxes?confirm=allDelete every inbox and email (clean slate).
GET/api/inboxes/:address/wait?from=&subject_contains=&since=&timeout_s=Wait up to 25 s for a matching email. 200 with the email, or 204 if none arrived.
GET/api/runsList test runs.
DELETE/api/runs/:runDelete every inbox in a run and its emails.
GET/api/settingsHow long mail is kept, in days, and whether a worker variable fixes it.
PUT/api/settingsSet retention_days, a whole number from 1 to 365.
GET/api/healthVersion and status. No auth needed.

Example

bash
# Create an inbox for a test run
curl -X POST https://inbox.<domain>/api/inboxes \
  -H "Authorization: Bearer <key>" \
  -H "Content-Type: application/json" \
  -d '{"label":"signup","run":"ci-1234"}'

# Wait for the verification email (returns 204 if nothing arrives in time)
curl "https://inbox.<domain>/api/inboxes/<address>/wait?subject_contains=Verify&timeout_s=25" \
  -H "Authorization: Bearer <key>"

# Clean up the whole run
curl -X DELETE https://inbox.<domain>/api/runs/ci-1234 \
  -H "Authorization: Bearer <key>"

The wait endpoint holds the request open for up to 25 seconds. To wait longer, call it again after a 204.

Your data

  • Mail stays in your own Cloudflare account. It never reaches us.
  • Mail is kept for 7 days by default. Change it in the dashboard under Settings, Keep mail for: 1, 3, 7 or 30 days.
  • Stuntmail never sends email.
  • Attachments are not kept. The dashboard shows which files an email had, by name and size.