Skip to content

docs: plan MCP source reconciliation - #1527

Merged
jhrozek merged 15 commits into
mainfrom
plan/mcp-source-reconciliation
Sep 23, 2026
Merged

jhrozek merged 15 commits into
mainfrom
plan/mcp-source-reconciliation

Conversation

@JAORMX

@JAORMX JAORMX commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Stage

Plan / Interface — scope and lifecycle amendment

Summary

  • Retain automatic ToolHive polling and MCP list-change notification reconciliation.
  • Preserve exact-name authority: removals filter availability, previously granted names can reappear, and explicit /mcp-refresh admits additions.
  • Use immutable runtime replacement and bounded run/operation pinning rather than durable digests, revocation records, or snapshot migration.
  • Retain one client-visible /mcp-refresh while direct and broker backend lifecycles remain separate.
  • Define candidate failures, no-op polling, retirement backpressure, explicit union persistence confirmation, and cancellation outcomes.
  • Rebase onto main ca993a6ea1b648e8e18a102b6810da5dea8c494f and resolve the ADR collision as proposed ADR 0351.
  • Record the directing human's approved lifecycle amendment: additive, idempotent Supervisor.Close() and rejection before direct-team enrollment when the configured member store cannot support rollback deletion. The plan now contains 13 acceptance criteria.

The earlier endpoint-identity amendment remains superseded: no new credential-free URL policy or routing digest is introduced.

Stack

Verification

  • Acceptance-plan checker: 13 ACs, zero failures.
  • task docs: passed, including the large-interface checker regression fix needed to avoid SIGPIPE in the existing fixture suite.
  • git diff --check: passed.
  • Fresh CI on 6ad42a98127e6a5bf18246dde8f83db909fb4b1a: CI, performance, and advisory checks passed. Conditional live-model tests were skipped. The PR is mergeable.

Tracking: #1511

@jhrozek jhrozek 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.

A few plan-review questions from a panel review (Spec/Standards/Test-adequacy/Domain), focused on scope-vs-issue framing and test-name granularity. No blockers — the broker-isolation concerns I initially had turned out to be moot once I confirmed mcp.mode is a mutually-exclusive global/broker switch, so broker and direct-MCP authority never coexist in the same session. Raised separately, as a top-level comment: a UX idea to unify /mcp-refresh and /tools-connect into one client-visible command.

🤖 Generated with Claude Code

@jhrozek

jhrozek commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

UX idea: unify /mcp-refresh and /tools-connect

Went through this plan against ADR 0335/#1530 (idle-session broker workspace refresh) with a focus on broker interaction, since both introduce an idle-session-only, owner-authorized "refresh my MCP tool set" control around the same time.

