Skip to content

hub-mcp Phase 5: MCP-native surfaces (bd-rpra6kpq) - #798

Open
shikokuchuo wants to merge 3 commits into
braid/bd-738mbhpj-hub-mcp-phase-4-quarto-intelligencefrom
braid/bd-rpra6kpq-hub-mcp-phase-5-mcp-native-surfaces
Open

shikokuchuo wants to merge 3 commits into
braid/bd-738mbhpj-hub-mcp-phase-4-quarto-intelligencefrom
braid/bd-rpra6kpq-hub-mcp-phase-5-mcp-native-surfaces

Conversation

@shikokuchuo

Copy link
Copy Markdown
Member

Phase 5 of the hub-mcp elevation plan (bd-rpra6kpq), stacked on #797. The MCP server now speaks two more parts of the MCP protocol: resources and prompts. Design and full record: claude-notes/plans/2026-10-05-elevate-quarto-hub-mcp.md.

Resources (BP-5)

  • Every file in a connected project is an MCP resource. The URI contract is hub://project/<indexDocId>/<path>, with ?server= when a share URL routed the project to a different hub (Q-2). The document id lives in the path, because URI normalizers lowercase the host and document ids are case-sensitive.
  • resources/list paginates with nextCursor (100 entries per page) and lists the files of every connected project in a stable order. resources/read returns text contents, or base64 blob contents for binaries.
  • A client can subscribe to a file's resource. On the 2026-07-28 protocol the client opens subscriptions/listen. On the 2025-11-25 protocol the client sends resources/subscribe. Both receive notifications/resources/updated when the file changes, and notifications/resources/list_changed when files are added or removed.
  • Every write result carries a resource_link block to the file it touched. Hosts can use the link to attach or open the file.

Prompts (BP-6)

  • review-draft reads one file and walks the agent through a careful review. The draft is embedded under its hub:// URI.
  • collaborate-with-human teaches the etiquette for editing a project a human is working in.
  • safe-edit-workflow teaches the read → patch → confirm loop, with expected_hash discipline.
  • fix-render-errors teaches the render → diagnose → patch loop. It exists only with --allow-render, like the render tool itself. Read-only mode hides the two editing prompts.

Other changes

  • The server record, the prompts, and the resource template carry the Quarto icon (BP-9). Individual tools do not: an icon on each of 24 tools adds about 15 KB to every tools/list.
  • prompts/list and resources/templates/list carry long cache hints, because both lists are fixed at startup (BP-17). The tools and prompts capabilities now declare listChanged: false, matching that fact.
  • The server instructions describe the new surfaces, and the docs page gains a Resources and prompts section.

Verification

  • cargo xtask verify: all legs pass. The MCP suite: 527 passed, 3 skipped.
  • New tests cover both protocol eras. Legacy tests run in process. Modern tests drive a 2026-07-28 client over a real stdio server.
  • One verify run caught 82 unhandled rejections from a debounce race at shutdown. The fix is pinned by a regression test.
  • Agent-task evals: 15 of 15 tasks pass, median 5 turns per task, no regression.
  • Real-binary end-to-end recorded in the plan for both eras: list, read, subscribe, notified write, prompt render.

@posit-snyk-bot

posit-snyk-bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@shikokuchuo
shikokuchuo added this pull request to stack #792 October 7, 2026 09:01
…9/BP-17; bd-rpra6kpq)

Phase 5 of the elevate-quarto-hub-mcp plan.

BP-5 resources: every file of every connected project is an MCP
resource. Q-2 resolved — hub://project/<indexDocId>/<path>[?server=…]:
doc id in the PATH (RFC 3986 host normalizers lowercase; doc ids are
case-sensitive), the literal segment leaves room for other kinds, and
?server= mirrors the share-URL grammar for foreign-hub projects. The
Phase 4 ephemeral blob URI is aligned to the contract.

