Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
chore(prompts): file orders 455-456, settings/connections 404 blocks chat pairing and X-connect, settings/mcp-tools 404 blocks every disabled-tool refusal fix link
nirholas315de770aed4
diff --git a/prompts/finish/455-auto-settings-connections-404.md b/prompts/finish/455-auto-settings-connections-404.mdnew file mode 100644index 000000000..5ded87f3f--- /dev/null+++ b/prompts/finish/455-auto-settings-connections-404.md@@ -0,0 +1,84 @@+# 455. `/settings/connections` 404s: a fully-built chat-pairing API has no page to land on++How to run: paste this file's repo path into a fresh Claude Code chat in this repository and say "run this work order". Runnable now, no gate, no owner action required.++## Operating clause (binding)++- Read CLAUDE.md first. CLAUDE.md overrides everything, including this file.+- Finish 100% in this session. Never end the turn with a question, an option list, or an unexecuted plan.+- This is a bug fix (a live 404 on a path the server itself links to): follow the test-first rule (CLAUDE.md, "Bug fixes are test-first"). Write the failing test first, confirm it fails for the stated reason, then fix the code, then confirm it passes. Commit the test with the fix.+- The only permitted stops are the CLAUDE.md stop-and-ask gates (spend/on-chain writes, push/deploy, posting externally, committing content referencing a crypto project other than `$THREE`, destroying unrecoverable data). This order touches none of them.+- Concurrent agents share this worktree: stage explicit paths only (never `git add -A` or `git add .`), re-check `git status` and `git diff --staged` before committing.+- The em-dash and en-dash characters are banned in everything you write.++## Why this matters (measured 2026-10-25)++`GET https://three.ws/settings/connections` returns a live 404 today:++ curl -s -o /dev/null -w "%{http_code}\n" https://three.ws/settings/connections++The mechanical cause is `vercel.json` (confirmed at the lines below, read today): the `/settings/` single-page app has exactly one static file, `public/settings/index.html` (`find public/settings -maxdepth 1 -iname "*.html"` returns only `index.html`), but its catch-all route treats any subpath as a literal file on disk instead of falling back to that one file:++ { "src": "/settings", "dest": "/settings/index.html" },+ { "src": "/settings/", "dest": "/settings/index.html" },+ { "src": "/settings/(.*)", "dest": "/settings/$1" }, // <-- line ~5735, the bug: looks for a file named "connections" that does not exist++Contrast with `/dashboard/(.*)` a few hundred lines earlier, which uses the identical `dest: "/dashboard/$1"` pattern correctly, because `public/dashboard/` genuinely has one real HTML file per subpath (`actions.html`, `sessions.html`, `storage.html`, etc, confirmed via `find public/dashboard -maxdepth 1 -iname "*.html"`). `/settings/` is architecturally different: it is one hash-routed SPA (`public/settings/index.html`, 1712 lines, tab nav at lines 455-467, `navigate(tab)` router at lines 1673-1706), so its catch-all needs the SPA fallback, not the dashboard pattern. The two routes were written to look alike; only one of them is actually a multi-page directory.++This 404 is not cosmetic. The exact path `/settings/connections` is hardcoded, live, and reached by real users and real bot messages across at least four independent flows, all pointing at a page that cannot load:++1. **Telegram/Discord bot pairing.** `api/_lib/gateway/core.js`'s `pairingPrompt()` sends every person who starts a pairing flow in a bot DM a message containing `` `Open ${appOrigin()}/settings/connections?code=${code}` `` as the primary (only UI) way to redeem their pairing code. `api/_lib/gateway/commands.js` sends the same URL (no query) as the bot's "manage paired chats" help text. Both land on a 404 today.+2. **Dashboard notification settings.** `src/dashboard-next/pages/settings.js` lines 720, 784, and 792 tell the user, in the UI itself, to "Pair a chat at /settings/connections" before the Telegram/Discord notification toggle will enable. Same 404.+3. **Sign-in-with-X OAuth connect flow.** `api/auth/x/[action].js` line 160 allowlists `/settings/connections` as a valid OAuth return surface, and `connectReturnUrl()` (lines 175-191) builds `` `/settings/connections?${q}#x` `` for the `target === 'agent'` branch. Same 404. `api/_lib/x-agent-policy.js` lines 326 and 428 build the same return URL.+4. **The backend feature itself is 100% built and already labeled "behind /settings/connections."** `api/gateway/connections.js` lines 1-13 (its own header comment) describe a complete REST surface: `GET` (list paired chats + the account's agents + bot usernames), `POST {action:'issue'}` (mint a pairing code), `POST {action:'redeem', code}` (pair the chat that printed it), `PATCH {id, notify, default_agent_id}`, `DELETE ?id=` (unpair). Confirmed today: `grep -rln "api/gateway/connections" src/` returns **zero matches** anywhere in the frontend. This is a fully working, authenticated, CSRF-gated, rate-limited API with no caller.++`docs/ux-flows/11-account-dashboard.md` line 167 already documents this exact gap in its own words, written before this order: "Their disabled tooltip reads 'Pair a Telegram (or Discord) chat at /settings/connections to enable', but no page is served at that path yet, so pairing currently happens through the gateway API and the bot's `/link <code>` command." That sentence is itself now stale once this order ships (the page will exist), and must be updated.++This is a new finding, not a duplicate: `grep -rln "settings/connections\|gateway/connections" prompts/finish/` before this order returns nothing. It outranks a new feature under the RUN-ORDER rule (live production defect, four independent call sites, backend already shipped) and it is Solana-neutral infrastructure (account/notification plumbing), so it does not compete with or displace Solana-first work.++## Task++1. Read `public/settings/index.html` in full (1712 lines), focusing on:+ - lines 455-467 (the `<aside>` tab nav: `<a href="#profile" data-tab="profile" ...>` through `<a href="#danger" data-tab="danger" ...>`)+ - the `tab-connected-accounts` panel markup starting at line 634, as the closest existing pattern (a panel that calls a backend list endpoint and renders rows with actions)+ - lines 1672-1706 (`navigate(tab)`, the click handler that does `history.pushState(null, '', '#' + tab)`, the `popstate` listener, and the init IIFE that resolves the starting tab from `?tab=` then `location.hash` then `'profile'`)+2. Read `api/gateway/connections.js` in full (its header comment plus the handler body) to confirm the exact request/response shapes for `GET`, `POST {action:'issue'}`, `POST {action:'redeem', code}`, `PATCH`, and `DELETE`.+3. Write the failing test first, in a new file `tests/settings-connections-route.test.js`: read `vercel.json`, locate the rule whose `src` is `"/settings/(.*)"`, and assert its `dest` is the literal string `"/settings/index.html"` (not `"/settings/$1"`). Follow the plain-JSON-read pattern already used in `tests/pages-routes.test.js` (`JSON.parse(readFileSync(...))`, no server boot). Run `npx vitest run tests/settings-connections-route.test.js` and confirm it fails against the current `"/settings/$1"` value.+4. Fix `vercel.json`: change the `/settings/(.*)` rule's `dest` from `"/settings/$1"` to `"/settings/index.html"`. Do not touch the `/settings/api-keys/?` redirect rule or the plain `/settings` and `/settings/` rules immediately above it; they already work and must stay in the same relative order (the redirect rule must still be evaluated before the catch-all).+5. Re-run `npx vitest run tests/settings-connections-route.test.js`; it must pass.+6. Add a `connections` tab to `public/settings/index.html`, following the exact pattern of the existing tabs:+ - A new nav link in the `<aside>` block: `<a href="#connections" data-tab="connections" data-i18n="settings_index.connections">Connections</a>`, placed after the `#sessions` link and before `#danger` (matches the existing ordering: identity/security tabs first, danger zone last).+ - A new `<div class="page" id="tab-connections">` panel, placed after the `tab-sessions` panel, containing: a heading and one-line description ("Chats paired with your agents, and X accounts connected for memory seeding" or similar, matching the tone of the `connected-accounts` panel's description), a `data-slot="links-list"` container for paired chats (platform, chat title, paired agent, notify toggle, an "Unpair" button), a `data-slot="issue"` section with a button that calls `POST {action:'issue'}` and displays the returned pairing code plus the bot usernames from the `GET` response's `bots` field (so a user who lands on the page without a code can still start a pairing from here), and a `data-slot="redeem"` section that is only shown/used when the page loads with a `code` in the query string (see step 7).+ - Implement `loadConnections()` (mirroring `loadConnectedAccounts()`'s shape: fetch, render, wire button handlers with `fetch(..., {credentials:'include'})` and the existing CSRF/toast helpers already used elsewhere in this file) that calls `GET /api/gateway/connections` and renders the `links`, `agents`, and `bots` arrays into the panel.+ - Wire `PATCH` for the notify toggle and `DELETE` for the "Unpair" button on each row, following the same optimistic-update-plus-toast pattern `renderConnectedApps()` uses for its "Revoke" button (read that function in `src/dashboard-next/pages/settings.js` lines 572-626 for the pattern; it is a sibling page, not this one, but the fetch/toast/confirm idiom is the same project-wide convention).+ - Add `if (tab === 'connections') loadConnections();` inside `navigate(tab)` alongside the existing `if (tab === 'sessions') ...` and `if (tab === 'connected-accounts') ...` lines.+7. Fix the tab-resolution collision this uncovers: the X-connect flow's `target === 'agent'` branch (`api/auth/x/[action].js` line 181) returns to `` `/settings/connections?${q}#x` ``, where `#x` is an outcome marker, not a tab name. Once `/settings/connections` serves the SPA, the init IIFE's existing priority (`?tab=` then `location.hash` then `'profile'`) would try to `navigate('x')`, find no `#tab-x` element, and leave the page blank. Fix this by adding a pathname check ahead of the hash check: if `location.pathname === '/settings/connections'` (or starts with it), resolve the starting tab as `'connections'` regardless of any trailing hash, and read `_urlP.get('x')` inside `loadConnections()` to show the appropriate X-connect outcome toast (reuse the existing outcome-to-message mapping style already used for Telegram outcomes at lines 309-324, or inline a small equivalent map for the `x` outcomes this endpoint sends: `linked`, `already_linked`, `failed`, etc, matching whatever `api/auth/x/[action].js` actually emits as `outcome` values, confirm by reading that file's `outcome` assignments). Also read `code` and `agent` query params the same way, for the bot-pairing and agent-prefill flows respectively.+8. Confirm the three message-copy call sites do not need text changes now that the page is real: re-read `src/dashboard-next/pages/settings.js` lines 720, 784, 792, `api/_lib/gateway/core.js`'s `pairingPrompt()`, and `api/_lib/gateway/commands.js`'s help text. All of them already say exactly `/settings/connections` (with `pairingPrompt` additionally appending `?code=${code}`); once the route and page exist, these become correct as written and need no edits. State this explicitly in your report rather than silently skipping it.+9. Update `docs/ux-flows/11-account-dashboard.md` line 167: remove the clause "but no page is served at that path yet, so pairing currently happens through the gateway API and the bot's `/link <code>` command" (now false) and replace it with a short accurate statement that `/settings/connections` now serves the pairing UI directly.+10. Run `npm run check:rules -- --paths vercel.json public/settings/index.html tests/settings-connections-route.test.js docs/ux-flows/11-account-dashboard.md` and fix anything it flags.+11. Add a `data/changelog.json` entry (tag `fix` or `feature`, whichever the existing convention uses for a previously-404ing settings surface, link `/settings/connections`) describing that chat pairing and X-connect returns now land on a working page, then run `npm run build:pages` and confirm only the expected generated files change.+12. Read the full diff (`git diff vercel.json public/settings/index.html tests/settings-connections-route.test.js docs/ux-flows/11-account-dashboard.md data/changelog.json`) and confirm every changed line is one of the changes above.++## Done when++- `tests/settings-connections-route.test.js` exists, asserts the `/settings/(.*)` rule's `dest` is `"/settings/index.html"`, and is confirmed to have failed against the pre-fix `"/settings/$1"` value before the fix landed.+- `curl -s -o /dev/null -w "%{http_code}" https://three.ws/settings/connections` cannot be tested against production from this session (no deploy), but `vercel.json`'s rule change is verified by the passing test above, and `server/index.mjs`'s route-table loader (confirmed it reads `vercel.json`'s `routes` array at boot) needs no separate change.+- `public/settings/index.html` has a `data-tab="connections"` nav link, a `id="tab-connections"` panel, and a `loadConnections()` function that calls `GET /api/gateway/connections` and wires issue/redeem/patch/delete against the real endpoint (no mock data).+- The pathname-based tab resolution added in step 7 is present and the `#x`/`code`/`agent` query params are read inside the `connections` tab's load path.+- `docs/ux-flows/11-account-dashboard.md` line 167's stale "no page is served" clause is gone.+- `npm run check:rules -- --paths vercel.json public/settings/index.html tests/settings-connections-route.test.js docs/ux-flows/11-account-dashboard.md` reports no violations.+- A changelog entry exists and `npm run build:pages` ran cleanly.+- `npx vitest run tests/settings-connections-route.test.js` passes.++## Never blocked++| Apparent blocker | Resolution |+| --- | --- |+| "Should this live at `/settings/connections` (a path) or as a `#connections` hash tab, since the rest of this SPA is hash-routed?" | Both: fix the route so the path resolves to the SPA shell (step 4), and make the SPA's own tab router recognize that path (step 7). Every existing hardcoded reference uses the full path, so the path must work; the hash-tab mechanism is this page's existing internal routing convention, so the tab must also exist in it. Do not invent a third convention. |+| "Should per-API-key overrides, or a UI for `PATCH default_agent_id`, be in scope?" | `default_agent_id` PATCH: yes, it is a one-line addition to the row's edit affordance and the API already supports it. Per-API-key chat-pairing overrides: out of scope, not referenced by any of the four call sites this order fixes; chat pairing is inherently account-wide (a chat is paired with the account, then assigned a default agent), unlike the MCP tool-policy per-key overrides in a separate system. |+| "The `#x` outcome vocabulary in `api/auth/x/[action].js` might not match what I guess." | Do not guess. Read the file's actual `outcome` literal assignments (`grep -n "outcome:" api/auth/x/\[action\].js` or equivalent) and use those exact strings. |+| "This duplicates order 438/439/442/443/453/454." | No. Checked: none of those orders mention `/settings/connections`, `gateway/connections`, or the X-connect return-URL branches. This is a distinct, previously unfiled defect. |++## Report format++State: the vercel.json line changed (before/after `dest` value), the test file added and its pass/fail-then-pass sequence, which tabs/panels were added to `public/settings/index.html` with line ranges, the docs line fixed, the changelog entry, and the commit hash. Note explicitly that step 8's three message-copy sites needed no text changes (already correct once the route works).diff --git a/prompts/finish/456-auto-mcp-tools-settings-page.md b/prompts/finish/456-auto-mcp-tools-settings-page.mdnew file mode 100644index 000000000..364624f29--- /dev/null+++ b/prompts/finish/456-auto-mcp-tools-settings-page.md@@ -0,0 +1,75 @@+# 456. Every disabled-tool refusal points agents at `/settings/mcp-tools`, a page that was never built++How to run: paste this file's repo path into a fresh Claude Code chat in this repository and say "run this work order". Runnable now, no gate, no owner action required.++## Operating clause (binding)++- Read CLAUDE.md first. CLAUDE.md overrides everything, including this file.+- Finish 100% in this session. Never end the turn with a question, an option list, or an unexecuted plan.+- The only permitted stops are the CLAUDE.md stop-and-ask gates (spend/on-chain writes, push/deploy, posting externally, committing content referencing a crypto project other than `$THREE`, destroying unrecoverable data). This order touches none of them: it writes settings that gate tool *visibility*, it does not move funds itself.+- Concurrent agents share this worktree: stage explicit paths only (never `git add -A` or `git add .`), re-check `git status` and `git diff --staged` before committing.+- The em-dash and en-dash characters are banned in everything you write.++## Why this matters (measured 2026-10-25)++Every three.ws MCP server refuses a disabled tool call with a message that names a fix URL:++ curl -s -o /dev/null -w "%{http_code}\n" https://three.ws/settings/mcp-tools++returns 404 today. `find api -iname "*mcp-tools*"` finds only `api/_lib/viewer-mcp-tools.js` (an unrelated module: static tool definitions for the 3D-viewer MCP tools, not the tool-policy settings this order is about). `curl -s -o /dev/null -w "%{http_code}\n" https://three.ws/api/mcp-tools` also returns 404. `grep -rln "mcp_tool_settings" api/ src/` returns exactly two files: `api/_mcp/policy.js` (reads the table) and `api/_lib/migrations/20260922170000_mcp_tool_settings.sql` (creates it). There is no writer anywhere in the tree.++The backend this page needs already exists and is already wired to read from the table this order will start writing to:++- `packages/mcp-policy/src/runtime.js` line 23: `export const SETTINGS_URL = 'https://three.ws/settings/mcp-tools';`, quoted by `createPolicy()` in every `tool_disabled` refusal (line 145) across every hosted MCP server. `packages/mcp-policy/README.md` line 217 confirms: "quoted in every refusal." `api/_mcp-studio/dispatch.js` line 393 builds the same URL independently for the studio surface.+- `api/_mcp/policy.js`'s own header comment (lines 1-16, read today) already states the intended wiring in the present tense: "saved settings in `mcp_tool_settings` ..., written by `/settings/mcp-tools` through `/api/mcp-tools`" and the migration's own header comment (`20260922170000_mcp_tool_settings.sql`) says the same thing and documents the exact settings shape: `{ "groups": { "<group id>": true|false }, "tools": { "<tool name>": true|false } }`.+- `api/_mcp/policy.js` already exports `loadToolSettings(userId, apiKeyId)` (reads the account row and, if present, the per-key override row) and `invalidateToolSettings(userId)` (clears the 15-second in-memory memo on every instance after a write, so a save takes effect immediately rather than waiting out the memo). Both exist today and need no changes; the writer endpoint this order adds should call `invalidateToolSettings(user.id)` after every successful write.+- `packages/mcp-policy/src/groups.js` lines 59-86 already export `GROUPS`, a frozen array of `{ id, label, summary }` for all 26 tool groups ("in the order the settings page and the skill document list them", per its own doc comment, written before this page existed), e.g. `{ id: 'trading', label: 'Trading', summary: 'Quote and execute swaps from an agent wallet, copy trading, and signal subscriptions.' }` and `{ id: 'wallet', label: 'Wallet', summary: 'Agent wallets: balances, portfolio, provisioning, and transfers out.' }`. This is the exact data the settings page needs to render; do not invent a second copy of group labels.+- `packages/mcp-policy/src/enablement.js`'s `settingsToTokens()` (lines 112-122) is the function that actually consumes a saved row: it reads `settings.groups` and `settings.tools` only (confirmed: no `tiers` key is read from saved settings, even though the live spec grammar elsewhere supports tier tokens). This means the correct v1 settings UI is a per-group on/off list, not a per-tier toggle: turning a group on takes precedence over its tools' tiers (per `enablementFromTokens()`'s documented precedence, "tool over group over tier"), so switching on a group such as `trading` or `wallet` is what actually unlocks the financial-tier tools inside it. A UI that only exposed a "financial tier" master switch would not match what the saved-settings format is capable of expressing, and would require inventing a new settings shape the reader does not support. Build the per-group list; do not add a `tiers` key to what gets written.+- `docs/prompts/03-mcp-tool-policy-skill.md` line 9 already lists this exact gap as open, written before this order: "the `/settings/mcp-tools` page and the `/api/mcp-tools` writer for `mcp_tool_settings` (nothing writes the table yet...)."++Net effect today: every agent, connector, or MCP client that is refused a financial-tier tool (swaps, transfers, launches, domain registration, deletes; the tools gated by `tool_disabled`) is told to visit a page that cannot load and has no way to turn the tool on at all, short of an operator hand-editing the database or every caller individually discovering and using the `X-Three-Tools` header / `npx three-ws tools` CLI escape hatches (which exist but are not self-discoverable from the in-product refusal message itself). This is a live production gap affecting every disabled-tool refusal, documented as open in two places in this repository already, with its entire read path already shipped and only the write path and the page missing.++This is a new finding, not a duplicate: `grep -rln "mcp-tools\|mcp_tool_settings" prompts/finish/` before this order returns nothing in the `401`-`455` range. It is distinct from order 455 (`/settings/connections`, chat-gateway pairing, a different table and a different API) despite both being settings-page gaps discovered in the same sweep; do not merge them, they have no shared code path.++## Task++1. Read `api/_mcp/policy.js` in full (currently ~200-300 lines; read all of it), focusing on `loadToolSettings`, `invalidateToolSettings`, and the `SETTINGS_TTL_MS` memo, to confirm nothing else needs to change there.+2. Read `packages/mcp-policy/src/groups.js` in full (`GROUPS`, `GROUP_IDS`, `TIERS`, `DEFAULT_TIERS`) and `packages/mcp-policy/src/enablement.js`'s `settingsToTokens` and `resolveEnablement` to confirm the exact settings shape consumed.+3. Read `api/notifications/preferences.js` in full as the closest existing pattern for a per-user settings writer endpoint in this codebase (zod body schema, `getRequestUser`, CSRF, a GET that returns the resolved view plus metadata the UI renders from, a PUT/PATCH that merges a sparse override).+4. Write a new endpoint `api/mcp-tools.js` (or `api/mcp-tools/index.js`, match whichever file-per-route convention `api/notifications/preferences.js`'s sibling routes use for a single-segment path; confirm by checking `vercel.json` for how `api/notifications/preferences.js` is routed and mirror it for `/api/mcp-tools`):+ - `GET`: require a signed-in user (`getRequestUser`), return `{ groups: GROUPS, account: <account settings.groups or {}>, key: null }` (no per-key UI in this order; see Never Blocked). Read the account row via `loadToolSettings(user.id)` from `api/_mcp/policy.js` (import it; do not reimplement the SQL).+ - `PUT` (or `PATCH`, match the verb `api/notifications/preferences.js` uses for its sparse-merge semantics): body `{ groups: Record<string, boolean> }`, validated with zod (`z.record(z.enum(GROUP_IDS), z.boolean())` or equivalent, reject unknown group ids rather than silently storing them), merged onto the existing account-wide row (`api_key_id IS NULL`) with an `INSERT ... ON CONFLICT (user_id) WHERE api_key_id IS NULL DO UPDATE` against `mcp_tool_settings`, merging into the existing `settings.groups` jsonb rather than replacing the whole `settings` object (so a future `tools`-level override, if ever added, is not clobbered). Call `invalidateToolSettings(user.id)` after the write. Gate with `requireCsrf` the same way `api/notifications/preferences.js` does.+5. Write the test first (this endpoint is new code, not a bug fix, but CLAUDE.md's "no mocks, no fake data" and "errors handled at boundaries" rules still apply: write a real integration-style test before claiming it works). Add `tests/api/mcp-tools.test.js` modeled on an existing `tests/api/*.test.js` settings-writer test (check `tests/api/` for one testing `notifications/preferences.js` or a similarly-shaped settings endpoint and copy its DB-mocking approach). Assert: (a) `GET` with no saved row returns `account: {}` and the full `GROUPS` list; (b) `PUT {groups:{trading:false}}` then `GET` reflects `trading: false` while other groups remain absent/default; (c) an unknown group id in the `PUT` body is rejected with a 4xx, not silently stored; (d) `invalidateToolSettings` is called exactly once per successful write (spy on the import). Run it, confirm the assertions fail against a stub/no-op handler (or against no handler at all, i.e. a 404) before the implementation exists, then implement step 4 and confirm it passes.+6. Build the page. Decide the route by following the existing `/settings` convention from order 455's investigation: `public/settings/index.html` is the identity/security SPA with hash tabs; `/settings/mcp-tools` is a distinct, deeper path already hardcoded by `SETTINGS_URL` as a full path (not a hash), so give it its own static entry rather than cramming a 26-row group list into the existing SPA's tab bar. Create `public/settings/mcp-tools/index.html` (a new, small standalone page, following the structural pattern of `public/settings/index.html`'s `<head>`/brand/i18n script includes, but its own self-contained script, not reusing the identity SPA's `navigate()` router) that:+ - On load, calls `GET /api/mcp-tools`, renders one row per entry in the returned `groups` array (label + summary from `GROUPS`, matching the exact copy already written in `packages/mcp-policy/src/groups.js`, do not rewrite the summaries), with a toggle reflecting `account[group.id] ?? true` (groups are enabled by default when unset, matching `defaultEnablement()`'s "nothing in `groups` means use the tier default" semantics; do not default an unset group to `false`, that would misrepresent the current effective state).+ - A single "Save" action that collects every row whose toggle differs from its loaded state into `{ groups: {...} }` and sends the `PUT`/`PATCH`, then toasts success or the real server error message (no fake "Saved!" if the request failed).+ - A short explanatory line at the top distinguishing read/write (on by default) from financial-tier tools (off unless the containing group is explicitly turned on), so a user understands what flipping a group does; this can summarize the three-tier model already documented in `packages/mcp-policy/src/groups.js` lines 7-20, do not invent new terminology for it.+ - A link to `packages/mcp-policy/README.md`'s public-facing explanation if one is published under `/docs`, or omit the link if none is (check `grep -rn "mcp-policy" docs/ data/pages.json` first rather than guessing a URL).+7. Add the route to `vercel.json`: a rule routing `/settings/mcp-tools` (and, if the page needs any sub-assets beyond the single HTML file, `/settings/mcp-tools/`) to the new static file, following whichever single-file-route pattern is simplest among the examples already in the file (e.g. the `/settings` -> `/settings/index.html` rule from order 455's investigation). Add this rule before any catch-all that could otherwise shadow it (check whether order 455 already landed its `/settings/(.*)` fallback fix by the time you run this; if so, make sure your new specific rule for `/settings/mcp-tools` is still reachable, i.e. placed before that catch-all in the `routes` array, since vercel-style route arrays match top to bottom).+8. Add the new page to `data/pages.json` (so it is sitemap-indexed, matching the project convention `tests/pages-routes.test.js` checks for) if that test's logic applies to this kind of page; read that test first to confirm whether a page needs a `pages/<name>.html` source to qualify, and only add the `pages.json` entry if your new file's location satisfies that check, otherwise state in your report why it was intentionally left out.+9. Run `npm run check:rules -- --paths api/mcp-tools.js tests/api/mcp-tools.test.js public/settings/mcp-tools/index.html vercel.json` (adjust the `api/mcp-tools.js` path to whatever you actually named the file in step 4) and fix anything it flags.+10. Add a `data/changelog.json` entry (tag `feature`, link `/settings/mcp-tools`) describing that agents and connectors can now turn on disabled tool groups themselves instead of hitting a dead link, then run `npm run build:pages` and confirm only the expected generated files change.+11. Read the full diff and confirm every changed/added line is one of the changes above.++## Done when++- `GET /api/mcp-tools` and a `PUT`/`PATCH` writer both exist, are covered by `tests/api/mcp-tools.test.js`, and the test file's assertions are confirmed to have failed before the implementation existed.+- `tests/api/mcp-tools.test.js` passes in full.+- The writer calls `invalidateToolSettings(user.id)` after every successful write (asserted by the test).+- A real page exists at a static path reachable as `/settings/mcp-tools` via a new `vercel.json` rule, rendering the live `GROUPS` list from `@three-ws/mcp-policy` (no hardcoded duplicate copy of group labels/summaries) and the account's actual saved state from `GET /api/mcp-tools` (no mock data).+- An unknown group id sent to the writer is rejected, not silently persisted.+- `npm run check:rules` on the touched paths reports no violations.+- A changelog entry exists and `npm run build:pages` ran cleanly.++## Never blocked++| Apparent blocker | Resolution |+| --- | --- |+| "Should per-API-key overrides get a UI too?" | No, out of scope for this order. `loadToolSettings` already supports a `key` row and the GET response shape in step 4 reserves a `key: null` slot for it, but building per-key UI means picking which API key is being edited (a second navigation dimension) and is a bigger, separable unit of work. Ship the account-wide toggle now; a later order can add key-scoped overrides on top of this endpoint without breaking it. |+| "Should this expose per-tool overrides (`settings.tools`), not just per-group?" | No. 26 groups is already a reasonably sized list; the full tool census is hundreds of entries. The saved-settings reader supports `tools` for exactly this kind of future refinement, but the account-wide group toggle closes the actual production gap (a 404'd fix-it link in every refusal message) without that complexity. |+| "Where exactly should the new page live, `public/settings/mcp-tools/index.html` or somewhere else?" | Confirmed by reading `SETTINGS_URL` in `packages/mcp-policy/src/runtime.js`: it is `https://three.ws/settings/mcp-tools`, a path, not a hash. Serve a real static file at that path; do not silently change `SETTINGS_URL` to point somewhere else; that constant is quoted verbatim in every refusal message already shipped to every connector. |+| "What if order 455 (the `/settings/connections` 404 fix) hasn't shipped yet when I run this?" | Irrelevant; they touch disjoint files (different APIs, different tables, different pages) and do not depend on each other. Run this order independently. |++## Report format++State: the new endpoint's file path and verb(s), the test file and its fail-then-pass sequence, the new static page's path and the `vercel.json` rule added for it, whether a `data/pages.json` entry was added (and why, per step 8), the changelog entry, and the commit hash.