MCP Apps extend Model Context Protocol (MCP) tools with interactive UI resources. The model still calls ordinary MCP tools, but tools can point to a ui:// resource containing HTML that your app renders in a sandboxed iframe.
The AI SDK provides two pieces for building MCP Apps hosts:
@ai-sdk/mcp helpers for advertising MCP Apps support, filtering model-visible and app-visible tools, and reading ui:// resources.
@ai-sdk/react components for rendering the app iframe and bridging MCP Apps JSON-RPC messages.
MCP Apps tools can declare _meta.ui.visibility. Tools with "model" visibility can be passed to the model. Tools with only "app" visibility should be kept for iframe requests and not exposed to the model.
When the model calls an app-backed tool, the MCP client preserves the app metadata on the tool UI part. The React renderer uses that metadata to decide whether a tool part has an MCP App.
Use readMCPAppResource to read and normalize an app resource before sending it to the browser host.
app/api/mcp-app-host/read-resource/route.ts
import { readMCPAppResource } from '@ai-sdk/mcp';import { createMCPAppsClient } from '../../chat/mcp-client';export async function POST(req: Request) { const requestUrl = new URL(req.url); const { uri } = await req.json(); const client = await createMCPAppsClient(requestUrl.origin); try { return Response.json(await readMCPAppResource({ client, uri })); } finally { await client.close(); }}
readMCPAppResource verifies the resource uses a ui:// URI, requires the MCP Apps MIME type, decodes text or base64 resource contents, and returns the HTML plus rendering metadata such as CSP and permissions.
For ordinary tools, MCPAppRenderer renders the provided fallback (or nothing when no fallback is provided). For app-backed tools, it loads the resource, creates the sandbox bridge, sends tool input and result notifications to the iframe, and forwards supported app requests through your handlers.