Expand description
Widget HTML bundle serving + asset discovery.
MCP servers can expose UI resources at ui://widget/<name>. This module
serves the bundled HTML either from a local directory (WidgetSource::Static)
or by reverse-proxying a dev server (WidgetSource::Proxy). Asset URLs in
the served HTML are rewritten to point at the proxy so they resolve
through the tunnel instead of the sandbox origin.
Used by the pipeline’s WidgetOverlayMiddleware (for resources/read
overlays) and by the widget static routes (/widgets/<name>.html,
/widgets, and arbitrary asset GETs).
Enums§
Functions§
- discover_
widget_ names - Discover available widget names from the widget source.
- fetch_
widget_ html - Fetch widget HTML for a given widget name (used by resources/read interception). Asset URLs are made absolute so they resolve through the tunnel, not the sandbox origin.
- list_
widgets - JSON list of available widgets at
/widgets. - serve_
widget_ asset - Serve a widget asset by path. Called from proxy’s catch-all handler for static asset requests.
- serve_
widget_ html - Serve raw widget HTML at
/widgets/{name}.html.