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

MCP `flags` answers what `readFlags` answers, for a forge admin #7285

Merged opened this

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

Merged

MCP `flags` now returns what `readFlags` (`src/actions/flags_view.ts`) answers, unchanged. `tsc` is clean and the `flags`, `flag_set` and `mcp-size` tests pass (13 tests); I did not run the full suite.

shipped production is serving it deploy f5d5671

opened this

MCP flags now returns what readFlags (src/actions/flags_view.ts) answers, unchanged. tsc is clean and the flags, flag_set and mcp-size tests pass (13 tests); I did not run the full suite.

The flags tool, test and docs row were already on main from #6991. That tool rebuilt the list from the registry itself and named the live value live, with null when unset. Today:

  • Tool: src/http/mcp/tools/flags.ts now calls readFlags(user) and returns its flags. A refusal is forbidden with the message readFlags gives, which is the same "Flags are set by a forge admin." as before. The input and the one-sentence description are the same.
  • Shape change: the live value is now value, as readFlags names it, and it is left out when unset instead of null. Anything reading live from this tool will need updating; I found no other reader in the repo.
  • Test: test/mcp-flags.test.ts now changes the live value through the flag_set tool with an admin token instead of the settings page. It still covers the admin view of a flag declared with useFlagRegistry, and the refusals for a non-admin and for an agent flagged admin.
  • Docs: the flags row in docs/MCP.md says value and points to flag_set for setting.

Try it: as a forge admin, call flags through the MCP. Then call flag_set with { name, value: { forge: true } } and call flags again to see value.

I added no tool, and test/mcp-size.test.ts passes without touching its ceilings.

Closes #7018

commented

MCP flags now returns what readFlags (src/actions/flags_view.ts) answers, unchanged. tsc is clean and the flags, flag_set and mcp-size tests pass (13 tests); I did not run the full suite.

The flags tool, test and docs row were already on main from #6991. That tool rebuilt the list from the registry itself and named the live value live, with null when unset. Today:

  • Tool: src/http/mcp/tools/flags.ts now calls readFlags(user) and returns its flags. A refusal is forbidden with the message readFlags gives, which is the same "Flags are set by a forge admin." as before. The input and the one-sentence description are the same.
  • Shape change: the live value is now value, as readFlags names it, and it is left out when unset instead of null. Anything reading live from this tool will need updating; I found no other reader in the repo.
  • Test: test/mcp-flags.test.ts now changes the live value through the flag_set tool with an admin token instead of the settings page. It still covers the admin view of a flag declared with useFlagRegistry, and the refusals for a non-admin and for an agent flagged admin.
  • Docs: the flags row in docs/MCP.md says value and points to flag_set for setting.

Try it: as a forge admin, call flags through the MCP. Then call flag_set with { name, value: { forge: true } } and call flags again to see value.

I added no tool, and test/mcp-size.test.ts passes without touching its ceilings.

Approved

Approved. The flags tool now calls readFlags, the same read that /settings/flags and the terminal's flags screen use, so the MCP door matches the page and the TUI. The check stays in one place. mayManageFlags still refuses non-admins and agents (both refusal tests are kept), and the refusal still uses the page's wording (FLAGS_ADMIN_ONLY). The tool doesn't write anything, takes no user input, and builds no SQL or shell command. The new tests would fail on the old code: the old code returned live: null, which toEqual does not match, and flag.value would be undefined. The test now sets the value through flag_set with an admin token, which is what #7018 asked for. The preview is up: / answers 200 and /mcp without a token returns unauthorized. One thing I noticed, which doesn't block this pull: renaming live to value is a breaking change to the wire format. You said in the pull that you found no reader in the repository, and I checked and found none either.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs