The client capabilities from the initialize response
The MCP Apps capability settings, or undefined if not supported
server.server.oninitialized = () => {
const clientCapabilities = server.server.getClientCapabilities();
const uiCap = getUiCapability(clientCapabilities);
if (uiCap?.mimeTypes?.includes(RESOURCE_MIME_TYPE)) {
// App-enhanced tool
registerAppTool(
server,
"weather",
{
description: "Get weather information with interactive dashboard",
_meta: { ui: { resourceUri: "ui://weather/dashboard" } },
},
weatherHandler,
);
} else {
// Text-only fallback
server.registerTool(
"weather",
{
description: "Get weather information",
},
textWeatherHandler,
);
}
};
Get MCP Apps capability settings from client capabilities.
This helper retrieves the capability object from the
extensionsfield where MCP Apps advertises its support.Note: The
clientCapabilitiesparameter extends the SDK'sClientCapabilitiestype with anextensionsfield (pending SEP-1724). Onceextensionsis added to the SDK, this can useClientCapabilitiesdirectly.