MCP server for OTP and 2FA testing

· 5 min read · QuickInbox team

  • OTP
  • 2FA
  • MCP

One-time passcodes protect signups and logins, which makes them one of the most important things to test. An MCP server lets an AI agent handle the email codes itself.

What the agent needs to do

  1. Use an address it can read.
  2. Trigger the code (sign up, log in, or turn on 2FA).
  3. Read the newest email and pull out the code.
  4. Type it in before it expires and check the result.

The QuickInbox MCP server covers steps 1 and 3. quickinbox_generate_test_address makes the address. quickinbox_get_verification returns the code from the newest matching email, so the agent doesn't have to search the text itself.

Example prompt

Our login sends a 6-digit code by email. With a new QuickInbox address:
sign up, log out, log in again, read the login code with
quickinbox_get_verification and enter it. Then wait 11 minutes and try the
same code again: it should be rejected.

Cases worth testing

  • Expiry: an old code is refused.
  • Reuse: a code works only once.
  • Resend: after "Send a new code", only the newest code works.
  • Wrong code: several wrong tries lock the form or slow it down, as you designed.

What about SMS codes?

The MCP tools read email. For SMS codes, QuickInbox gives paid plans a real US phone number, and your tests read its texts with the REST API. See SMS OTP in Playwright and the SMS testing page.

Tips

  • Use a new address per run so the agent never picks up an older code.
  • Tell the agent your code format (for example "6 digits") if your emails contain other numbers.
  • Keep production 2FA settings in your test environment, otherwise you're not testing what users get.

Writing code instead of using an agent? See how to test email OTP and 2FA codes.

Related guides

Try it: the QuickInbox MCP server is included on every plan, including the free plan with 5,000 emails a month. Create a free account, make an API key and connect your agent in two minutes.

← All articles