Skip to content

feat(mcp): MCP Apps item card for pad_item on remote MCP (TASK-4465) - #2519

Merged
xarmian merged 8 commits into
mainfrom
rook/TASK-4465
Nov 13, 2026
Merged

xarmian merged 8 commits into
mainfrom
rook/TASK-4465

Conversation

@xarmian

@xarmian xarmian commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Remote MCP (/mcp) now ships an MCP Apps item card. Hosts that support MCP Apps render pad_item results as a small editable card; other hosts see one extra _meta key on pad_item and nothing else.

What changes

  • pad_item carries _meta.ui.resourceUri = ui://pad/item-card (plus the legacy flat ui/resourceUri) on the remote server only. Stdio (pad mcp serve) is unchanged.
  • New resource ui://pad/item-card (text/html;profile=mcp-app, _meta.ui.prefersBorder), served from a single self-contained HTML file embedded in the binary. No csp or domain, so the view has no network access; every call goes through the host as an MCP tool call on the connection's own token.
  • The card renders only for get, create, update, move, restore, claim and release results that are items; anything else renders nothing (zero height).
  • Edits: title and non-computed select fields only, each sent as one pad_item update with expected_seq and never content. update_conflict reloads the item and says so.
  • The view restricts its own calls to pad_item get/update, pad_collection list and the reserved pad_board show/changes. That allowlist lives in the view; the server cannot tell a card write from any other write on the same token.
  • PAD_MCP_APPS=off removes the metadata and the resource.
  • Build: web/scripts/build-mcp-app.mjs (part of npm run build) writes web/build-mcp-app/item-card.html, refusing anything over 512 KiB or with an external src/href. CI, Docker, nix and the Makefile placeholder build or stub it next to the materializer.
  • New exact-pinned devDependencies: @modelcontextprotocol/ext-apps 2.0.4 and its required peers @modelcontextprotocol/client 2.4.0, @modelcontextprotocol/core 2.4.0, zod 4.6.7.

Compatibility

  • Remote tools/list golden moves only by pad_item._meta; stdio goldens are byte-identical. No tool, action, parameter or result shape changes, so ToolSurfaceVersion is unchanged.
  • No store, migration or REST change.

Tests

  • Go: TestMCPApps_ItemToolCarriesUIMeta, TestMCPApps_ResourceRead, TestMCPApps_KillSwitch, TestMCPApps_EmbeddedBundleSelfContained, wire goldens.
  • vitest: src/mcp-app model, bridge (allowlist and a source scan for {@html, network APIs and model-messaging calls) and the card component (escaping, empty render, edit, conflict, error, title edit).

https://claude.ai/code/session_01Pa22hGNokx3Pi1fqL3EfXE

…(TASK-4465)

Only the required peers stay pinned: @modelcontextprotocol/client,
@modelcontextprotocol/core and zod. The view never imports React or the
server SDK.

Claude-Session: https://claude.ai/code/session_01Pa22hGNokx3Pi1fqL3EfXE
…K-4465)

The SDK and its MCP dependencies import zod as a namespace, which keeps
every error-message translation in the bundle (about 260 kB). With them
the item card cannot fit the 512 KiB cap; without them it is 484898 bytes.

Claude-Session: https://claude.ai/code/session_01Pa22hGNokx3Pi1fqL3EfXE
The card shows ref, title, collection, select fields, assignee, updated
time and a plain-text content preview. The title and non-computed select
fields are editable through pad_item update with expected_seq; a conflict
reloads the item. The bridge applies the host theme, style variables and
fonts. scripts/preview-mcp-app.mjs is a host stand-in for looking at the
built card and is not part of the build.

Claude-Session: https://claude.ai/code/session_01Pa22hGNokx3Pi1fqL3EfXE
…K-4465)

false, 0, no and off (any case, surrounding space ignored) all turn MCP
Apps off, matching PAD_MCP_ENABLED, so an operator copying that style
does not leave the item card on by accident.

Claude-Session: https://claude.ai/code/session_01Pa22hGNokx3Pi1fqL3EfXE
…y (TASK-4465)

The server refuses a repeated field key only on schema writes, so an
older or imported schema can still carry one, and a keyed each would
throw and blank the card. The select list now goes through uniqueBy.

Also: the content preview counts code points so a cut never splits a
surrogate pair, and the bundle build refuses a bundle containing
'<script', which could stop the inline script tag from closing.

Claude-Session: https://claude.ai/code/session_01Pa22hGNokx3Pi1fqL3EfXE
…(TASK-4465)

jose comes in through @modelcontextprotocol/client (^6.1.3); 6.2.17 is
younger than the floor the dependency age check enforces.

Claude-Session: https://claude.ai/code/session_01Pa22hGNokx3Pi1fqL3EfXE
@xarmian
xarmian merged commit 69fe177 into main Nov 13, 2026
15 checks passed
@xarmian
xarmian deleted the rook/TASK-4465 branch November 13, 2026 09:57
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.

1 participant