Skip to content

web: full hostContext delivery + live host-context-changed updates #1567

Description

@cliffhall

Summary

Deliver the full hostContext to MCP App views and keep it live:

  • Initial hostContext carries theme, styles (Mantine design tokens), displayMode, availableDisplayModes, and containerDimensions (today: only theme).
  • Live changes — theme flip, container resize, maximize — push to the running view via the SDK's sendHostContextChange(patch) (no hand-maintained snapshot ref).

Why

hostContext is how a widget adapts to its host; carrying only theme means widgets tested against the inspector never see the fields real hosts send. Using the SDK's patch mechanism keeps us aligned with @modelcontextprotocol/ext-apps.

Reference implementation (PR #1510)

Re-implement informed by these changes at 33fac3f:

Depends on

  • hostContext utilities (AppRenderer/hostContext.ts)
  • CSP enforcement + resource-error surfacing in the bridge factory (same files; land first)

Wave 2 lane — sequential with the other AppRenderer/AppsScreen issues.

Notes

  • Manual check: theme toggle in the inspector should deliver host-context-changed to a running mcp_app_demo widget.
  • Coverage gate ≥90 on all four dimensions.

Part of the PR #1510 decomposition (see tracking issue).

Metadata

Metadata

Assignees

Labels

v2Issues and PRs for v2

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions