HOST is a reactive reference to $host — the MCP host context injected by the MCP Apps runtime. It gives your UI reactive access to environment information like the current display mode, available display modes, theme, and container dimensions.
Display Mode Toggle
The most common use ofHOST is building adaptive UI that responds to the current display mode. Combine it with If/Else and RequestDisplayMode to create a toggle:
Available Fields
The host context includes these fields (all dependent on what the MCP host provides):| Field | Type | Description |
|---|---|---|
displayMode | string | Current display mode: "inline", "fullscreen", or "pip" |
availableDisplayModes | string[] | Display modes the host supports |
theme | string | Host theme: "light" or "dark" |
containerDimensions | object | Container size with width and height |
MCP Only
HOST is only populated when the renderer is connected to an MCP host. In standalone mode (via prefab serve), $host is undefined. Use the default pipe to handle this gracefully:
Import
HOST is in prefab_ui.rx.mcp, not prefab_ui.rx, because it’s specific to the MCP runtime environment.