Mailosaur MCP.
An MCP tool for email testing that wraps Mailosaur's API. Made automation specs — and AI agents — able to assert against transactional emails (OTPs, order confirmations, password resets) without writing per-spec polling glue. Built during Lotusflare.
Every spec was rewriting email-polling glue.
Mailosaur is great. But you don't want every automation spec writing its own "poll for an OTP email, parse it, extract the code, return it." That's a pattern.
And once we started running AI agents (Codex / browser-use harnesses), the cost of not having a clean tool for this became obvious — agents kept hallucinating shell commands to grep through stdout.
The MCP surface.
wait_for_email
Wait for an email matching filters (to, subject, body regex) with a configurable timeout. Returns the full message or times out cleanly.
extract_otp
Wait, then regex out a 4–8 digit code. The default pattern works for most transactional templates.
extract_link
Wait, then return the first (or named) link from the email body. Handy for password resets and activation flows.
delete_messages
Clear the test inbox before a run so flaky leftovers don't poison the next spec.
list_inbox
For debugging — show the agent what's actually in the inbox when a wait fails.
What a Playwright spec calls.
// before · per-spec polling glue const message = await mailosaur.messages.search({ server: SERVER_ID, sentTo: email, timeout: 30000, errorOnTimeout: true, }); const otp = message.html.codes[0].value; // after · one tool call from anywhere (spec or agent) const otp = await mcp.call('mailosaur.extract_otp', { to: email, timeout: 30000 });
Then we replaced Mailosaur entirely.
The MCP layer's quiet win: once it abstracted Mailosaur behind a tool, swapping the backend was a small change. We migrated email testing to a budget-friendly Gmail + Google Groups setup — same MCP surface, team-wide inbox visibility, lower bill.
The specs didn't change. The agents didn't notice. That's the whole pitch.