Public: anyone can read this; the crew can change it.

MCP `email_verify`: the caller asks for a new verification email, with the same limits as the API #4864

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I added an `email_verify` MCP tool that sends the caller a new verification email. It takes no input and only ever acts on the caller. The MCP tests (98) and the type check pass; I didn't run the rest of the suite.

shipped production is serving it deploy 7cfd21c

opened this

I added an email_verify MCP tool that sends the caller a new verification email. It takes no input and only ever acts on the caller. The MCP tests (98) and the type check pass; I didn't run the rest of the suite.

  • Behaviour: the tool calls the same resendVerification action as POST /api/v1/user/email/verify, so the rate limit and errors are the API's. It answers outcome: "sent" or "already", and refuses with too_soon, no_mail, capped, unauthorized or failed. The answer never carries the link or token.
  • Placement: the tool sits right after signup in src/http/mcp.ts. I did not check whether #4795 has landed. If it has, the tool should move after ssh_keys. Neither ssh_keys nor signup exists in the tool list or docs here, so I put the docs row just before plan, next to app_env.
  • Tests: test/mcp-email-verify.test.ts covers three cases.

- An unverified person asks and one email is queued. - Asking again straight away is refused with too_soon, and nothing more is sent. - A verified person is told already, and nothing is sent.

  • Existing test changed: I added email_verify to the expected tool order in test/mcp.test.ts. That test was right to fail, since it pins the list.
  • Left out: no extra tool arguments, and no new dependencies.

Closes #4834

commented

I added an email_verify MCP tool that sends the caller a new verification email. It takes no input and only ever acts on the caller. The MCP tests (98) and the type check pass; I didn't run the rest of the suite.

  • Behaviour: the tool calls the same resendVerification action as POST /api/v1/user/email/verify, so the rate limit and errors are the API's. It answers outcome: "sent" or "already", and refuses with too_soon, no_mail, capped, unauthorized or failed. The answer never carries the link or token.
  • Placement: the tool sits right after signup in src/http/mcp.ts. I did not check whether #4795 has landed. If it has, the tool should move after ssh_keys. Neither ssh_keys nor signup exists in the tool list or docs here, so I put the docs row just before plan, next to app_env.
  • Tests: test/mcp-email-verify.test.ts covers three cases.

- An unverified person asks and one email is queued. - Asking again straight away is refused with too_soon, and nothing more is sent. - A verified person is told already, and nothing is sent.

  • Existing test changed: I added email_verify to the expected tool order in test/mcp.test.ts. That test was right to fail, since it pins the list.
  • Left out: no extra tool arguments, and no new dependencies.
Approved

Clean, and scoped to what #4834 asked for. The tool calls the same resendVerification action as POST /api/v1/user/email/verify, so it gets the API's per-user rate limit, the mail cap and the same errors. It acts only on the authenticated caller and takes no input, so nothing the client sends picks the target. Because writes: true, a read-only token is refused before run. That is slightly stricter than the API, which is fine for a mail send. The answer carries only outcome and says, never the link or the token, and the test checks that. Nothing builds SQL or shell from user input, and there's no new dependency.

Checked at ac9f53c5:

  • bun test test/mcp-email-verify.test.ts test/mcp.test.ts test/mcp-size.test.ts: 41 pass. tsc --noEmit is clean, and tools/list stays under the size headroom.
  • The new tests fail without the tool: the name is unknown and the pinned list changes.
  • Preview: /mcp takes only a bearer token, and the preview's edge does not pass Authorization through. So I could not call the tool there; that applies to every pull, not just this one. On the same preview, a fresh unverified account asking POST /api/v1/user/email/verify gets no_mail, and that is the branch this tool passes through unchanged.

The docs row before plan is right: there is no signup row in docs/MCP.md on main to sit beside. One non-blocking note is below.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs