Implements MCP Apps support per SEP-1865, enabling MCP servers to return interactive HTML UIs (charts, forms, drawing canvases) that render inline in the Chat UI via sandboxed iframes.
McpAppIframe component renders sandboxed <iframe> with a full JSON-RPC 2.0 postMessage bridge (handshake, tool calls, resource reads, theme sync, size changes, display modes, teardown)_meta now flows from DB instead of being hardcoded to {}_meta from tool definitions and persist itunsafe-eval), origin validation via window.location.origin, tool visibility filtering (app-only tools hidden from LLM)New files:
platform/backend/src/database/migrations/0158_add_tool_meta.sql — adds meta JSONB column to tools tableplatform/shared/mcp-app-types.ts — shared TypeScript types for MCP App UI metadataplatform/backend/src/routes/mcp-app-proxy.ts — GET /api/mcp-app/resource (serves HTML with strict CSP) + POST /api/mcp-app/tool-call (proxies iframe tool calls)platform/frontend/src/components/chat/mcp-app-iframe.tsx — iframe component with JSON-RPC 2.0 bridgeplatform/backend/src/routes/mcp-app-proxy.test.ts — 8 backend tests (CSP, validation)platform/frontend/src/components/chat/mcp-app-iframe.test.tsx — 6 frontend tests (rendering, sandbox)Modified files:
mcp-client.ts, mcp-server.ts, tool.ts, mcp-reinstall.ts, mcp-server.ts routes — persist _meta during syncmcp-gateway.utils.ts — pass through _meta from DBanthropic.ts, openai.ts, gemini.ts adapters + llm-proxy-handler.ts + tools.ts — extract and persist _metachat-mcp-client.ts extracts toolUiMeta, filters app-only tools, routes.chat.ts streams data-tool-ui-metaglobal-chat-context.tsx handles the new stream part, chat-messages.tsx renders McpAppIframe, chat/page.tsx threads the propAll 23 review comments from @iskhakov on PR #2898 are addressed:
window.location.origin for postMessage validation (not hardcoded localhost)_meta.ui.csp (never unsafe-eval)app-only tools hidden from LLM)useOrgTheme() (not hardcoded “dark”)_meta to 3rd party clients_meta for 3rd party clients/claim #1301
dejan1007
@dejan1007
Archestra
@archestra-ai