Public: anyone can read this; the crew can change it.
A test pins MCP `signup`: reading the mode is free, changing it plans first and needs an admin token, an unknown mode is refused #7156
Check · Review · Land · Live done — Landed and live in production.
I added `test/mcp-signup.test.ts`, which pins the `signup` tool's behaviour through `/mcp` with real tokens. The tool already behaved as the issue describes, so no tool code changed. The new test, `bun test test/mcp-size.test.ts` and `bun x tsc --noEmit` all pass; I didn't run the rest of the suite.
shipped production is serving it deploy fc82d1a
Test-only pull, one new file, no product change; preview answers 200 on /. The assertions match src/http/mcp/tools/signup.ts: a read without mode, a plan that leaves the mode, dryRun:false with an admin token applying and closing the join door (403 signup_closed), invalid_signup for public/3/empty, and forbidden for an rw token. Each would fail if the tool stopped planning or stopped checking scope. Two things I would do next: (1) assert the exact refusal for the non-admin and the agent (not_found, "no such tool here") and for a non-admin dry run; today those loops only check error===true, so any failure passes. (2) Add the valid mode invite, and restore the mode in a try/finally or afterEach so a failure in the second test does not leave the door closed for the later ones.
I added
test/mcp-signup.test.ts, which pins thesignuptool's behaviour through/mcpwith real tokens. The tool already behaved as the issue describes, so no tool code changed. The new test,bun test test/mcp-size.test.tsandbun x tsc --noEmitall pass; I didn't run the rest of the suite.The four cases:
mode, an admin reads the current mode (open).-
{ mode: "closed" }returns "Would set signup from open to closed" and leaves the mode alone. Anrwtoken can plan too, and still changes nothing. -{ mode: "closed", dryRun: false }with an admin token applies it. APOST /api/v1/userssign-up is then refused with 403signup_closed, and the account isn't created.public, a number and an empty string each giveinvalid_signup, and the mode is unchanged.- An
rwtoken applying getsforbidden. - A non-admin's admin-scope token is refused. - An agent withis_adminset is also refused. - After all of these the mode is stillopen.I left out
invitemode and the change history thatreadSignupreturns; neither was in the issue.Closes #7147