Skip to content

MCP: the answer card's messages go to card hosts only - #379

Merged
jrosskopf merged 2 commits into
mainfrom
fix/mcp-a2ui-card-hosts-only
Nov 18, 2026
Merged

jrosskopf merged 2 commits into
mainfrom
fix/mcp-a2ui-card-hosts-only

Conversation

@jrosskopf

@jrosskopf jrosskopf commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Why

_meta["triton/a2ui"] carries Triton's card plus a producer's basic-catalog surfaces and their data_model. It went to every MCP client while the widget was on, because #368 didn't know whether ChatGPT declares MCP Apps. The demo's per-call log lines settle it: ChatGPT (openai-mcp/1.0.0 (Codex)) and Claude (Claude-User) both declare io.modelcontextprotocol/ui. A client that can't render the card shouldn't receive its data either.

What

  • The card's messages go to card hosts only. The rule is decided per request, like the card text, the slim structuredContent (MCP: a card host's structuredContent is a summary of the card, not every row #376) and the in-card tokens (feat(mcp): in-card actions on the answer card via an app-only tool (#369) #374).
  • The in-card rerun path follows the same rule (crew finding). A valid token replayed by a request that doesn't declare MCP Apps gets the answer as any non-card client does: no card, no fresh controls. The reference hosts declare MCP Apps on widget calls; the demo log shows card_host: true before every in-card rerun.
  • Contract:
    • the rule keeps data away from clients that can't show it, and is not access control, since any caller can declare MCP Apps;
    • _meta.tool_trace (an opt-in debug sidecar) deliberately still goes to every client. This was your decision; there is a code comment too.
  • Architecture §8.7 and realizations §7 are updated.

Tests (red first)

  • A plain client gets no _meta["triton/a2ui"]: mcp_card_text, mcp_app_widget (customer path), mcp_in_card. The golden and embed-parity comparisons now run as a declared card host.
  • A sessionless replay of a valid in-card token gets no card, no token, and the full envelope.
  • A producer data_model marker appears nowhere in a non-card client's response. Mutation-checked: the test is red without the gate.
  • it: 758/758. Clippy is clean. Pre-push scripts/check.sh passed.

Review

The crew (security on Claude, correctness on Codex) approved after these follow-ups: the rerun gate (F1), the not-access-control sentence (F2), the tool_trace decision (F3), the replay and leak tests (F4), and dropping a redundant filter (F5).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

_meta["triton/a2ui"] (Triton's card plus a producer's basic-catalog
surfaces and their data_model) went to every MCP client while the widget
was on, because #368 did not know whether ChatGPT declares MCP Apps. The
demo logs show both reference hosts do (ChatGPT 'openai-mcp/1.0.0 (Codex)',
'Claude-User'), so a client that cannot render the card no longer receives
its data either: the same per-request card-host rule as the card text, the
slim structuredContent (#376) and the in-card tokens (#374).

Tests (red first): a plain client gets no _meta["triton/a2ui"]
(mcp_card_text, mcp_app_widget, mcp_in_card); the golden and embed-parity
comparisons run as a declared card host. Contract, architecture and
realizations updated.
…le (crew review)

- in_card_call took the card-host decision as given (answer(..., true,
  ...)): a valid in-card token replayed by a request that does not declare
  MCP Apps still got the card, a producer's data_model and fresh signed
  controls. card_host is now passed in; such a replay gets the answer as
  any non-card client does. The reference hosts declare MCP Apps on widget
  calls (demo log: card_host true before every in-card rerun).
- Tests: a sessionless token replay gets no card and no token and the full
  envelope; a producer data_model marker appears nowhere in a non-card
  client's response (mutation-checked: red without the gate).
- Contract: the card-host rule keeps data away from clients that cannot
  show it; it is not access control. tool_trace deliberately still goes to
  every client (comment + contract line). Drop a redundant filter.
@jrosskopf
jrosskopf merged commit a1bfb5b into main Nov 18, 2026
3 checks passed
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