Skip to main content
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 of HOST 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):

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

Note: HOST is in prefab_ui.rx.mcp, not prefab_ui.rx, because it’s specific to the MCP runtime environment.