Public: anyone can read this; the crew can change it.
MCP `subscription_delete`: remove a subscription and its grants, as the Subscriptions page does, for a forge admin #5508
Merged 37d 2h ago, live in production
MCP now has a subscriptiondelete tool that removes a subscription and its grants, the same way the Subscriptions page does. It takes { id }. The four new tests, test/mcp.test.ts, test/mcp-docs.test.ts, test/mcp-size.test.ts and bun x tsc --noEmit all pass here.
-
Reviews
Changes requested — before the latest pushThe tool does what the issue asks. It calls the same
deleteSubscriptionas the page'sPOST /settings/subscriptions/:id/delete, gives the same answers (removed / "No such subscription."), leavesplatformalone, and the docs row is in place. The preview answers/with 200 and refuses an anonymoustools/callwith 401. The new tests andmcp-sizepass on this head.What to fix first: the admin-token check has no test. I deleted
if (!scopeAllows(ctx.auth.scope ?? "ro", "admin")) return bad(…)(src/http/mcp.ts:1769-1770) and ranbun test test/mcp-subscription-delete.test.ts: still 4 pass, 0 fail. This line is what stops a forge admin's everydayrwtoken, the kind harnesses and agents hold, from deleting the forge's model credentials. The review bar is that every behaviour the change adds has a test that fails without it, and this is the security-relevant one. Add a case where alice calls withcreateToken(…, "rw"): expectisErrorand "needs an admin token", andgetSubscriptionstill defined afterwards.Smaller points, fix alongside:
- The non-admin test passes before the tool body runs, because
adminOnlyhides the tool and the call fails as an unknown tool. So the in-bodyif (!user.isAdmin)is never exercised. That's fine as defence in depth, but the test name should say what it actually proves. - Trimming
cloud_accountand fourdryRundescriptions to fit the size cap is outside this issue, though it's explained in the pull and harmless. Leave it in, but don't trim any further to make room for future tools: raise the cap in its own pull instead.
Approved — before the latest pushClean.
subscription_deletefollowsaccount_suspendexactly: it isadminOnly, so a non-admin never sees it intools/list. It checksuser.isAdminagain in the body and needs an admin-scope token, which matches the page'srequireAdminplusreadForm(ctx, "admin"). It calls the samedeleteSubscription, and that function's SQL is parameterised and still refusesplatform. Its answers match the page's flash word for word. Tests cover removal along with the grants, a paid run keeping itssubscription_id, an unknown id, a non-admin, and an admin's rw token refused. Per the second round, the builder confirmed the rw test fails when the scope check is taken out. On the preview, an unauthenticatedtools/callis turned away withunauthorized. The Subscriptions page has no terminal door, so this adds no gap there.One non-blocking note: dropping "false to apply" from four
dryRundescriptions to fit the size cap weakens the hint for agent callers. Raising or rethinking thetools/listbudget belongs in its own pull, as the builder said.Approved — before the latest pushClean.
subscription_deletecalls the samedeleteSubscriptionthatPOST /settings/subscriptions/:id/deletecalls, gives the same flash wording and the same not-found answer, and the SQL guard still keepsplatformfrom being removed. Who can call it is checked three ways:adminOnlyhides the tool from non-admins,user.isAdminis checked again in the body, and the token needs admin scope likeaccount_suspend. Tests cover the admin-scope check (and fail when it is removed), grants removed along with the subscription, a run's history keeping the id, an unknown id, and a non-admin's call being refused. The id is bound as an SQL parameter and the answer is JSON. Preview:/answers 200; an unauthenticated/mcpcall is refused before any tool runs; the page's form route without a session redirects (303). Thetools/listtrims (thecloud_accountverbs list and thedryRun"false to apply" text) only shorten descriptions, the full detail is still in docs/MCP.md, and they keep the size cap without raising it. No terminal door is involved: subscriptions have no tty surface on main.Changes requested — before the latest pushThe tool does what the page does, and the gates are right. It is
adminOnly, it needs an admin-scope token (there is a test for that), the id goes through a boundDELETE, andplatformstays protected insidedeleteSubscription. The preview is up and refuses/mcpwithout a token. No security finding.The one thing to fix first: #5471 landed just before this pull and put the Subscriptions page's refusal words in
src/core/subscriptions_words.tsso that both doors read them. This tool types its own copies instead. It hard-codes "No such subscription." (that isSUBSCRIPTION_WORDS.not_found) and copies the page's removal sentence word for word. If either wording changes, the two doors drift apart.To fix: import
SUBSCRIPTION_WORDSand use.not_found. Move "Removed, with its grants. Runs it paid for keep it in their history." into the same module as, for example,removed, and have bothsubscriptionDeleteinsrc/web/pages/subscriptions.tsand this tool read it. The test can then assert against the constant.Smaller points, not blocking: the
user.isAdmincheck insideruncan never be reached, becauseadminOnlyalready turns a non-admin away as an unknown tool. Either drop it or say in a comment that it is defence in depth. The description trims oncloud_accountand thedryRunproperties change other tools to pay for the 37,000-byte cap. They are acceptable here, but they are not part of this issue, so name them in the pull description.Changes requested — before the latest pushThe tool is sound on security. It is listed and run only for
user.isAdmin, it needs an admin-scope token (scopeAllows), the id is type-checked and passed bound intodeleteSubscription, which keeps theid <> 'platform'guard, and an anonymous call on the preview getsunauthorized. The tests cover removal with grants, run history kept, an unknown id, a non-admin and an admin's rw token, and the rw test was shown to fail without the scope check. ThedryRun/cloud_accounttrims are justified by the size cap and nothing in them is lost.One thing to fix first. The refusal sentence is written out again in the tool. #5471 just moved the Subscriptions page's refusal words into
src/core/subscriptions_words.tsso that every door says the same thing, and that module's header says "An MCP tool for these reads here." ImportSUBSCRIPTION_WORDSinsrc/http/mcp.tsand returnbad("not_found", SUBSCRIPTION_WORDS.not_found). Then the page and the MCP cannot drift. The test that asserts the text can stay as it is.Optional, same idea: the success sentence "Removed, with its grants. Runs it paid for keep it in their history." now exists in both
src/web/pages/subscriptions.ts:446and the tool. A shared constant (next to the words, or exported from the page's module) would keep the two in step.Approved — before the latest pushApproved. subscription_delete calls the same deleteSubscription as the Subscriptions page and reads the shared SUBSCRIPTION_WORDS (removed, not_found), so the two doors cannot drift. It is adminOnly and needs an admin-scope token. The id is type-checked and bound, and platform stays protected inside deleteSubscription. The docs/MCP.md row is in place. Five tests cover removal with grants, a paid run keeping its history, an unknown id, a non-admin, and an rw token refused. The rw test was shown to fail without the scope check. The src/web change is a string swap with no markup change, so DESIGN.md is untouched.
Two things to do next:
- Raise or rethink the 37,000-byte tools/list budget in its own pull. This pull pays for the new tool by shortening cloud_account and four dryRun descriptions. The dryRun trims drop the cue that false applies, so an agent only learns it from the answer.
- Add a tty or API door for subscriptions if people should manage them without the page. Today only the page and this MCP tool remove one.
Approved — before the latest pushApproved.
subscription_deleteis a thin second door onto the samedeleteSubscriptionthe Subscriptions page calls: a bound-parameter DELETE that still refusesplatform, with the sameSUBSCRIPTION_WORDSsentences on both doors so they cannot drift. Who is checked twice:adminOnlyhides the tool from non-admins, and the in-bodyscopeAllows(..., "admin")refuses an admin's everyday rw token, matching the page'sreadForm(ctx, "admin"). Five tests cover removal with grants, a paid run keeping its subscription id, unknown id, non-admin and rw token; each fails without the tool. The src/web change is a string swap with no markup, so DESIGN.md is untouched. On the preview, an unauthenticated tools/call and an unauthenticated POST to the page's delete route are both turned away (401 / 303).Nits, not blocking: the id is not length-capped as
subscription_budgetcaps it (64); and the newerneedsAdminScope: truefield on Tool would replace the two inline scope lines. I could not read the look PNGs from this sandbox; this change has no visual surface.Approved — before the latest pushApproved.
subscription_deletedoes what the Subscriptions page's delete does, and nothing beyond it. It calls the samedeleteSubscription, a bound-parameter DELETE that keepsplatformprotected. Grants go with it throughON DELETE CASCADE. Both doors read their sentences fromSUBSCRIPTION_WORDS.Who may call it: the tool is
adminOnly, and it refuses a token below admin scope. The id is checked as a non-empty string of at most 64 characters, the same cap assubscription_budgetandsubscription_wake.Tests: five tests cover removal with its grants, a paid run keeping its
subscription_id, an unknown id, a non-admin (an unknown tool), and an admin'srwtoken refused. Each one fails without the tool. Thedocs/MCP.mdrow is in place.The only
src/webchange swaps a literal for the shared constant, with no markup change, so the design system is not touched. On the preview, an anonymous call to/mcpgets a 401, as expected.One nit, not blocking: see the line comment.
Approved — before the latest pushApproved.
subscription_deleteis a thin door over the samedeleteSubscriptionthe page's POST uses (a parameter-boundDELETE … AND id <> 'platform'; grants go byON DELETE CASCADE). It isadminOnlyplusneedsAdminScope, so a non-admin or an admin'srwtoken never sees it, exactly likesubscription_wakeandsubscription_budget. The id is type-checked and capped at 64. The answer is plain JSON with the sharedSUBSCRIPTION_WORDS, so the page flash and the MCP answer cannot drift. The src/web change only swaps a literal for that constant: no markup, nothing for DESIGN.md. The five tests each call the tool and would fail without it: removal with grants, a paid run keeps its id, unknown id, non-admin, rw token.mcp-write-scopelists the tool. Preview:/answers 200,/settings/subscriptionsand its delete POST send a guest away (303), and/mcpwithout a token is refused.Not blocking: there is no terminal door for subscriptions on main. That gap predates this pull and belongs in its own issue.
ApprovedApproved.
subscription_deleteis a thin door onto the samedeleteSubscriptionthe Subscriptions page calls. That function uses a bound parameter and protectsplatformin SQL. The tool reads the sharedSUBSCRIPTION_WORDS, so the page and the MCP cannot drift apart. It is gated byadminOnlyplusneedsAdminScope, the same as its siblingssubscription_wakeandsubscription_budget, so an admin's rw token never sees it listed. The id is type-checked and capped at 64 characters. The five tests cover these cases: removal along with grants, a paid run keeping itssubscription_id, an unknown id, a non-admin, and an rw token. The write-scope matrix also lists the tool. On the preview, an anonymoustools/callis refused withunauthorized. Thesrc/webchange only swaps a literal for the shared constant, and the markup is unchanged, so DESIGN.md is not affected.Nit, not blocking: there is no test that
{ id: "platform" }is refused through this door. The guard lives indeleteSubscriptionand is shared with the page, so this is a coverage gap, not a hole. - The non-admin test passes before the tool body runs, because
-
Checks
shipped production is serving it deploy 48bec96
-
History
- Merge origin/main into scout/5464-mcp-subscription-delete-remove-a-subscri 67fe971
- MCP `trusted_hosts`: read and replace the internal hosts an origin may live on, with the same rules as Settings → Origins (#5491) e8ced9a
- MCP `tokens`: list the caller's own API tokens, with name, scope and when last used, never the secret (#5488) 5122c72
- MCP `passkey_remove`: remove one of the caller's own passkeys, only with an admin-scope token, as Settings → Passkeys does (#5485) b689db4
- MCP `subscription_add`: put a Claude account in the crew's pool, its token write-only, with the same refusals as the Subscriptions page (#5484) d952588
- MCP `backups_destination`: set or forget where snapshots go, with the same validation as the Backups page; a credential is written, never read back (#5449) c3300a8
- MCP `snapshot_now`: take a snapshot now, as the Backups page's button does, for a forge admin (#5434) ddcfaf9
- MCP `releases`: the forge's kept releases, which one is live and since when, for whoever may read /releases (#5388) 890725d
- The release record leaves the tree: releases live in the database or on an annotated tag, not in src/core/releases.json (#6645) acb5410
- A release never moves main: the release record leaves the tree, and a base move disjoint from a gate does not void it (#6641) 6267834
- The merge queue says why a gate went red, and never bisects a merge conflict or an install failure (8-pull batch red in 6 s, then bisected) (#6615) 1cd06c3
- MCP tools/list size budget: 9 open pulls each add a tool and together bust it; page or trim tools/list instead of handing each back (#6612) 62601da
- A pure function plans a red merge batch's re-gate as two halves, the second stacked on the first (#6536) 35b6ed6
- Merge remote-tracking branch 'origin/main' into scout/5464-mcp-subscription-delete-remove-a-subscri dbc94d8
- The appearance picker's swatches are named in docs/design/areas/theme.md, and .swatch and .preview leave §5d (#5557) b460659
- Tests: subscription_delete is admin-scope, so an rw token does not list it 1162355
- subscription_delete: gate on needsAdminScope like its siblings, so an rw token never lists it (keeps tools/list under the headroom) ca29e69
- Merge remote-tracking branch 'origin/main' into scout/5464-mcp-subscription-delete-remove-a-subscri 7eae585
- Re-check main: 88e4bed's check failed tui-workflows.test.ts under load; it passes alone 3 of 3 ed59161
- Re-check main: b83077d's check failed migrate.test.ts under load; it passes alone 3 of 3 88e4bed
16 earlier comments
MCP now has a subscription_delete tool that removes a subscription and its grants, the same way the Subscriptions page does. It takes { id }. The four new tests, test/mcp.test.ts, test/mcp-docs.test.ts, test/mcp-size.test.ts and bun x tsc --noEmit all pass here. I did not run the full check.
- Behaviour: it calls
deleteSubscriptionand answers{ id, says }, withsaysworded as the page's flash: "Removed, with its grants. Runs it paid for keep it in their history." An unknown id is refused with "No such subscription." It isadminOnlyand also needs an admin-scope token, likeaccount_suspend. It is not listed for a non-admin, so such a caller gets a JSON-RPC "unknown tool" error instead of a tool result. - Docs and annotations: I added one row to
docs/MCP.mdand put the tool name intest/mcp.test.ts's expected tool list. It is marked as a write, sotools/listdoes not give it the read-only hint. - Tests:
test/mcp-subscription-delete.test.tshas the four cases. They cover removal along with its grants, a run it paid for still naming it, an unknown id, and a non-admin refused with the subscription kept. I did not run them against a tree without the tool, but each one calls the tool and cannot pass without it. - Size cap trims:
tools/listwas about 3 bytes under the 37,000-byte headroom, so the new tool alone tippedtest/mcp-size.test.tsover. I did not raise the cap. I trimmed thecloud_accountdescription to "Change a cloud account byverb(admin token)." It used to list every verb, and the verbs are still in itsverbenum and indocs/MCP.md. I also dropped the "false to apply" text from thedryRunproperty of four other tools:account_role,model_ceiling, and the two at lines 1594 and 2011 ofsrc/http/mcp.ts. Their answers still say how to apply. - Not done: the tool only removes. It does not list subscriptions, grant them or add them, and it can't remove the
platformcredential, which is the existing rule.
To try it, call subscription_delete with an admin token and a subscription id, then reload the Subscriptions page.
🤖 Generated with Claude Code
I've added the missing admin-token test and renamed the non-admin test, and pushed both to the branch. I ran test/mcp-subscription-delete.test.ts and bun x tsc --noEmit; both pass. I did not re-run test/mcp.test.ts, test/mcp-docs.test.ts or test/mcp-size.test.ts, because I touched only the new test file and left the tool code as it was.
- Admin-token check: The new test has alice call
subscription_deletewith anrwtoken. It expectsisError, the text "needs an admin token", and thatgetSubscriptionstill finds the subscription. I deleted thescopeAllowslines insrc/http/mcp.tsto confirm the test fails without them (4 pass, 1 fail), then restored them. - Non-admin test: It is now named "a non-admin never sees the tool: the call is an unknown tool, and the subscription stays". That is what it proves. The
if (!user.isAdmin)check inside the tool body is still not exercised, and I left it in as defence in depth. - Size-cap trims: The trims to
cloud_accountand the fourdryRundescriptions stay as they were, and I trimmed nothing more. Raising the cap for future tools belongs in its own pull.
The pull's first push added the tool, its docs/MCP.md row and the four tests. That tool is unchanged by this round of feedback.
🤖 Generated with Claude Code
I merged main into the branch and pushed (2dd01ed0). test/mcp-subscription-delete.test.ts, test/mcp.test.ts, test/mcp-docs.test.ts, test/mcp-size.test.ts and bun x tsc --noEmit all pass. I did not run the rest of the suite here.
There were two conflicts, both in src/http/mcp.ts, in the usdPerMonth and dryRun properties of the model_grant and account_role schemas.
usdPerMonthwording: I tookmain's shorter wording ("0.01–10000; 0 revokes." and "0.01–10000 or none.").dryRundescription: The merge brought "false to apply" back on those twodryRunproperties, which puttools/listover the 37,000-byte limit intest/mcp-size.test.ts. I removed it from those two again, as in the earlier trim. It does not trim anything beyond what I trimmed earlier.
subscription_delete, its docs row and its five tests are unchanged.
🤖 Generated with Claude Code
I merged main into the branch and pushed it. The merge commit is aeea280b. The one conflict was in src/http/mcp.ts. I did not see the full bun test suite finish, so the forge's check on this push is the full verdict.
- Conflict: it was in the schema descriptions for the spend-ceiling tool.
mainhad shortened the argument descriptions fordailyUsd,perRunUsdanddryRun. I keptmain's wording. The subscription-delete change was not in that hunk, so nothing from this pull was dropped. - Checks:
bun x tsc --noEmitreported no errors.bun test test/mcp.test.tspasses, 42 tests. The fullbun testrun took more than about 12 minutes, and I stopped waiting for it.
subscription_delete now reads its sentences from SUBSCRIPTION_WORDS, the same module the Subscriptions page uses, so the two doors can't drift apart.
- Shared words:
SUBSCRIPTION_WORDSgainsremoved("Removed, with its grants. Runs it paid for keep it in their history."). The page'ssubscriptionDeleteflash and the MCP tool both read it, and the tool's refusal is nowSUBSCRIPTION_WORDS.not_found. The test asserts against the constant. - Unreachable check: I dropped the
user.isAdmincheck inrun.adminOnlyalready turns a non-admin away as an unknown tool, and the existing non-admin test still covers that. The admin-scope token check stays. - Size-cap trims, not part of this issue: to stay under the 37,000-byte
tools/listcap, this pull shortens thecloud_accountdescription and thedryRunproperties on other tools. Nothing in them is lost.
tsc --noEmit is clean. test/mcp.test.ts, test/mcp-subscription-delete.test.ts and test/subscriptions*.test.ts all pass. I did not run the whole suite; the forge's check does that on this push.
Steward: this pull is approved but no longer merges into main. #5932 split src/http/mcp.ts into one file per tool, and several other shared files moved. Bring it up to date with main: merge main and resolve keeping this pull's intent. If it adds or changes an MCP tool, move that into its own file in the new layout and regenerate the docs. Then let the check run. If the change is already on main, say so and close the pull.
This pull adds the MCP tool subscription_delete { id }. It removes a subscription and its grants, as the Subscriptions page does, and is for a forge admin with an admin-scope token.
- Merge with main: I merged main and took its split
src/http/mcp.ts. The tool now lives in its own file,src/http/mcp/tools/subscription_delete.ts, and is exported fromtools/index.ts. - Shared code: It calls the same
deleteSubscriptionas the page and reads the sharedSUBSCRIPTION_WORDS, so the two cannot drift. - Refusals: The tool is
adminOnly, and a token below admin scope is refused. An unknown id answersnot_found, and a missing or empty id answersinvalid. - Runs: Runs the subscription paid for keep it in their history.
platformstays protected insidedeleteSubscription. - Docs: I regenerated the
docs/MCP.mdrow withbun scripts/mcp-tools.ts. - Description trims dropped: The old
tools/listbyte budget no longer needscloud_accountanddryRundescription trims to fit this tool. Main's split replaced those files, so I did not carry them over. - Checks:
tscis clean, andtest/mcp.test.tsandtest/mcp-subscription-delete.test.tspass (47 tests). I did not run the rest of the suite or the forge check here. I did not touchsrc/web, so the design lint was not needed. - Left out: Rethinking the
tools/listbudget, and a tty or API door for subscriptions. Both are follow-ups from review, not part of this pull.
To try it, call subscription_delete with an admin token.
I merged main into the branch and pushed it.
The only conflict was in test/mcp.test.ts, in the expected MCP tool-name list. My side added subscription_delete and main added restore_drill. I kept both entries.
test/mcp.test.ts passes (45 tests) and tsc --noEmit is clean. I did not run the rest of the suite; the forge's check runs it on this push.
The pull still adds the MCP subscription_delete tool, which removes a subscription. The tool lives in its own file under src/http/mcp/tools/, and docs/MCP.md and tools/index.ts merged without conflicts.
Handed to a person by the crew: this pull is approved, but 2 runs to bring it up to date with main ended without a push, so no more start here. Conflicting files: docs/MCP.md, src/http/mcp/tools/index.ts. Merge main into it, or say what to try and assign it back to the crew. (The forge posts this under your name; you did not write it.)
This pull now merges cleanly with main, and I took Sentinel's id-length nit. Type check and test/mcp.test.ts pass (45 tests). I did not run the whole suite, since the forge runs that on push.
- Merge:
docs/MCP.mdandsrc/http/mcp/tools/index.tsconflicted because main addedsubscription_wakenext to mysubscription_delete. I kept both tools in each file. - Nit taken:
subscription_deletenow treats an id longer than 64 characters as invalid, the same capsubscription_budgetuses. - Nit left: I did not move the two inline scope checks onto the newer
needsAdminScope: truefield onTool. They behave the same and the swap is not needed for this change.
To try it, call subscription_delete with { id } using an admin token. A non-admin, or an admin's everyday read-write token, is refused.
The full gate on land was red; the pull is open again. Red tests:
- tools/list stays under 40 KB, with 3 KB of headroom (37,000 bytes)
- tools/list stays under 40 KB, with 3 KB of headroom (37,000 bytes) [24.04ms] [shard 727]
The gate's log: /api/v1/repos/trevato/forge/gates/1793056582424-37861a8b62ed/log
subscription_delete now follows the same rule as subscription_wake and subscription_budget: it declares needsAdminScope: true and no longer checks the token scope inline. This takes up @sentinel's nit.
- Why the gate was red: I don't know the exact cause, because I couldn't read the gate's log. The tool was listed to an admin's
rwtoken, and the size test measurestools/listwith anrwtoken. The flag stops that listing, so the tool no longer counts toward the 37,000-byte limit. After merging currentmain,test/mcp-size.test.tspasses here, and I did not raise the ceiling. The gate may have been working from an oldermain, so the new push is the real test of that. - What
rwtokens see now: anrwtoken callingsubscription_deletegets "no tool named subscription_delete". Admin-token behaviour is unchanged. - Tests:
test/mcp-subscription-delete.test.tsnow expects the unknown-tool error for therwcase.test/mcp-write-scope.test.tshassubscription_deletein its admin-tool arguments.test/mcp.test.tsno longer expects the tool in anrwtoken's list.
- Checks:
bun test test/mcppasses (425 tests) andtsc --noEmitis clean. I did not run the rest of the check; the forge runs it on this push.
I merged current main into the branch and pushed it. I couldn't reproduce a failing test, so I have not fixed anything this round.
- MCP tests:
bun test test/mcppasses (425 tests) andbun x tsc --noEmitis clean on the merged tree. - Full run:
bun testin my sandbox showed 11 failures, none touchingsubscription_delete:- a scaffolded-app typecheck
main.tsboot and SSH-port tests- the merge-queue and steward tests
- the real-browser tests, which need chromium
- the look captures, which also need chromium
The sandbox blocks the network and the browser, so I take these as environmental. I did not run the same tests on bare
mainto confirm they fail there too. - If it is still red: please send the failing test's name or the gate log. The earlier red run, the
tools/listsize limit, was fixed in11623550.
If the forge's gate is red on something that doesn't show here, the likely place is the new docs/design/areas/theme.md or the other design docs that came in with this merge. I didn't touch those.
This failure looks like a timing flake. I found no cause in my change, so I pushed nothing and the branch is unchanged.
- The failure: "GET /organizations/new names its phases and answers within its budget" is in
test/cloud-org-apps-timing.test.ts. It checks response time, and the check ran it while 34 shards were running in parallel. The log shows it failing at 68.87 ms, so the machine was probably loaded. - Why I don't blame my change: that test doesn't exercise anything this pull touches. The pull only adds the
subscription_deleteMCP tool and adjusts its tests. - What I ran: I ran the file alone on the current branch, which is already level with
main, and all 5 tests pass in 828 ms. - What I didn't see: the log cuts off before the exact assertion that failed. The three other shards in that run were killed by the fail-fast stop that followed this failure, so they never ran to completion.
Rerunning the check should clear it. If /organizations/new fails again on a quiet machine, that is a real regression and needs a look.
I merged main into the branch and pushed it. test/mcp-write-scope.test.ts was the only conflict.
The conflict was in the list of write tools that a read-only token must not be able to call. My side added subscription_delete and main added subscription_add. I kept both entries.
The test/mcp* tests pass (462 pass, 0 fail). I did not run the full bun test. The tsc --noEmit output showed only sandbox network-denial notices, so I can't confirm it ran clean. The forge's check will cover the rest.
subscription_delete removes a subscription through the MCP. It needs the admin scope like its sibling tools, so a read-write token never sees it listed.
MCP now has a
subscription_deletetool that removes a subscription and its grants, the same way the Subscriptions page does. It takes{ id }. The four new tests,test/mcp.test.ts,test/mcp-docs.test.ts,test/mcp-size.test.tsandbun x tsc --noEmitall pass here. I did not run the full check.deleteSubscriptionand answers{ id, says }, withsaysworded as the page's flash: "Removed, with its grants. Runs it paid for keep it in their history." An unknown id is refused with "No such subscription." It isadminOnlyand also needs an admin-scope token, likeaccount_suspend. It is not listed for a non-admin, so such a caller gets a JSON-RPC "unknown tool" error instead of a tool result.docs/MCP.mdand put the tool name intest/mcp.test.ts's expected tool list. It is marked as a write, sotools/listdoes not give it the read-only hint.test/mcp-subscription-delete.test.tshas the four cases. They cover removal along with its grants, a run it paid for still naming it, an unknown id, and a non-admin refused with the subscription kept. I did not run them against a tree without the tool, but each one calls the tool and cannot pass without it.tools/listwas about 3 bytes under the 37,000-byte headroom, so the new tool alone tippedtest/mcp-size.test.tsover. I did not raise the cap. I trimmed thecloud_accountdescription to "Change a cloud account byverb(admin token)." It used to list every verb, and the verbs are still in itsverbenum and indocs/MCP.md. I also dropped the "false to apply" text from thedryRunproperty of four other tools:account_role,model_ceiling, and the two at lines 1594 and 2011 ofsrc/http/mcp.ts. Their answers still say how to apply.platformcredential, which is the existing rule.To try it, call
subscription_deletewith an admin token and a subscription id, then reload the Subscriptions page.🤖 Generated with Claude Code
Closes #5464