mcp-use TypeScript API
    Preparing search index...

    Interface HostContextHandle

    Host environment and bridge availability for the current view.

    interface HostContextHandle {
        displayMode: DisplayMode;
        hostCapabilities: McpUiHostCapabilities | undefined;
        hostContext: McpUiHostContext | undefined;
        hostInfo: HostInfo | undefined;
        isAvailable: boolean;
        locale: string;
        maxHeight: number | undefined;
        maxWidth: number | undefined;
        platform: "web" | "mobile";
        safeArea: {};
        theme: "light" | "dark";
        timeZone: string;
        userAgent: string;
    }
    Index
    displayMode: DisplayMode

    How the host is currently displaying the view. "inline" until the host reports otherwise.

    hostCapabilities: McpUiHostCapabilities | undefined

    Host capabilities negotiated at initialization. undefined until the bridge has connected.

    hostContext: McpUiHostContext | undefined

    The host context object exactly as the host reported it, with none of the fallbacks the fields above apply. Use it to read host-specific fields this handle does not surface. undefined until the host first reports context.

    hostInfo: HostInfo | undefined

    Host identity (name and version). undefined until the bridge has connected.

    isAvailable: boolean

    Whether the MCP Apps bridge is connected. While false, every field holds its documented fallback.

    locale: string

    User locale (BCP 47). Falls back to "en-US" when the host does not report one.

    maxHeight: number | undefined

    Vertical layout budget in pixels: the most height the view can occupy.

    Derived from the host's container dimensions. When the host fixes the container to an exact height, that height is reported; otherwise the host's stated maximum is. undefined when the host reports no layout constraint — treat that as unbounded. The raw dimensions remain available on hostContext.containerDimensions.

    maxWidth: number | undefined

    Horizontal layout budget in pixels: the most width the view can occupy.

    Same derivation as maxHeight: an exact container width when the host fixes one, otherwise the host's stated maximum, otherwise undefined (unbounded).

    platform: "web" | "mobile"

    Host-reported platform. "mobile" on mobile hosts; otherwise "web". Inspector maps Desktop → "web" and Mobile → "mobile".

    safeArea: {}

    Mobile safe area insets in pixels. All zeros when the host reports none.

    theme: "light" | "dark"

    Host color theme. "light" until the host reports a theme.

    timeZone: string

    User timezone (IANA). Falls back to the browser's timezone, then "UTC".

    userAgent: string

    Host application user-agent string. Falls back to the browser's own user agent.