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:
npx stuntmail@latestIt 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:
npx stuntmail@latest --license <key> --token <cloudflare-api-token> --domain testmail.dev --yes| Flag | Does |
|---|---|
| --license | Your license key. |
| --token | A Cloudflare API token, skipping the browser step. |
| --domain | The test domain that receives mail. |
| --account | Cloudflare account id, when the token can see several. |
| --hostname | Hostname for the dashboard, API and MCP (default inbox.<domain>). |
| --yes | Never prompt: fail with a clear message instead. The API key is not printed; use npx stuntmail key show. |
Other commands
| Command | Does |
|---|---|
| npx stuntmail | Install, or finish an install that stopped. |
| npx stuntmail update | Update to the latest version. |
| npx stuntmail status | Show the domain, version, inbox count and health. |
| npx stuntmail key show | Print the API key. |
| npx stuntmail key rotate | Issue a new API key and revoke the old one. |
| npx stuntmail uninstall | Remove 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:
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:
[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:
{
"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:
{
"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:
{
"$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:
{
"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:
{
"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.
| Tool | Does |
|---|---|
| create_inbox | Make a new address, optionally with a label or as part of a run. |
| create_inboxes | Make many addresses in one call, for a test run. |
| list_inboxes | List addresses with their unread counts. |
| wait_for_email | Wait for the next matching email, by sender or subject. |
| list_emails | List the emails in an inbox, newest first. |
| read_email | Read one email as text, with its links and code. |
| get_verification_link | Get the confirmation or sign-in link from an email. |
| get_verification_code | Get the one-time code from an email. |
| delete_email | Delete one email. The inbox keeps receiving. |
| delete_inbox | Delete an inbox and its mail. |
| delete_run | Delete 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.
| Method | Path | Does |
|---|---|---|
| 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/:address | Delete an inbox and its emails. |
| GET | /api/inboxes/:address/emails?limit= | List emails in an inbox, newest first. |
| GET | /api/emails/:id | One full email: text, html, links, extracted code and attachments. Marks it read. |
| GET | /api/emails/:id/raw | The original message source, without attachments. |
| GET | /api/emails?limit= | Newest emails across all inboxes, with snippet and code. |
| DELETE | /api/emails/:id | Delete one email. |
| DELETE | /api/inboxes?confirm=all | Delete 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/runs | List test runs. |
| DELETE | /api/runs/:run | Delete every inbox in a run and its emails. |
| GET | /api/settings | How long mail is kept, in days, and whether a worker variable fixes it. |
| PUT | /api/settings | Set retention_days, a whole number from 1 to 365. |
| GET | /api/health | Version and status. No auth needed. |
Example
# 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.