Expand description
Transpile Smart Panels into MCP Apps (SEP-1865) resources.
MCP Apps — the first official MCP extension, released 2026-01-26 — lets a
server hand a host an interactive UI: an HTML document published as a
ui:// resource with mime type text/html;profile=mcp-app, rendered in a
sandboxed iframe that talks JSON-RPC to the host over postMessage. A tool
links to its view through _meta.ui.resourceUri.
§Why the two models line up
A Smart Panel is a declarative description of a view: kind, props, and a
query that re-derives its rows. An MCP App is a document that receives its
data by notification (ui/notifications/tool-result) rather than fetching
it up front. So a panel transpiles cleanly: the panel’s kind and props
become a static template, and the rows arrive at render time exactly as the
extension already intends.
That means one panel definition, stored once as facts, can drive a native
GUI (datagrout-panels-egui) and an MCP host — with no second authoring
step and no divergence between the two.
§Delivering rows
The host sends ui/notifications/tool-result. The document reads rows from
structuredContent:
- a single panel:
structuredContent.rows(or the wholestructuredContentif it is an array); - a dashboard:
structuredContent.panels, an object keyed by child panel id, each value a rows array.
§Where the panel comes from
Panels are published to DataGrout with the gateway’s smart_panel.publish
tool and read back with smart_panel.list; that response becomes Panel
values via datagrout_panels::Panel::all_from_list. A Panel built by
hand transpiles identically, which is how the tests here run.
§What this crate does and does not do
It emits documents and metadata. It does not serve them, register them,
or speak MCP — a server does that with whatever MCP library it already uses.
Keeping it a pure function of a Panel means it is testable without a
host and embeddable in any server.
Structs§
- Transpile
Options - Transpiler options.
- UiResource
- A transpiled panel, ready to publish as an MCP resource.
Constants§
- MCP_
APP_ MIME - The only mime type the MCP Apps MVP supports.
- UI_
CAPABILITY - The capability key a host announces UI support under.
Functions§
- to_
ui_ resource - Transpile a panel into a
ui://resource. - tool_
meta - The
_metaa tool carries to link itself to a panel’s view. - ui_uri
- Build the
ui://URI for a panel.