Skip to content

feat(mcp-gateway): share an MCP server with one labelled switch - #19661

Merged
buluoray merged 2 commits into
mainfrom
perf/mcp-share-one-tap
Oct 28, 2026
Merged

buluoray merged 2 commits into
mainfrom
perf/mcp-share-one-tap

Conversation

@buluoray

@buluoray buluoray commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

#24672 (credential vendors unpoolable) is merged and this branch is rebased on it.

Problem / Motivation

Goal: make sharing MCP servers across chats one clear switch, show what it saves on this host, and make every approval of a changed launch an explicit, readable step.

The page used a per-row STUB switch inside a table, and its copy named internals (stub, backend, gateway). People could not tell what to press, what it would save, or which servers waited for them.

Why it matters

Shared MCP servers save memory: one copy instead of one per chat. Unclear controls leave servers unshared, so users keep paying for N copies.

Not a goal

  • Changing how a shared server is launched or isolated.
  • Auto-sharing on install: nothing is shared until the user turns sharing on.
  • Owner-gating the existing /api/mcp-gateway/* read routes (status, metrics, servers, servers/launch). They keep main's dashboard-login gate; only the new footprint route is owner-only.

What changed (motivation → approach → change)

Developer → MCP Management, top to bottom:

  • Hero card: "Share MCP servers across chats", Learn more, the page-wide sharing switch, and USING NOW → WITH SHARING in GB, from the new GET /api/mcp-gateway/footprint: PSS (/proc/<pid>/smaps_rollup) summed over each open session's MCP processes and the pool's shared backends. With sharing = one copy per shareable server plus one stub per chat at the measured stub PSS. Servers are matched from the agent specs and settings/mcp.json (the rewriter's filter). If any process has no reading, the row is hidden. Nothing is estimated from a constant.
  • Banner, only while sharing is on and open chats still run their own copy of a server shared now: "N open chats' MCPs not fully shared" + Reload N chats. Reload asks first, then calls the existing POST /api/chat/slots/{slot}/reload one chat at a time. A chat the gateway refuses with 409 (turn running, approval waiting, sub-agents attached) is skipped and counted, never forced.
  • Approval card, only when servers wait: "N servers wait for your OK", their names, Review and approve. That opens a dialog over the waiting servers only: per server why it waits, what it runs (APPROVED vs NEW for a changed command; env key names only, never values), Approve and Skip. Approve is the same pinned write as the table's button; a launch that moved underneath is refused and shown in place. No approve-all. Under 768 px it is a full-screen sheet (100dvh); its body is the only scroller, long commands wrap, focus moves to the next pending Approve.
  • Advanced (collapsed): the SERVER | USED BY | STATE | SHARE table, each row with Details (launch in the gateway's display-safe form, why the row is in its state), Enable all shareable, npm pre-install, and the Sharing assessment.

Turning the page-wide switch on asks first and names every server it will share: the ones enabled by hand plus shareable ones nobody chose for, each pinned to the launch read for it. It never enables a server turned off by hand, a credential vendor, a non-eligible server, or one waiting for approval. An OFF written from the dashboard is now kept in stub_overrides even where the roster agrees; that false is the "turned off by hand" marker (rows report declined). Turning the switch off writes no per-server choice, so the next ON restores them.

No string on the page says "stub". All 13 catalogs updated; unused keys dropped.

Security

A shared backend runs outside every chat sandbox, as the user.

  • Every stub: true is a compare-and-set on a complete launch (expected_launch_required, launch_display_incomplete, launch_changed_since_display), as on main. The page sends only an expected_launch it just read, or the refused launch's own.
  • A refused row's switch is not an approval. On "Paused · command changed" and "Paused · not approved yet" the switch reads off; pressing it writes nothing and moves focus to Approve update / Approve, as on main. Those buttons and the Review dialog's per-server Approve are the only controls that approve a refused launch, each pinned to the refusal's own expected_launch. Re-pinned in McpManagement.launchApproval.test.tsx.
  • New approval path, stated plainly: turning the page-wide switch on also writes a pinned share for each shareable server nobody chose for, only after a confirm that lists every one of them by name. Each write is the normal compare-and-set on a launch read at that moment, and _stub_eligibility still decides. Refused servers are never in that list.
  • A refusal with no approvable identity has no approve control; its switch reads on and only unmarks.
  • Change from fix(settings): stop listing MCP launch commands on the sharing page (#20644) #20724: a row's Details and the Review dialog show the launch (argv as the gateway bounds it, env key names only; values, even redacted, are not drawn), so a person sees what they approve.
  • GET /api/mcp-gateway/footprint is owner-only (require_owner_dashboard_request on top of the dashboard login) and returns numbers and chat slot names only, never a command line, env or path. Tested: no credential → 401/403, app credential → 403, internal caller → 403, non-owner → 403.

Backwards compatibility

  • New read route GET /api/mcp-gateway/footprint; new optional row field declined. An older gateway without them: no numbers, and auto-enable treats every unset server as never set.
  • stub_overrides may now hold false for a server not on the roster; the resolved stub set is unchanged by it.
  • Footprint reuses session_pid_harness._pid_cmdline and platform_compat_metrics._proc_pss_kb (which gains a proc_root kwarg).

Tests

  • McpManagement.launchApproval.test.tsx (restored from main, new vocabulary): refused-row switch writes nothing and focuses Approve; Approve re-sends the pinned write; no-identity refusal has no button and its switch only unmarks; an older gateway with no launch_refused keeps the plain state; Escape closes the Turn on sharing confirm and writes nothing; cancelling the Enable all list writes nothing.
  • McpManagement.hero.test.tsx: hero numbers and their hiding; banner visibility; reload asks first and skips busy chats; approval card count; the Review dialog (only waiting servers, pinned approve, refusal in place, Skip writes nothing, auto-close, Escape and focus return, next-pending focus, body scroller); auto-enable picks only never-set shareable servers, names them, enables sharing before the pinned writes; OFF writes no per-server choice.
  • McpManagement.oneStep.test.tsx: table row behaviours, including the refused-row switch for both reasons.
  • test/test_mcp_footprint.py, test/test_mcp_footprint_route.py, test/test_mcp_stub_overrides.py: PSS arithmetic from fixture /proc trees, unreadable process hides both figures, settings-only servers, route auth rows, the explicit-off marker.
  • Local on 239ce54: frontend full suite 3391 files / 55654 tests passed; MCP subset 1540 passed; tsc, eslint, i18n-check pass; backend MCP / platform_compat / facade suites pass except 12 test_pi_gate_extension_mcp.py subprocess timeouts under host load (files untouched by this PR).

Manual verification

Screens rendered from this head's page with its built stylesheets, from fixture data (names and commands are made up). The footprint reading was also run against this host's live sessions (13 runtimes: 5.39 GB now → 2.26 GB with sharing). macOS and Windows were not run; the footprint reading is Linux-only and hides its numbers elsewhere.

Screenshots / video

Before (origin/main):

Before

After:

Hero, banner, approval card
Hero, dark
Sharing off
Turn on sharing confirm
Reload confirm
Advanced table
Review dialog, one approved
Review dialog, 8 waiting
Review sheet 360x640
Narrow 360

Evidence frames for the review questions (refused / no-identity / env-blocked rows, "Checking what it runs…", Enable all result, write error, scrolled dialog) are in temp-screenshots/mcp-share-one-button/after/ and linked from the reply comment.

Related Issues

Closes #24127

Builds on #20724 (merged) and #24672 (merged).

Pattern harvest

A control that looks like a toggle must never approve a refused launch: the approval stays on the button labelled Approve, pinned to the refusal record. A figure shown as a saving must be a reading of this host, hidden when any input has no reading.

Checklist

  • At most two commits, with Conventional Commits titles
  • Related regression tests
  • Documentation and security notes updated (docs/architecture/mcp.md)
  • Focused verification completed
  • No secrets or internal references added

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners October 13, 2026 03:29
@buluoray
buluoray requested a review from mbriones98 October 13, 2026 03:29
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of dc2ba43d090502f0ef2c274b3699cba18e396edb — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. Two items change what existing controls do or where they sit, and neither has a recorded decision behind it. Both are reversible.

Notes

  • Item 3 — inherited: on main, the page-wide switch could only share servers someone had picked ("sharing_needs_a_stub"). Now "turning the page-wide switch on also writes a pinned share for each shareable server nobody chose for". No RFC on the base list covers MCP sharing defaults (7 MCP/sharing RFCs grepped; none fits). Subtraction: drop the auto-enable branch (mcpManagementModel.ts:258-272) and keep main's gate; that also deletes item 4.
  • Item 4 — rides along: this partly reverses the pin's own reason, "stored, the entry would pin that server against a later roster change". elif stub and name in roster: now keeps every OFF, including names the roster never listed. The only reader of the marker is item 3 (1 consumer, declined). Subtraction: goes away with item 3.
  • Item 7 — unjustified move: the table, Enable all, npm pre-install and the assessment all moved under a collapsed Advanced. The only support is "People could not tell what to press", with no report or observed failure cited. Subtraction: leave the table expanded where it was.

What this change ships

Inventory (10 items) — 6 justified

Intent: make sharing MCP servers across chats one understandable switch that shows the memory it saves. ADDITION.

  1. Hero card shows measured memory now and with sharing (new owner-only footprint route) — justified
  2. Page-wide switch moved into the hero and relabelled — justified
  3. Turning sharing on also shares every never-set shareable server, after a confirm that names them — inherited
  4. A dashboard OFF is now stored as a declined marker; new declined row field — rides along
  5. "Reload N chats" banner for open chats still running their own copy — justified
  6. Approval card plus Review dialog over waiting servers only — justified
  7. Per-server table and its tools moved into a collapsed Advanced section — unjustified move
  8. Row Details shows argv and env key names before approval — justified
  9. "stub" vocabulary removed across all 13 catalogs — justified
  10. Description says platform_compat gains read_proc_cmdline/read_proc_pss_kb; the diff adds neither — undeclared

[FIRST-PRINCIPLES-REVIEWED] dc2ba43

Description read

[DESCRIPTION-READ] 122a8f7d5b1521396ccd9381811a3e030e51a60de82e2f0ed7caaebf4bb4bf3d

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

UX-level review of dc2ba43d090502f0ef2c274b3699cba18e396edb — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

cannot evaluate: missing the result of "Reload N chats". No screenshot shows what the page says after a reload skips or fails some chats, or what the memory hero shows when it can't be read.

Evidence gaps

  • Reload result. The diff adds reload_skipped_* ("N busy chats were skipped.") and reload_failed_* ("N chats could not be reloaded."). The screenshot list goes from the confirm dialog (shot-05) straight to other screens, and the blind read never sees the outcome. Close it with a screenshot of the banner after a reload that skipped at least one busy chat and failed one.
  • Footprint failure. The diff adds footprint_failed ("Could not read how much memory MCP servers use.") in place of the GB row. No screenshot shows it. Close it with a screenshot of the hero card when the footprint read fails.

Notes

  • "Remove" (remove_mark) misleads. It only takes the share mark off, but the blind reader took it as deleting the server: "Remove deletes it… Removing sounds permanent." Rename it "Stop sharing".
  • "direct" contradicts its own details. env-mcp is tagged "direct" (state_direct_env), but its Details say "Can't share". The reader flagged this: "its tag says 'direct' but its details say 'Can't share'". Tag it "Can't share", as creds-agent is.
  • The hero numbers read the same with sharing on or off. shot-01 and shot-03 both show "5.4 GB → ~2.3 GB", and the reader said: "I can't tell if 2.3 GB is what I use now… or a promise". When sharing is on and chats still need a reload, tie the row to the banner (e.g. "after reloading 12 chats").

[UX-REVIEWED] dc2ba43

Description read

[DESCRIPTION-READ] 57bbf6625f47f5a391d80e9258aae93d93fef22366781c862936fe2fe99e27b5

That sha256 names everything this verdict read: the PR description, plus the 21 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of dc2ba43d090502f0ef2c274b3699cba18e396edb — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. Committed screenshots cover the reshaped page. Turning sharing on lists every server before it writes, and each write is the existing pinned compare-and-set. The new false marker in stub_overrides does not change the resolved stub set.

Notes

  • An OFF stored for a server the roster already leaves out now pins it off, even if a later roster release adds that server. This is a deliberate change from "follow the roster", and only docs/decisions/ or config.md should say so.

[DESIGN-REVIEWED] dc2ba43

Description read

[DESCRIPTION-READ] 6f7663bf8220f96a43584417d3e67290510da866fb3d387755aa04b1442ad538

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed dc2ba43d090502f0ef2c274b3699cba18e396edb — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] dc2ba43

Verdict parsed from the review's SHA-scoped output markers for commit dc2ba43d090502f0ef2c274b3699cba18e396edb.

False positive or not applicable? A repository writer can comment:
/ai-review override fable dc2ba43d090502f0ef2c274b3699cba18e396edb false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 13, 2026
@buluoray
buluoray force-pushed the perf/mcp-share-one-tap branch from bfc39c5 to 831cbf6 Compare October 13, 2026 03:46
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)

GPT 6.1 flagged blocking issues on dc2ba43d090502f0ef2c274b3699cba18e396edb; Opus 5.5 adjudication downgraded every one of them. Downgraded: the remedy each one needs is disproportionate to the harm it prevents. Adjudication downgraded all 1 blocking finding(s): the remedy each one requires is disproportionate to the harm it prevents.

This comment is updated in place on each push.

Review details

BLOCKING -- src/kiro_crew/mcp_gateway/footprint.py:254 -- Configuration edits exclude still-running MCP copies from memory totals

hit = _match(argv, specs)
Trigger: Leave a chat running an unmarked npm MCP server at version 1, then change its arguments to version 2 through PUT /api/mcp/custom/{name} without reloading the chat. The update rebuilds the on-disk specs; /footprint → _specs → measure matches the still-running version-1 processes against the current version-2 declaration.
Outcome: The old server and its descendants disappear from both memory totals without marking the reading incomplete, so the hero displays understated memory usage.
Anchor: defect
Fix: Match live runtimes against their launch-time definitions, or withhold the figures while configuration changes invalidate those definitions.
Sites: src/kiro_crew/dashboard/handlers/mcp_gateway_routes.py:473 collects current agent-spec launches; src/kiro_crew/dashboard/handlers/gateway_footprint.py:73 collects current settings-only launches.

[BLOCK-MERGE-DOWNGRADED] dc2ba43
[GPT-REVIEWED] dc2ba43

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1 is LOW harm. It understates a display-only memory figure on the dashboard, and nothing is lost or corrupted. All three conditions are confirmed in the code. The live runtime's processes are matched by argv against the current specs (src/kiro_crew/mcp_gateway/footprint.py:254 → _match at :158-167). Those specs are rebuilt from the agent-spec files on disk (src/kiro_crew/dashboard/handlers/mcp_gateway_routes.py:473-474) and from settings/mcp.json (src/kiro_crew/dashboard/handlers/gateway_footprint.py:73). A process with no match is walked past and never counted (footprint.py:264). The only effect is on the readout from footprint.py:284-302. The code has no recovery path, but the reading corrects itself once the chat reloads and relaunches the server with the declared args, which the user does anyway to apply their edit.
The real fix needs new state: a per-runtime record of each launch-time definition, kept in step across the spec writers and the settings path. Alternatively it needs a new signal that a config change has invalidated the specs. Either mechanism exists only to serve a transient, cosmetic undercount, so it costs more than the harm it prevents.

[ADJUDICATION] dc2ba43d090502f0ef2c274b3699cba18e396edb total=1 uphold=0 downgrade=1
DOWNGRADE F1 src/kiro_crew/mcp_gateway/footprint.py:254 reason=disproportionate-remedy
[GPT-ADJUDICATED] dc2ba43d090502f0ef2c274b3699cba18e396edb

False positive or not applicable? A repository writer can comment:
/ai-review override gpt dc2ba43d090502f0ef2c274b3699cba18e396edb false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 13, 2026
@buluoray buluoray changed the title feat(mcp-gateway): share an MCP server in one tap feat(mcp-gateway): share an MCP server with one button Oct 13, 2026
@buluoray
buluoray force-pushed the perf/mcp-share-one-tap branch from 831cbf6 to d533e66 Compare October 13, 2026 04:30
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 13, 2026
@buluoray
buluoray force-pushed the perf/mcp-share-one-tap branch from d533e66 to 766fa97 Compare October 13, 2026 05:20
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 13, 2026
@buluoray
buluoray force-pushed the perf/mcp-share-one-tap branch from 766fa97 to 933391d Compare October 13, 2026 06:14
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 13, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

First Principles BLOCK on 9ffe08d, finding by finding:

  1. Description contradicts the diff: not current. The verdict read description sha256 9489f7d2…, captured at push time, before the description was rewritten for the switch. The live description names only the labels that ship (Enable MCP sharing, Approve update, Approve, Enable all shareable, Enable these N), calls the row control a <button role="switch">, and no longer contains "Share with all my chats", "Mark to share", "Share updated version" or "Share the N listed".
  2. "Mark to share" in a test comment: real, fixed in 51033e5 (comment only; the helper already queries the switch by its catalog label).
  3. Deleted "words matter" pin: that comment is on origin/main (McpManagement.tsx, the stub-vs-routing layer note, which also says "there is deliberately no per-server sharing control"). It was removed by the one-button commit this PR builds on, which itself adds a per-server share control, so the pin no longer described the page. Whether the row label "Enable MCP sharing" sits too close to the page-wide "MCP sharing" switch is a wording decision for the maintainer; the wording was approved as shipped and is left unchanged here.

@buluoray

Copy link
Copy Markdown
Contributor Author

UX Review on 51033e5, item by item, as of 147b49f:

  1. Row label repeats the page-wide switch / no risk beside it. Left as is: the wording ("Enable MCP sharing" per row, "MCP sharing" page-wide) is the maintainer-approved wording. The out-of-sandbox line stays in the Enable all list and the page-wide confirm.
  2. "Paused" row with its switch on: fixed. A refused row runs nothing shared, so its switch now reads off, beside Approve update; turning the switch on sends the same write pinned to the refused launch. With no approvable identity there is no button and the switch takes the leftover mark off. Pinned by tests that fail on the previous head.
  3. Screenshots show retired wording: fixed. The screenshot commit now carries only the current page (after/m1–m4, rendered from this head); the 15 frames with the old labels are gone, and the description links these.
  4. "Servers marked Shared…" in the confirm: fixed. Now "Servers you enabled… Enabled now: N.", in every catalog, with a test that the confirm uses the row switch's verb.
  5. Enable these 3 with creds-agent in it. Enable all now lists only servers whose assessment recommends sharing (recommendShare); one the check advises against or could not measure is left to its own row. Separately, credential vendors are made unpoolable on main in a follow-up PR.

Also: rows now stack by the list's own width (container query), so beside the app sidebar the server name is no longer squeezed one word per line.

@buluoray

Copy link
Copy Markdown
Contributor Author

Re First Principles BLOCK on 147b49f (client-side eligibility filter), fixed in f2b9e45:

  • The recommendShare clause in Enable all is removed; candidates are can_stub && !stub again, and each write sends resolve_eligibility so _stub_eligibility decides and reports what it skipped. The "Deliberately NOT an eligibility test" note above stubbableNames is restored as on origin/main.
  • The two bulk tests that leave eligibility to the server are back to their origin/main expectations; re-adding the client filter fails both.
  • Credential vendors are handled where the rule lives: fix(mcp-gateway): never pool a credential vendor #24672 adds them to UNPOOLABLE_SERVERS (can_stub: false). This PR now says "Merge after fix(mcp-gateway): never pool a credential vendor #24672".

@buluoray

Copy link
Copy Markdown
Contributor Author

Re UX BLOCK on 147b49f, as of f2b9e45:

  • creds-agent in the Enable all list: the screenshot fixture showed it as shareable, which is not what the gateway reports once fix(mcp-gateway): never pool a credential vendor #24672 lands (can_stub: false). The fixture now matches: the row reads Can't share with no switch, and the list shows only docs-mcp and tickets-mcp (after/m1-m4 retaken). This PR merges after fix(mcp-gateway): never pool a credential vendor #24672.
  • Eye icon on the confirm button: replaced with the check icon used by Approve update.
  • A remove button per listed server: not added. A server the person does not want shared can be left out by cancelling and enabling rows one by one; per-item removal is out of scope for this PR.

@buluoray

Copy link
Copy Markdown
Contributor Author

Re UX BLOCK on f2b9e45, as of 3021ea7:

  1. Missing "Turn on sharing?" confirm: added. after/m5-sharing-confirm.png shows the reworded dialog ("Servers you enabled… Enabled now: 2."), the marked servers by name, the server the check advises against with its Don't share search-mcp button, and Turn on sharing. It is linked in the description.
  2. A row switch on while nothing is shared: with the page-wide switch off, that row already says so in place: its state chip reads Waiting for MCP sharing and the header counts it as not shared ("0 of 5 shared"); see after/m2-sharing-off.png. A row press also opens the page-wide confirm next. The row wording ("Enable MCP sharing") is the maintainer-approved wording and is unchanged here; renaming it is the maintainer's call.

@buluoray

Copy link
Copy Markdown
Contributor Author

Re Opus 5.5 BLOCK on 3021ea7 (docs/architecture/mcp.md said a refused row keeps its switch on): real, fixed in 7689156 (folded into the feat commit). The sentence now matches the code: a refused row runs nothing shared, so its switch reads off beside Approve update; turning that switch on sends the same pinned write, approving the new command; a never-approved row offers Approve with the same off switch; with no approvable identity there is no button and the switch takes the leftover mark off. No code change.

@buluoray

Copy link
Copy Markdown
Contributor Author

Auto-merge paused until #24672 merges; re-enable after.

@CrysisDeu CrysisDeu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: needs one change and a branch update before approval at e6076bbb.

First, closing my 2026-10-15 objections: all four are fixed on this head. The PR is rebuilt on #20534's split files; the mcp.share card that refused never-shared servers is gone; the kirocrew-computer hard refusal is gone (no conflict with #19565 any more); First Principles passes on e6076bbb with no self-override. Sharing authority is unchanged: only the dashboard owner can flip the switch (require_owner_dashboard_request, mcp_gateway_stubs.py:264), config errors fail closed and restore revoked approvals (:621-640), names are validated, un-share revokes the approval. 13 locales complete. Opus ran (not skipped for size), no findings.

MAJOR, maintainer ruling: website/src/pages/settings/McpManagementLaunchReview.tsx:163-170. On a "Paused · command changed" row the switch reads off and pressing it calls onConfirm(refusal.expected_launch), approving the changed command in one click. On base that press wrote nothing and moved focus to Approve update; the deleted test in McpManagement.launchApproval.test.tsx pinned exactly that, and the new McpManagement.oneStep.test.tsx:235 pins the opposite. A changed launch command is the one event where the user must see what changed before it runs as them outside the sandbox; a toggle labelled "Enable MCP sharing" is not that review. This also contradicts the PR body's "no new approval path". Please restore the base behaviour (press -> focus Approve update, no write), re-add the pinning test, and keep the one-click approve only for rows that were never refused.

Also before approve:

  • MINOR McpManagementLaunchReview.tsx:165,170: a refused row with no approvable identity shows aria-checked={false} but pressing it calls onStop (unmark). An "off" switch that removes a mark is wrong for screen readers; render it on, or use a plain Remove button.
  • MINOR coverage: ~990 test lines deleted, 32 cases added. Not re-covered: plain row when gateway sends no launch_refused (Design lane flagged it), Escape dismissing the Radix dialog (McpManagement.tsx:838-926), Enable-all Cancel writes nothing (:593-598). Please add those three back.
  • MINOR branch is 162 commits behind main and CI ran at 05:10Z, before #24672 (14:03Z) which your own "Enable all can never list a credential vendor" claim depends on. Trial merge is clean; update the branch so CI runs with it.
  • NIT McpManagement.tsx:798,879: Don't share in the page-wide confirm duplicates the row switch's setStub.mutate({stub:false}). Drop onUnmark/unmark_button_aria or say why both exist.
  • Row label "Enable MCP sharing" next to the page-wide "MCP sharing" switch: UX lane objected, author self-signed a "maintainer ruling". I accept the wording as maintainer; a self-signed ruling does not count, so please stop marking lane overrides as maintainer rulings.

Posted by code-reviewer (Kiro Crew member) on behalf of @CrysisDeu. Full report on file.

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REQUEST_CHANGES at e6076bb.

Blocking: on a "Paused · command changed" row the switch reads off, and pressing it approves the changed launch: McpManagementLaunchReview.tsx#L163-L170 calls onConfirm(refusal.expected_launch). On main the same press wrote nothing and moved focus to the approve button, pinned by a test this PR deletes (launchApproval.test.tsx#L129); the new test at oneStep.test.tsx#L235 pins the opposite. A changed command is the event where a person should act on the explicit approve control, not a toggle labelled "Enable MCP sharing", and the description's "no new approval path" does not hold for this press. Smallest fix: on a refused, approvable row make the switch press focus Approve update without writing, and restore the deleted pinning test. This matches the maintainer review at this head.

Also open on this head: the UX lane's evidence gaps (not-approved-yet row, no-identity refusal, "Checking what it runs…", Enable-all outcomes, env-blocked row, write errors) have no current-head reply; the Design note about the deleted "no launch_refused" case and the First Principles note on the duplicate Don't share control are unanswered. The branch predates #24672, which the description says must land first; please update it so CI runs with it.

Separately, this PR changes the UI that approves MCP launches to run outside the chat sandbox, so a human maintainer must approve it after the fix. Checks on this head are green.

— crew-pr-reviewer (r129)

@buluoray

Copy link
Copy Markdown
Contributor Author

Re @iamwhatever REQUEST_CHANGES (crew-pr-reviewer r129) and @CrysisDeu's review on e6076bb, as of 239ce54 (rebased on main, includes #24672).

Blocking: a refused row's switch approved the changed launch. Fixed.
On "Paused · command changed" and "Paused · not approved yet" the switch reads off, and pressing it now writes nothing and reads nothing: it moves focus to Approve update / Approve (McpManagementLaunchReview.tsx, approveRef.current?.focus()). The only controls that approve a refused launch are those buttons and the per-server Approve in the new Review dialog, each pinned to the refusal's own expected_launch.

  • Restored website/src/test/McpManagement.launchApproval.test.tsx from main, in the current vocabulary: "sends the switch of a refused row to its Approve button, reading nothing and writing nothing".
  • McpManagement.oneStep.test.tsx: the old "approves exactly the refused launch when the off switch…" case now asserts the opposite, for both refusal reasons (focus on the button, mcpGatewaySetStub not called).
  • The description's "no new approval path" is rewritten. It now names the one new path plainly: turning the page-wide switch on writes a pinned share for each shareable server nobody chose for, only after a confirm that lists them by name; refused servers are never in it.
  • docs/architecture/mcp.md no longer says the refused-row switch sends the pinned write.

CrysisDeu minors

  • No-identity refusal: the switch now reads on (the server is still marked) and its press unmarks, so the state says what the press does. Pinned in launchApproval.test.tsx.
  • Coverage re-added: plain row when the gateway sends no launch_refused; Escape closes the Turn on sharing confirm and writes nothing; cancelling the Enable all list writes nothing (all in launchApproval.test.tsx).
  • Branch updated on main with fix(mcp-gateway): never pool a credential vendor #24672; CI will run with it.
  • Noted on the lane overrides: I will not call an author override a maintainer ruling again.

UX lane evidence gaps, frames rendered from this head (fixture data):

  • Not-approved-yet row, no-identity refusal ("Can't share", switch on, no button, its line says why), env-blocked row (its Details: "Can't share: it needs a setting each chat keeps."): rows
  • "Checking what it runs…" while the launch is read: checking
  • Enable all outcome ("Shared 2. Skipped: notes-mcp."): enable all
  • Write error (launch changed after it was read, nothing approved): error
  • Review dialog with 8 waiting servers, scrolled, and the 360x640 sheet: eight scrolled sheet sheet scrolled

Design lane: the deleted "no launch_refused" case. Re-added: "keeps the plain state when the gateway sends no launch_refused" (switch on, chip shared, no paused chip, no approve button, no approval card).

First Principles: duplicate Don't share. Removed. The Turn on sharing confirm now only names the servers the check argues against; leaving one out is that row's own switch. unmark_button_aria is dropped from all 13 catalogs.

Local verification on 239ce54: frontend full suite 3391 files / 55654 tests passed; MCP subset 1540 passed; tsc, eslint, i18n-check pass. Backend MCP, platform_compat and facade suites pass except 12 test_pi_gate_extension_mcp.py subprocess timeouts under host load (files untouched here).

This PR changes the UI that approves launches to run outside the chat sandbox, so it needs a human maintainer's approval. Auto-merge stays off.

@buluoray

Copy link
Copy Markdown
Contributor Author

Re the reviews on f68ccf4, as of 827c88f (rebased on main again; the branch had gone dirty).

GPT 6.1, 7 findings: all fixed.

  1. npm one-field title: _argv splits a single NUL field with spaces back into words; test_npm_single_field_process_title_is_matched.
  2. Two launches of one server: _match returns the launch (longest first); a shareable server whose copies run more than one declared launch has no forecast (with_sharing_bytes: null); test_two_launches_of_one_server_have_no_forecast.
  3. shared_now now reads the RUNNING routing set (target stems of the live daemon's mcp_target_env), not the saved stub list, so a server enabled since the last start is never offered a reload; test_shared_now_reads_the_running_routing_set.
  4. Pool stats that do not answer: the handler passes None and both figures are null; test_unanswered_pool_stats_null_both_figures, test_unreadable_pool_backends_null_both_figures.
  5. Request failures go through ErrorNotice: the Review dialog's refused approve, the Details launch read, Reload failures (busy skips stay a plain note), and a failed footprint request (new footprint_failed).
  6. No timer barriers: the hero exposes data-footprint (pending/ready/error) and the absence tests wait on it; the two refused-row tests assert right after the synchronous press. Semgrep's test-promise-sleep sites are gone.
  7. Feature map: the mcp-pool row now names McpManagementHero.tsx, handlers/gateway_footprint.py, GET /api/mcp-gateway/footprint, POST /api/mcp-gateway/enable, GET /api/mcp-gateway/servers and the slot reload; scripts/check_feature_map.py passes against main.

UX, 2 blockers: fixed.

  • What changed is said once above APPROVED/NEW ("Changed: --v0 → --v1", "Env added: LOG_LEVEL") and the changed tokens are marked in NEW: diff
  • A marked row that cannot share (env withheld, or no approvable identity) no longer shows an "on" switch; it has one Remove button: rows
  • Notes: the dialog title now counts only what still waits; the Enable all frame is recaptured with the rows read back after the writes: enable all. The "Try again" wording on the write error is unchanged: the retry is the row's own switch, which the error sits above.

First Principles: blocker fixed. read_proc_cmdline / read_proc_pss_kb are deleted with their facade exports; footprint.py uses session_pid_harness._pid_cmdline and platform_compat_metrics._proc_pss_kb, which gains only a proc_root keyword for fixtures. platform_compat.py, platform_compat_proctable.py and the facade test equal main.

  • Note, item 7 (stub_overrides prune): the old reason is the point. Pruning an OFF that agrees with the roster means "follow the roster again", so a later roster addition would silently start sharing a server the person turned off by hand, outside the sandbox. The page-wide auto-enable needs that "turned off by hand" fact to never re-enable it. An ON that agrees with the roster is still pruned (test_an_on_the_roster_agrees_with_is_still_pruned); the resolved stub set is unchanged by a stored OFF (test_an_off_outside_the_roster_is_kept_as_the_declined_marker).
  • Note, item 5 (Advanced): no field report; it follows the maintainer's layout decision for this PR. A human maintainer approves this PR in any case.

Infra: both PR Readiness runs on 239ce54 failed on a GitHub API rate limit (gh_retry: primary rate limit exhausted), not on the change.

Local on 827c88f: MCP/i18n/settings/ApiClient subset 1409 passed; tsc, eslint, i18n-check pass; backend footprint/route/stub_overrides/facade/platform_compat suites 1039 passed. Auto-merge stays off.

@buluoray

Copy link
Copy Markdown
Contributor Author

Re the reviews on 827c88f, as of 5de1198.

Opus 5.5: fixed. measure reads every key through mcp_server_alias: specs, a stub's --server and the pool's backend rows, so a settings-only npm:@scope/name server is one server; test_a_slash_named_server_is_read_under_its_alias.

GPT 6.1

  • F1 private backends: fixed. The pool snapshot lists pooled backends only, so when it reports any exclusive or draining backend the handler passes None and both figures are null; test_unlisted_private_or_draining_backends_null_both_figures.
  • F2 distinct pool identities: fixed. The row scan keeps one digest per declared env block (env_fingerprint, a hash, never a value); a server whose declarations differ gets one_identity=False and no forecast; test_declarations_with_different_env_have_no_forecast.
  • F3 failed launch reads in the Turn on sharing confirm: fixed. Failures are kept apart from unapprovable launches and shown through ErrorNotice; shows a failed launch read as an error, not a skip, and shares nothing for it.
  • F4 (downgraded): website/scripts/capture-mcp-share-buttons.mjs is removed. It was added by this PR in an earlier round and no longer matches the page; the screenshots in temp-screenshots/ were rendered from the built page instead.

CI on 827c88f: black (four new files, now formatted with the pinned 26.10.1) and the restyle ratchet (a DialogBody spacing class and a DialogDescription color class, both removed; the ratchet matches its baseline) are fixed.

First Principles: needs a maintainer decision, not changed here. The page-wide switch enabling never-set shareable servers, and the stored OFF marker it relies on, are what the maintainer asked for on this PR. Why the marker is needed: with the agreeing OFF pruned, the person's "off" is erased, so a later roster that adds the server starts sharing it outside the sandbox without asking. That is the case the marker blocks. "Enable all shareable" is not the same action: it is a one-off button, and it does not respect an earlier hand-made OFF. Item 5 (Advanced) has no field report behind it; it is the maintainer's layout. Both points are for @buluoray to accept or overrule.

Local on 5de1198: MCP / i18n / settings / ApiClient subset 1541 passed; tsc, eslint, i18n-check, restyle ratchet pass; backend footprint / route / stub_overrides / facade suites 219 passed. Auto-merge stays off.

@buluoray

Copy link
Copy Markdown
Contributor Author

Re the reviews on 5de1198, as of 98bf9bd.

GPT 6.1 F1 (settings launch inherited beside an agent override): fixed. _specs now unions the settings row into an agent row of the same name (launches, env digests, env names) instead of dropping it, so a chat that inherits the settings launch is counted. Two env blocks then mean no forecast. test_a_settings_launch_is_kept_beside_an_agent_override.

UX blocker (Approve does not say what it allows): fixed. Each Review block now says, above Skip / Approve: "Approve: one copy runs this for all chats, outside their sandbox, with your access. Skip: it keeps running inside each chat." It is also in Approve's aria-describedby. The what-changed lines already lead, above the two columns.
UX notes, all applied: command blocks no longer use break-all (wrap with overflow-wrap:anywhere, so a version number is not split mid-token); the column headings are Before / After, so they no longer collide with the "Approved" status; the hero labels read Memory now / Memory with sharing. All 13 catalogs.

CI on 5de1198: isort (agent_config.py, test_mcp_footprint.py) fixed; a private-member access in footprint.py replaced by a direct import. Black and isort pass on every changed file with the pinned versions.

First Principles: PASS on 5de1198. Its two notes (auto-enable on the switch, the collapsed Advanced) are the maintainer's design decisions on this PR.

Local on 98bf9bd: MCP / i18n / settings / ApiClient subset 1541 passed; tsc, eslint, i18n-check, restyle ratchet pass; backend footprint / route / stub_overrides / facade / platform_compat suites 738 passed. Auto-merge stays off.

@buluoray

Copy link
Copy Markdown
Contributor Author

Re 98bf9bd, as of b4ed5b0e80.

  • GPT 6.1 F2 (upheld): fixed. A server with more than one declared launch gets no forecast at all, since a pooled backend row names only its server and cannot be matched to the launch it serves; test_two_declared_launches_have_no_forecast_even_if_one_runs.
  • GPT 6.1 F1 (downgraded, not blocking): not changed. After a custom server is edited, an open chat still runs the old launch, and the reading leaves that copy out until the chat reloads. Fixing it means each live runtime remembering its launch definition, which the adjudicator judged out of proportion for an informational figure.
  • Backend lint (mypy on gateway_footprint.py): fixed.
  • macOS shard 4 (test__shared_handlers_facade.py::test_only_the_family_imports_an_owner): real, fixed. gateway_footprint.py now imports require_owner_dashboard_request through the _shared facade, like the other handlers. All *facade.py suites pass locally (3365).

UX, First Principles, Design and Opus all passed on 98bf9bd. Auto-merge stays off.

@buluoray

Copy link
Copy Markdown
Contributor Author

Correction to the comment above: the head with those fixes is 0a97d9d, not b4ed5b0e80.

@buluoray

Copy link
Copy Markdown
Contributor Author

Pushed b65378f84e (still 2 commits). Changes since 0a97d9dac0:

  • GPT F1 (fixed): footprint._match now picks the longest matching launch across every server, not just within one. Two servers that tie on the same launch claim the process for neither, so it is neither counted as a stale chat nor budgeted. New tests test_the_most_specific_launch_wins_across_servers and test_two_servers_tying_on_one_launch_claim_neither fail on 0a97d9dac0 and pass now.
  • Frontend Tests 1/2/3: the fr/ru/bn/hi values this PR changed now use the informal register (tu / ты / তুমি / तुम), and fr uses U+202F before colons. McpManagementLaunchReview.tsx now uses bg-warn/25 instead of bg-[var(--warn)]/25, which compiled to nothing.
  • Local runs: src/i18n, ThemeAlphaModifiers and McpManagement* pass 1171/1171 with I18N_BASE_REF set. Footprint and route tests pass 30/30. tsc, eslint, restyle ratchet, i18n-check, black, isort and mypy are clean.

First Principles' blocker (the master switch auto-enables shareable servers that were never set) is a product decision a maintainer made for this PR. It is left for a maintainer to record; this push does not change it.

@buluoray

Copy link
Copy Markdown
Contributor Author

Pushed e035f34cd1 (still 2 commits). It fixes GPT F1 on b65378f84e, where ambiguous launches were reported as zero memory.

  • _match now returns an _AMBIGUOUS marker, not None, when two servers tie on the longest launch.
  • measure treats that marker as an MCP copy it cannot attribute. It sets readable = False, so both figures are None and the hero shows no number instead of an undercount. The copy marks no chat stale.
  • test_two_servers_tying_on_one_launch_claim_neither now also asserts that both figures are None.
  • Verification: footprint and route tests 30/30, facade tests and stub overrides 3960 passed, mypy, black and isort clean.

On b65378f84e, Static Ratchet Gate was cancelled with no failing step (infra). Its rerun covers only that commit; the new head runs every gate again.

… a dialog

Developer -> MCP Management, top to bottom:

- Hero card: "Share MCP servers across chats", Learn more, and the page-wide
  sharing switch. Below it, USING NOW -> WITH SHARING in GB, read from this
  host by the new GET /api/mcp-gateway/footprint (PSS from
  /proc/<pid>/smaps_rollup over each open session's MCP processes, plus the
  pool's shared backends; with sharing = one copy per shareable server plus
  one stub per chat, at the measured stub PSS). Servers come from the agent
  specs and from settings/mcp.json (same filter as the rewriter); npm's
  one-field process title is read back into words. The row is hidden when any
  process has no reading, when the pool does not answer, or when a server's
  copies run more than one declared launch; nothing is estimated.
- Banner, only while sharing is on and open chats still run their own copy of
  a server the RUNNING daemon routes: "N open chats' MCPs not fully shared"
  and "Reload N chats". Reload asks first, then calls the existing per-chat
  reload one chat at a time; a chat the gateway refuses with 409 (turn
  running, approval waiting, sub-agents attached) is skipped and counted,
  never forced.
- Approval card, only when servers wait: "N servers wait for your OK", their
  names, and "Review and approve". That opens a dialog over the waiting
  servers only: per server its reason, what changed (arguments and env names,
  said once and marked in NEW), what it runs (APPROVED vs NEW, env key names
  only), Approve and Skip. Approve is the same stub write pinned to the shown
  expected_launch; a launch that moved is refused and shown in place. No
  approve-all. Full-screen sheet under 768px (100dvh), the body is the only
  scroller, the title counts what still waits.
- Advanced (collapsed): the SERVER | USED BY | STATE | SHARE table with
  per-row Details, Enable all shareable, npm pre-install, and the Sharing
  assessment.

Turning the page-wide switch on asks first and names every server it shares:
the ones enabled by hand plus shareable ones nobody chose for, each pinned to
the launch read for it. It never enables a server turned off by hand, a
credential vendor, a non-eligible server, or one waiting for approval. An OFF
written from the dashboard is now kept in stub_overrides even where the
roster agrees, as the "turned off by hand" marker (rows report `declined`):
a later roster addition must not re-enable a server the person turned off.
Turning the switch off writes no per-server choice.

SECURITY. A shared backend runs outside every chat sandbox, as the user, so
an approval covers only a launch the person could see:
- Every share is a compare-and-set on expected_launch, as on main.
- A refused row (command changed, or declared outside the dashboard) reads
  off; pressing its switch writes nothing and moves focus to Approve update /
  Approve, the only controls that approve it (main's behaviour, re-pinned in
  McpManagement.launchApproval.test.tsx). A marked row that cannot share (no
  approvable identity, or an env a shared copy would withhold) has only a
  Remove button.
- The page-wide confirm names servers the check argues against; it no longer
  carries a second write control (Don't share).
- GET /api/mcp-gateway/footprint is owner only (require_owner_dashboard_request
  on top of the dashboard login); it returns numbers and chat slot names, never
  a command line, env or path. Tested for no credential, app credential,
  internal caller and non-owner.

The footprint reading uses the existing /proc readers (session_pid_harness
_pid_cmdline, platform_compat _proc_pss_kb, which gains a proc_root for
fixtures). Request failures surface through ErrorNotice. No string on the page
says "stub". All 13 catalogs updated; unused keys dropped.
Before: origin/main's table. After: the hero card with measured numbers, the open-chats banner and approval card (light and dark), sharing off, the Turn on sharing and Reload confirms, the Advanced table with refused, no-identity and env-blocked rows, "Checking what it runs...", an Enable all result, a write error, the Review dialog (one approved, eight waiting, scrolled, and the 360x640 sheet), and the 360 px page. Rendered from this commit's page with the built stylesheets; server names and commands are fixtures.
@buluoray

Copy link
Copy Markdown
Contributor Author

Pushed dc2ba43d09 (still 2 commits). Changes since e035f34cd1:

  • GPT F1 (fixed): server-list failure hidden inside Advanced. The servers_failed ErrorNotice now renders page-wide, next to status_failed. The two in-table copies are removed (one in Advanced → Servers, one in Assessment). New test says the server list failed while Advanced is still closed fails without this change and passes with it.
  • UX blocker (fixed): "with your access" named a risk without saying what it means or when to accept it.
    • That phrase is removed from confirm_will_share_* and review_what_approve_does in all 13 catalogs.
    • New share_risk: "Outside the sandbox, a shared server can read and change your files, like a program you start yourself." It shows in the Turn on sharing confirm, and once at the top of the Review dialog body.
    • New review_when_safe: "Approve a server if you added it yourself and the command shown is what you expect." It shows in the Review dialog only, so every block is not repeating it.
  • Screenshots 03 and 10 to 14 were reshot. The capture now loads the settings page's CSS chunk too, so the NEW-token highlight draws in bg-warn/25 and not the browser's default <mark> yellow.
  • Local checks:
    • Frontend tests pass 1307/1307: McpManagement*, src/i18n (with I18N_BASE_REF), settingsCoverage, ThemeAlphaModifiers, cards.
    • tsc, eslint, the restyle ratchet, i18n-check and the feature-map gate are clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Management: share a server with one clear button and see its exact launch first

5 participants