惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MongoDB | Blog
MongoDB | Blog
云风的 BLOG
云风的 BLOG
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
V
Visual Studio Blog
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
IT之家
IT之家
Vercel News
Vercel News
C
Check Point Blog
Google DeepMind News
Google DeepMind News
月光博客
月光博客
D
DataBreaches.Net
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog

Hacker News - Newest: "AI"

AI can't read an investor deck AI as an attorney? Student uses ChatGPT, Gemini to sue UW over alleged racial discrimination Hacking MCP Servers in AI Systems – The Rug Pull: Tool Changes After Approval GitHub - MeepCastana/KubeezCut: Free Web based video editor Can AI judge journalism? A Thiel-backed startup says yes, even if it risks chilling whistleblowers Coming soon: 10 Things That Matter in AI Right Now DARPA built an AI to fact-check enemy weapons claims What explains heterogeneity in AI adoption? When AI Meets Muscle: Context-Aware Electrical Stimulation Promises a New Way to Guide Human Movements - Department of Computer Science AI Changed How We Build. It Did Not Change What Matters. Linux rules on using AI-generated code - Copilot is OK, but humans must take 'full responsibility for the… Meta spins up AI version of Mark Zuckerberg to engage with employees Code Mode: Let Your AI Write Programs, Not Just Call Tools | TanStack Blog GitHub - Delavalom/graft: Go framework for building AI agents. Type-safe tools, multi-provider (OpenAI, Anthropic, Gemini, Bedrock), zero vendor SDKs. India's TCS tops estimates, says new AI models did not dent services demand Gen Z's fading AI hype Strong feeling: we are in a folded AI reality GitHub - machinarii/total-recall-catalog: A reference catalog of latest knowledge retrieval, memory & RAG systems GitHub - mensfeld/code-on-incus: Give each AI agent its own isolated machine with root, Docker, and systemd. Active defense detects and stops threats automatically.. Quantization, LoRA, and the 8% Problem: Benchmarking Local LLMs for Production AI Iran war: We spoke to the man making Lego-style AI videos that experts say are powerful propaganda Powell, Bessent discussed Anthropic's Mythos AI cyber threat with major U.S. banks GitHub - immartian/bellamem: Persistent belief-graph memory for AI agents. Retrieves decisive context by importance — not recency, not RAG, not /compact. recursive-mode: The Repo-Native Operating System for AI Engineering After the attack on Sam Altman's home, will AI CEO's go on the offensive? The biggest advance in AI since the LLM Opus 4.6 vs GPT 5.4 One Prompt Unity World Generation Test “AI polls” are fake polls Client Challenge Can AI be a 'child of God'? Inside Anthropic's meeting with Christian leaders
Add MCP Apps to your AI SDK application | Vercel Knowledg...
Ben Sabic · 2026-06-27 · via Hacker News - Newest: "AI"

MCP Apps let a Model Context Protocol (MCP) tool return an interactive UI instead of plain text. The model still calls ordinary MCP tools, but a tool can point to a ui:// resource that holds HTML, and your app renders that HTML in a sandboxed iframe. To build the host side, the AI SDK provides @ai-sdk/mcp helpers for advertising MCP Apps support, filtering which tools the model sees, and reading ui:// resources, plus @ai-sdk/react components for rendering the iframe and bridging its messages. Your chat can then display a dashboard, form, or other interactive view generated by a tool, while the untrusted HTML remains isolated.

In this guide, you'll learn how to:

  • Connect to an MCP server with MCP Apps capabilities
  • Pass only model-visible tools to the model with splitMCPAppTools
  • Read a tool's ui:// resource with readMCPAppResource
  • Proxy app-initiated tool calls safely from the iframe
  • Render the app UI in your React chat with experimental_MCPAppRenderer

Before you begin, make sure you have:

  • The ai package with @ai-sdk/mcp and @ai-sdk/react
  • The MCP TypeScript SDK (@modelcontextprotocol/sdk) and a provider package, such as @ai-sdk/openai
  • An MCP server that exposes MCP Apps tools (tools that point to ui:// resources)
  • A React app that uses useChat (the examples below use the Next.js App Router)

An MCP Apps host connects to an MCP server, decides which tools the model can see, and renders any app UI that a tool points to. At runtime, the host follows these steps:

  1. Connect to the MCP server with MCP Apps client capabilities.
  2. List the server's tools and split them by MCP Apps visibility.
  3. Pass only the model-visible tools to streamText or generateText.
  4. Read a tool's ui:// resource when its tool part includes MCP App metadata.
  5. Render the HTML resource in a sandboxed iframe.
  6. Proxy allowed iframe requests, such as app-visible tool calls, back to the MCP server.

The rest of this guide builds each step.

Create the MCP client with mcpAppClientCapabilities so the host advertises that it can render text/html;profile=mcp-app resources.

Advertise these capabilities only if your host can safely fetch and render MCP App resources.

MCP Apps tools can declare _meta.ui.visibility. Pass tools marked "model" to the model, and keep tools marked only "app" for iframe requests so the model never sees them. Split the tool list with splitMCPAppTools and pass modelVisible to streamText.

When the model calls an app-backed tool, the MCP client keeps the app metadata in the tool UI, which the React renderer uses to determine whether a tool part has an MCP App.

Read a tool's ui:// resource with readMCPAppResource before you send it to the browser host.

readMCPAppResource checks that the resource uses a ui:// URI, requires the MCP Apps MIME type, decodes text or base64 content, and returns the HTML along with rendering metadata such as its content security policy and permissions.

The iframe can't reach your MCP server directly. It sends JSON-RPC messages to your host, and your host decides which ones to allow. For an app-initiated tool call, confirm that the requested tool is app-visible before calling the MCP server.

In production, add any policy and user-approval checks your app needs before forwarding an iframe request.

In your React chat UI, render normal message parts as usual and pass tool parts to experimental_MCPAppRenderer.

experimental_MCPAppRenderer is experimental and may change in a future release.

experimental_MCPAppRenderer renders nothing for ordinary tools. For an app-backed tool, 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.

  • Treat MCP App HTML as untrusted. Render it in a sandboxed iframe, ideally through a sandbox proxy route on a separate origin.
  • Never pass app-only tools to the model. Use splitMCPAppTools and expose only the modelVisible tools.
  • Validate every iframe request on the server before you call client.callTool.
  • Cache resources by resourceUri so repeated tool calls don't refetch identical HTML.
  • Keep each tool's content and structuredContent useful on their own, so text-only hosts still work without the UI.
  • Close short-lived MCP clients when the response or host request finishes.