- resources/list paginates (nextCursor, PAGE_SIZE 100) across all
  connected projects, sorted by URI — hand-rolled on the low-level
  Server because the SDK's built-in list handler doesn't paginate.
- resources/read serves text and base64 blob contents; templates/list
  advertises hub://project/{indexDocId}/{path}.
- Dual-era subscriptions: modern (2026-07-28) subscriptions/listen is
  entry-routed, so the bridge emits every change; legacy (2025-11-25)
  resources/subscribe is tracked per connection and gates delivery
  (the SDK ships no legacy subscribe handler). createServer gains an
  era option fed by serveStdio's factory context.
- ConnectionManager.onProjectEvent seam (file added/changed/removed +
  connect/disconnect lifecycle); list_changed debounced 150 ms so a
  project connect's per-file adds collapse into one emission.
- resource_link blocks on every write-tool result (write_file,
  create_file, patch_file, rename_file → new URI, restore_file_version).
- Best-effort fan-out: sends guarded by isConnected(), the close-race
  NotConnected swallowed — caught by verify as 82 unhandled rejections
  with all assertions passing; regression test pins it.

BP-6 prompts: review-draft (embeds the draft as an embedded resource
under its hub:// URI), collaborate-with-human, safe-edit-workflow,
fix-render-errors — gated by mode (read-only drops the edit/render
pair; fix-render-errors requires --allow-render). Skills-over-MCP
deferred: prompts are the portable baseline.

BP-9 icons: the Quarto mark (data-URI inlined) on Implementation,
prompts, and the resource template — deliberately not per-tool (~15 KB
of agent context per tools/list for chrome; hosts fall back to the
server icon).

BP-17: long private cache hints on prompts/list and
resources/templates/list (static); resources/list|read keep no-cache
(live data). tools/prompts now honestly declare listChanged: false
(the SDK's registration default claimed true for static lists).

Tests: 17 legacy-era resource/prompt tests, 3 modern-era stdio tests
(2026-07-28-pinned SDK client over the real entry), 2 capability/
wire-schema conformance tests. Suite: 58 files, 527 passed + 3 skips.
Eval suite (15 tasks): 15/15 PASS, median 5 turns — no regression
from the Phase 5 surfaces (results/2026-10-07T08-19-49, transcripts
committed). Plan file records the Phase 5 completion: the Q-2 URI
contract decision, the SDK-v2.3.1 findings that shaped the design (no
paginating resources/list, no legacy subscribe handler, entry-owned
modern listen routing), the both-eras e2e transcript against the real
q2 mcp, and the verify catch (82 unhandled rejections from the
debounce close-race, fixed at the root). Braid snapshot refreshed
(bd-chtwjljk filed for the pre-existing README staleness).
- docs/tools/q2-mcp.qmd: warn users to treat hub:// resource URIs like
  share links — they carry the project's automerge doc id, a bearer
  capability on no-auth hubs; don't paste them or transcripts
  containing them into public channels.
- docs/tools/q2-mcp.qmd: escape a bare @ ("\@-mention") — pre-existing
  parse error that aborted the whole docs site render ("Rendered 0 of
  329 files"); site render verified green again. Nothing in verify/CI
  renders docs/, so the breakage was invisible — filed bd-drl44ho4.
- plan: record the Q-2 security considerations — doc id as bearer
  capability, automatic egress into transcripts/logs vs. deliberate
  share-URL distribution, leak asymmetry (standing access, no
  rotation), ?server= completing the locator+capability pair,
  injection-driven foreign dial-out residual risk.
- braid: file bd-zc3ubxiv (foreign-hub consent gate, with
  implementation assessment — left open, not scheduled) and
  bd-drl44ho4; export skein snapshot.
@shikokuchuo
shikokuchuo force-pushed the braid/bd-rpra6kpq-hub-mcp-phase-5-mcp-native-surfaces branch from 489286e to cc9cdf0 Compare October 7, 2026 13:45

This branch has not been deployed

No deployments
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