Once I confirmed mcp.mode makes broker and global/direct MCP mutually exclusive at the deployment level (internal/cliconfig/mcp_authority.go's ResolveMCPAuthority), the isolation concerns I initially had turned out to be moot — a session's Authority.CapabilitySet.Tools is never shared between the two, so there's no collision risk.

But that same fact raises a UX question: since which mode is running is (and should stay) an implementation detail, should the two refresh mechanisms present as the same command to the user?

Today, per this plan + ADR 0335:

  • Broker mode → /tools-connect
  • Global mode → /mcp-refresh

Two different verbs for the same underlying user intent ("re-check and re-admit my MCP tool set"), and which one exists on a given deployment is exactly the kind of thing mode-hiding is supposed to avoid surfacing. The same asymmetry shows up in the mecatui Ctrl+O//mcp panel too — renderMCPPanel hard-branches on st.brokerMode into two differently-shaped renderers (renderBrokerMCPPanel has an in-panel x keybinding to cancel a pending broker setup; the direct-mode inventory view has no equivalent affordance for the new generation/stale/degraded status this plan adds).

Proposal: make /mcp-refresh the one client-visible name in both modes (mecatui dispatches to whichever backend RPC the negotiated capability indicates), with /tools-connect becoming a deprecated alias — cheap to do now since #1530 hasn't merged yet. The underlying operations can and should stay separate (broker refresh is destructive and can launch external OAuth consent; direct refresh is a quick bounded set-algebra replace with no consent) — that's a real difference worth preserving in behavior and help text, just not in the command name. ServerCapabilities.mcp_refresh would also want to be derived the mirror-image way WorkspaceEnrollment already is (internal/app/build.go:2607, brokerProcess.WorkspaceEnrollmentRequired()) — true iff mcp.mode: global — so the two capability bits stay reliably mutually exclusive on the client side too.

Happy to take this on as a follow-up once this PR merges, if that's useful.

🤖 Generated with Claude Code

@JAORMX

JAORMX commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Adopted in f37c7d9ef. Mecatui now has one client-visible /mcp-refresh contract: direct mcp_refresh routes only to RefreshMcpSources; broker workspace_enrollment routes only to ConnectWorkspaceServices. /tools-connect remains a deprecated broker-only compatibility alias.

The operations remain separate. Broker routing preserves ADR 0335 consent/presentation, cancellation via /tools-cancel, and destructive replacement disclosure; direct refresh is consent-free. Both capability bits, missing collaborators, and other contradictory capability states fail closed, with no fallback or double operation.

The stacked implementation follows this updated plan; it has not merged.

@jhrozek jhrozek 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.

Re-approving after the latest push (316f99d) — reviewed the addressed-findings commit f37c7d9 previously; no new concerns since.

@jhrozek

jhrozek commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

ADR numbering collision: 0346 used twice

This PR adds docs/adr/0346-mcp-source-reconciliation.md, but main already has docs/adr/0346-unified-prompt-cache-dialect.md (landed via #1572, merged 2026-09-17, after this PR's ADR was numbered). Git reports no merge conflict (different filenames), but merging as-is leaves two ADRs both numbered 0346 on main.

This PR's ADR should be renumbered (e.g. to 0347) — plus any cross-references to "ADR 0346" in this PR's own docs (the acceptance plan review comments already reference it by number) — before merging.

@JAORMX
JAORMX force-pushed the plan/mcp-source-reconciliation branch from 316f99d to 0895417 Compare September 23, 2026 10:38
@JAORMX

JAORMX commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Rebased the plan onto main c006c9903 and resolved the reported ADR collision: the MCP decision is now proposed ADR 0350, with references updated throughout the stack.

The directing human also approved the narrow lifecycle amendment discovered during implementation review: an additive idempotent Supervisor.Close() cleanup seam and rejection before direct-team enrollment when the configured member store cannot support rollback deletion. The amended acceptance plan contains 13 ACs. Proposed status is preserved; no merged approval is claimed.

Plan baseline is now 08954175e8393f506d23c7575e59e29a551aefb2; #1673 is rebased directly on it. Local plan checker and task docs pass. Updated CI is being monitored.

@JAORMX
JAORMX force-pushed the plan/mcp-source-reconciliation branch from 0895417 to 6ad42a9 Compare September 23, 2026 11:33
@JAORMX

JAORMX commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Final stack update: current main advanced while the repairs were underway, so the plan is restacked on ca993a6e and the collision-free proposed ADR is now 0351 (superseding my earlier comment's 0350 reference).

Current plan head: 6ad42a98127e6a5bf18246dde8f83db909fb4b1a. CI and performance checks are green; GitHub reports the PR mergeable/clean. CI run.

The implementation remains stacked in #1673. No PR has been merged.

The implementation keeps the Service-level shared engine at its build
revision and promotes default-FS sessions to per-session engines after
the first republication. Record that exception in decision 6 so the
approved contract matches #1673; rebuilding the shared engine per
revision is tracked in #1802.

Co-Authored-By: mecatl <[email protected]>

@jhrozek jhrozek 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.

Approving the amended plan at 4ff51f3. Since my last approval the amendment adds Supervisor.Close/ErrSupervisorClosed and rollback-capable direct-team startup (decision 12, AC4.4), moves refresh eligibility checks before reconciliation, captures the shared-engine revision under one pin, and records the shared-engine promotion exception in decision 6 (rebuild tracked in #1802).

jhrozek and others added 4 commits September 23, 2026 17:23
Main allocated ADR 0351 (Mecatl Studio) and 0352 (jev delegated model
router) after the plan's last baseline sync, so the reconciliation ADR,
its index entry, and the two ADR-named verification functions move to
the next free number.

Co-Authored-By: mecatl <[email protected]>
Main allocated ADR 0353 (session-scoped agent identity) and 0354
(returned auxiliary usage results) after the previous renumber, so the
reconciliation ADR, its index entry, and the two ADR-named verification
functions move to the next free number.

Co-Authored-By: mecatl <[email protected]>

@jhrozek jhrozek 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.

Re-approving at the current head after syncing main and renumbering the ADR to 0355 (main allocated 0351–0354). No contract change since my previous approval.

@jhrozek
jhrozek merged commit 2f6a13d into main Sep 23, 2026
36 checks passed
@jhrozek
jhrozek deleted the plan/mcp-source-reconciliation branch September 23, 2026 19:11
jhrozek added a commit that referenced this pull request Sep 23, 2026
#1527 was squash-merged, so the plan commits this branch carried are not
ancestors of main. Resolve the two conflicts in the acceptance docs by
keeping main's text and this branch's landed status (plus the plan's
completion proof).

Co-Authored-By: mecatl <[email protected]>
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Sep 25, 2026
2 tasks
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.

2 participants