Skip to main content
NetScriptdocs Search docs ⌘K v0.0.9
Browse documentation

McpUiWidget

Themed sandboxed MCP ui:// widget frame — an allow-scripts-only iframe keyed on the active theme so theme changes force a full remount.

All components · Theme builder · Implementation source

Live preview

Open live mcp-ui-widget preview

The example frame is static. Connect a resolved host widget URL in your application.

Install

Shell
netscript ui:add mcp-ui-widget

Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

TypeScript
import { useState } from 'preact/hooks';
import McpUiWidget from '@app/islands/ui/McpUiWidget.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><McpUiWidget src="./widget/" theme="studio-utility" title="Host-provided MCP widget" /></div><p role="status">{notice}</p></>);
}

Props

Generated from native deno doc --json --private over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.

OwnerPropTypeOptionalDescription
McpUiWidgetPropssrcstringNoThe resolved `ui://` source served by the FA3 sandbox route (an absolute URL or an app-relative path to that handler). This is the frame origin; it must never be a same-origin application route.
McpUiWidgetPropsthemestringNoActive theme name. The iframe is keyed on this value for remount-on-change.
McpUiWidgetPropstitlestringYesAccessible title for the frame. Defaults to `"MCP UI widget"`.
McpUiWidgetPropssandboxstringYesOptional sandbox override. `allow-same-origin` is always stripped and `allow-scripts` is always guaranteed, so the frame stays restrictive on every render path. Defaults to {@link MCP_UI_WIDGET_DEFAULT_SANDBOX}.

Keyboard

Presentation component; no component-specific keyboard interactions.

Tokens

Semantic contract roles: border/default, radius/card.

CSS custom properties referenced directly: --ns-border, --ns-border-width, --ns-radius-card, --ns-radius-lg, --ns-surface, --ns-surface-raised.

Contract and compatibility

Accessibility pattern: noninteractive presentation

  • Native DOM attributes pass through where the implementation accepts them.

Design contract values marked planned are not implementation props. The props above describe what ships today.

Search all documentation

Type a term to search the documentation.