Skip to main content
MCP Apps SDK
import { App } from "@modelcontextprotocol/ext-apps";

Overview

The App class provides accessor methods for reading host state received during the initialization handshake. These methods return undefined before connect() completes.
MethodReturnsDescription
getHostCapabilities()McpUiHostCapabilitiesFeature detection — what the host supports
getHostVersion(){ name, version }Host identification
getHostContext()McpUiHostContextTheme, locale, display mode, dimensions, and more

Quick Example

const app = new App({ name: "MyApp", version: "1.0.0" });
await app.connect();

// Feature detection
const caps = app.getHostCapabilities();
if (caps?.serverTools) {
  const result = await app.callServerTool({ name: "get_data" });
}

// Host identification
const host = app.getHostVersion();
console.log(`Running in ${host?.name} v${host?.version}`);

// Host context (theme, locale, etc.)
const ctx = app.getHostContext();
console.log(`Theme: ${ctx?.theme}, Locale: ${ctx?.locale}`);
The sunpeak framework provides React hooks that wrap these accessors reactively: useHostContext, useHostInfo, useTheme, useLocale, and useDeviceCapabilities.