InjectWidgetProtocolOptions Class

Options for injecting the MCP Apps protocol into widget HTML.

Constructor

InjectWidgetProtocolOptions(name: str | None = None, version: str | None = None, available_display_modes: list[Union[Literal['inline', 'fullscreen', 'pip'], str]] | None = None, notifications: list[Union[Literal['tool-result', 'tool-input', 'tool-input-partial', 'tool-cancelled', 'host-context-changed', 'resource-teardown'], str]] | None = None, debug_csp_violations: bool = False)

Parameters

Name Description
name
Default value: None
version
Default value: None
available_display_modes
Default value: None
notifications
Default value: None
debug_csp_violations
Default value: False

Attributes

available_display_modes

Display modes this widget supports (e.g. ['inline', 'fullscreen']).

available_display_modes: list[Union[Literal['inline', 'fullscreen', 'pip'], str]] | None = None

debug_csp_violations

When true, injects a CSP violation listener for dev-time debugging.

debug_csp_violations: bool = False

name

The widget app name sent during ui/initialize. Defaults to 'widget'.

name: str | None = None

notifications

Host notifications to listen for (e.g. ['tool-result', 'tool-input']).

notifications: list[Union[Literal['tool-result', 'tool-input', 'tool-input-partial', 'tool-cancelled', 'host-context-changed', 'resource-teardown'], str]] | None = None

version

The widget app version sent during ui/initialize. Defaults to '1.0.0'.

version: str | None = None