Public: anyone can read this; the crew can change it.
Access 3b: MCP, pages, the terminal, games and infrastructure ask may(), one door per pull #18186
Merged 5h 54m ago, live in production
This pull moves the MCP door of Access 3b (#18092) onto may(). It is the first of the issue's boxes, since the issue asks for one door per pull. What changed New action forge.write in src/core/may.ts: "Change something as your account".
-
Reviews
ApprovedClean on security. Every MCP admin gate and write gate now goes through may() (adminAccount, mayToolWrite). Identity is still the resolved account and credential, never a client-typed value. The old scope floor runs beside may() and disagreements are counted. may()'s answer decides, and anonymous callers are refused. needsAdminScope correctly stays a scope check. The new gate rule bites on a new inline isAdmin or rw check, and the tests pin guest, member, admin and each token kind. The No door line covers the terminal, since only the can list changed, and the how-to is in docs/features/may.md, not the README. I did not exercise the preview. Only box 1 is done here; the rest are other doors for later pulls.
-
Checks
shipped production is serving it deploy a338207
-
History
- The visible() unit test's fake context carries an app, as the MCP door now asks may with its db 451bfc6
- Access 3b, MCP: adminOnly and writes ask may(), shadowed beside the old scope floor 9e6f9ad
- Access 3a: the /api/v1 repository routes ask may(), shadowed first, then their inline checks go (#18165) 7ba81ba
- Spark's config is installed with the mod so a profile uploads to the forge and never elsewhere (#18173) 7de2fc0
- Games survival step 3b: a sleep (night-skip) mod in the quality set (#18172) 56e2b82
- Automate a review finding as a lint or test: One high finding, then smaller ones, all for one round. (#18167) f6eb779
- A spark profile decodes to a summary: call tree, slowest ticks, per-mod time, GC and memory (#18144) e30e2b6
- Access 4b: the 'Who may do what' page, linked from settings, by person and by resource (#18131) 3ecccb5
- "asks ledger failed: database is locked" two minutes after a release (v0.7.733) (#18169) 009df15
- Traces 4: a Claude Code session file imports as a trace and is listed beside the others (#18129) 68f0754
- A game box stores spark profiles in the forge: POST /post gives a Location, reads need the box's game grants (#18146) b992c0d
- Games survival step 3: quality-of-life mods tried on a copy first (graves, essential-commands, sleep, harvest, vein miner, styled-chat) (#18145) f058287
- Spend 1: a monthly budget per cloud account, one notice at 80% and one at 100% (#18121) 3382c40
- Games: a proxy plugin update can wait until nobody has been on for 30 minutes (#18039) 9a5eb31
- Traces 5: compare two traces, and share one with secrets redacted (#18017) 7a17314
- AWS writes for mail setup are a named allowlist beside the read rule, and nothing else (#18142) 93c7c3d
- Traces 1c: GET /api/v1/traces/:id returns the thread, turns and steps as one tree (#18128) 077bab0
- A box's TPS and tick time show live on its games pane, from spark's health report or `/spark tps` at check-in (#18143) f7e559b
- Access 4c: the grants view as an MCP tool and a terminal screen (#18130) 89afadf
- small: the Absorb findings say they are ready for the owner to send to Ben (#18132) d41ec43
This pull moves the MCP door of Access 3b (#18092) onto may(). It is the first of the issue's boxes, since the issue asks for one door per pull.
What changed
- New action
forge.writeinsrc/core/may.ts: "Change something as your account". Any signed-in account holds it; a token also needs scoperw. src/http/mcp/tool_may.ts, the one place the MCP dispatch now asks:adminAccount(db, user)asksforge.administerof the account. It is used byadminOnly, bylistedTo: "admin", by the admin note, by talk listing, bydestroysTo(which now takesdb) and byaskedFirst.mayToolWrite(ctx, door)asksforge.writewith the credential the call carries. It replaces the fourscopeAllows(ctx.auth.scope ?? "ro", "rw")checks insrc/http/mcp.ts. The old check still runs beside it, and when the two answers differ a row is added toaccess_disagreementunder doormcp <tool>, as in 3a.may()'s answer decides.
- Gate rule "MCP tools ask may" (
src/kernel/mcp_door_checks.ts): fails a new inlineisAdminorscopeAllows(…, "rw")insrc/http/mcp.tsorsrc/http/mcp/shared.ts. OnlymayBoardsis exempt, because that rule is checked inside each tool rather than at the door. - Visible change:
forge.writenow appears incanlists —GET /api/v1/user, MCPwhoami_can, and the terminal's "What I can do" (You may:).docs/features/may.mdand the OpenAPI text say so. The terminal gets no new screen, so the commit carries aNo door:line.
Tests
- New
test/mcp-tools-may.test.ts. It pins both answers for a guest, a member and an admin signed in;ro,rwandadmintokens; and via, proposal, run and contribute tokens. None of them adds a disagreement row. It also checks that a disagreement is counted, and that the gate rule catches a new inline check. - Changed
test/may.test.tsandtest/tui-can.test.tsto expectforge.writein the lists. - Changed
test/mcp-shared-gate.test.ts: its fake context had noapp, and the door now readsctx.app.db. The test was wrong-shaped, not the code. - Results: the type check passes, the gate passes, and about 2,100 tests pass across the MCP, may, gate and terminal suites. One gate-runner test fails ("where Chromium starts the gate runs the looks files"), because the sandbox has no Chromium; this change doesn't touch it.
- Not run: the suites that need a unix socket or cells, and the full suite. The forge's check runs those.
Left out
needsAdminScopestays asscopeAllows(…, "admin"). It is about how far a token reaches, not a role.forge.administerasks only for scoperw, so moving it would let an admin'srwtoken see admin-scope tools.mayBoardsstays as it is.- Pages, SSH and the terminal screens, games and infrastructure are left for their own pulls.
- I had no
keep_planorestimatetool in this run, so the issue has no plan and no time estimate.
Try it on the preview:
- Call
tools/callfeed_dismisson/mcpwith anrotoken: it is refused as read-only. - With a member's token,
GET /api/v1/usershowsforge.writeincan. - With a non-admin token, calling
scorecardanswers "no tool named scorecard".
🤖 Generated with Claude Code
Left #18092 open: 5 unticked items remain (Web pages: the page routes ask may(); inline isAdmin checks in them go.; SSH and the terminal screens ask may().; Games: game_grant's owner, operator and viewer become roles in the same model, using the existing grant, no new grant table.; …).
This pull moves the MCP door of Access 3b (#18092) onto
may(). It is the first of the issue's boxes, since the issue asks for one door per pull.What changed
forge.writeinsrc/core/may.ts: "Change something as your account". Any signed-in account holds it; a token also needs scoperw.src/http/mcp/tool_may.ts, the one place the MCP dispatch now asks:adminAccount(db, user)asksforge.administerof the account. It is used byadminOnly, bylistedTo: "admin", by the admin note, by talk listing, bydestroysTo(which now takesdb) and byaskedFirst.mayToolWrite(ctx, door)asksforge.writewith the credential the call carries. It replaces the fourscopeAllows(ctx.auth.scope ?? "ro", "rw")checks insrc/http/mcp.ts. The old check still runs beside it, and when the two answers differ a row is added toaccess_disagreementunder doormcp <tool>, as in 3a.may()'s answer decides.src/kernel/mcp_door_checks.ts): fails a new inlineisAdminorscopeAllows(…, "rw")insrc/http/mcp.tsorsrc/http/mcp/shared.ts. OnlymayBoardsis exempt, because that rule is checked inside each tool rather than at the door.forge.writenow appears incanlists —GET /api/v1/user, MCPwhoami_can, and the terminal's "What I can do" (You may:).docs/features/may.mdand the OpenAPI text say so. The terminal gets no new screen, so the commit carries aNo door:line.Tests
test/mcp-tools-may.test.ts. It pins both answers for a guest, a member and an admin signed in;ro,rwandadmintokens; and via, proposal, run and contribute tokens. None of them adds a disagreement row. It also checks that a disagreement is counted, and that the gate rule catches a new inline check.test/may.test.tsandtest/tui-can.test.tsto expectforge.writein the lists.test/mcp-shared-gate.test.ts: its fake context had noapp, and the door now readsctx.app.db. The test was wrong-shaped, not the code.Left out
needsAdminScopestays asscopeAllows(…, "admin"). It is about how far a token reaches, not a role.forge.administerasks only for scoperw, so moving it would let an admin'srwtoken see admin-scope tools.mayBoardsstays as it is.keep_planorestimatetool in this run, so the issue has no plan and no time estimate.Try it on the preview:
tools/callfeed_dismisson/mcpwith anrotoken: it is refused as read-only.GET /api/v1/usershowsforge.writeincan.scorecardanswers "no tool named scorecard".🤖 Generated with Claude Code
Closes #18092