r/Playwright • u/Comfortable_Emu_7980 • 14h ago
I built MailGate: a self-hosted, receive-only OTP and magic-link inbox on Cloudflare Workers and D1 with Playwright SDK and MCP server
I built MailGate, a self-hosted, receive-only email inbox for verification codes and magic sign-in links running on Cloudflare Email Routing, Workers, and D1. It fits the free tier with no VPS or SMTP server to maintain.
I made it because I got tired of paying for hosted QA inbox services or keeping Mailhog running just to read OTP codes during Playwright authentication tests and Claude Code sessions.
What it includes:
Strict recipient allowlist at SMTP ingest and optional PBKDF2-SHA256 inbox passwords
Automatic OTP code and magic-link extraction that ignores calendar years in receipts
Defense-in-depth HTML sanitization rendered inside a sandboxed iframe with a strict CSP
Daily Cron Trigger auto-cleanup with configurable retention TTL
Zero-dependency TypeScript/JS SDK and Playwright fixture via mailgate-sdk/playwright
Built-in stdio MCP server via npx -y mailgate-sdk mcp, listed on the Official MCP Registry and rated B on Glama
GitHub (MIT): https://github.com/Dicka18/mailgate npm: https://www.npmjs.com/package/mailgate-sdk
Happy to answer any questions about running receive-only email on Cloudflare Workers and D1, or hear what features to add next.
