feat(MCP UI) chat widgets#2052
Open
dimetron wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds end-to-end support for rendering interactive MCP UI widgets (“MCP Apps”) inline in the chat UI, including: backend endpoints to proxy MCP app tool/resource calls, agent-side toolset detection and model-payload compaction for UI-capable tools, and frontend components/context to render and broker interactions with the embedded app.
Changes:
- Backend: detect MCP App-capable tools, filter app-only tools, and compact model-visible tool results to avoid repeated render/poll loops.
- Backend: add
/api/mcp-apps/...endpoints to list tools, call tools, and readui://resources fromRemoteMCPServer. - Frontend: render MCP apps within tool call UI; add MCP app inspector route; add (adjacent) file attachments + chat minimap UI.
Reviewed changes
Copilot reviewed 32 out of 33 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/lib/messageHandlers.ts | Preserves raw tool results + surfaces file artifacts and file parts for rendering on reload. |
| ui/src/lib/fileUpload.ts | Adds client-side file allowlist/size guard and conversion to A2A FilePart. |
| ui/src/components/ToolDisplay.tsx | Adds MCP App renderer embedding for completed tool calls with UI resources. |
| ui/src/components/mcp/McpServersView.tsx | Adds “MCP Apps” navigation entry for servers. |
| ui/src/components/mcp-apps/McpAppsInspector.tsx | Adds a UI to browse/invoke MCP App-capable tools and render their resources. |
| ui/src/components/mcp-apps/McpAppRenderer.tsx | Implements the sandboxed MCP app renderer and host↔app bridging. |
| ui/src/components/chat/ToolCallDisplay.tsx | Threads MCP app metadata + raw tool results into the tool call display pipeline. |
| ui/src/components/chat/FileAttachment.tsx | Renders file parts as thumbnails/download chips. |
| ui/src/components/chat/ChatMinimap.tsx | Adds a scroll minimap for chat history navigation. |
| ui/src/components/chat/ChatMessage.tsx | Renders file attachments and forwards MCP app hooks into tool-call rendering. |
| ui/src/components/chat/ChatMcpAppsContext.tsx | Adds chat-level registry and routing logic for MCP App-capable tools. |
| ui/src/components/chat/ChatInterface.tsx | Wires MCP app message/tool-call promotion, file upload UI, and minimap integration. |
| ui/src/components/chat/tests/ChatMcpAppsContext.test.tsx | Unit tests for app/tool registration behavior and app-only filtering. |
| ui/src/app/servers/[namespace]/[name]/apps/page.tsx | Adds a route for the MCP Apps inspector. |
| ui/src/app/api/mcp-apps/[namespace]/[name]/tools/[toolName]/call/route.ts | Next.js API proxy for MCP app tool calls. |
| ui/src/app/api/mcp-apps/[namespace]/[name]/resources/route.ts | Next.js API proxy for MCP app resource reads. |
| ui/src/app/api/mcp-apps/_utils.ts | Shared proxy helpers + OPTIONS handler for MCP apps API routes. |
| ui/src/app/actions/mcp-apps.ts | Server actions for listing tools, calling tools, and reading resources. |
| ui/src/app/actions/tests/mcp-apps.test.ts | Unit tests for MCP apps server actions path encoding and payloads. |
| ui/public/sandbox_proxy.html | Adds the sandbox proxy document used by the MCP app iframe renderer. |
| ui/public/mockServiceWorker.js | Updates MSW generated worker version. |
| ui/package.json | Adds MCP UI / MCP SDK dependencies. |
| ui/package-lock.json | Locks new MCP UI / MCP SDK dependency tree. |
| go/core/internal/httpserver/server.go | Adds route wiring for MCP Apps endpoints. |
| go/core/internal/httpserver/handlers/mcpapps.go | Implements MCP Apps list-tools/call-tool/read-resource handlers. |
| go/core/internal/httpserver/handlers/handlers.go | Registers the new MCPApps handler. |
| go/build.err | Adds a build log artifact (should not be committed). |
| go/adk/pkg/mcp/registry.go | Toolset creation now identifies MCP App tools and filters app-only tools. |
| go/adk/pkg/mcp/registry_test.go | Adds tests for MCP app detection and app-only visibility logic. |
| go/adk/pkg/agent/mcp_apps.go | Adds model-result compaction callback for MCP App tool renders. |
| go/adk/pkg/agent/mcp_apps_test.go | Tests for model-result compaction behavior. |
| go/adk/pkg/agent/agent.go | Wires MCP App callback only when MCP App-capable tools are present. |
| design/EP-2046-chat-mcp-ui-widgets.md | Design doc describing goals, approach, and test plan. |
Files not reviewed (1)
- ui/package-lock.json: Generated file
Comments suppressed due to low confidence (1)
go/build.err:39
go/build.errlooks like a locally-captured build log and is now stale (it reportsCreateToolsetsreturning 2 values while the PR updatesagent.goaccordingly). This file shouldn't be committed; it will also confuse CI/reviewers about the current build state. Please remove it from the PR (and rely on CI logs instead).
# github.com/kagent-dev/kagent/go/adk/pkg/agent
adk/pkg/agent/agent.go:58:14: assignment mismatch: 1 variable but mcp.CreateToolsets returns 2 values
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
peterj
reviewed
Jun 18, 2026
peterj
reviewed
Jun 18, 2026
peterj
reviewed
Jun 18, 2026
4371099 to
794c8f4
Compare
Contributor
Author
00d6a01 to
9943ffe
Compare
Add end-to-end support for rendering interactive MCP "App" UI resources
inline in the chat instead of raw tool-call JSON.
Backend:
- registry.CreateToolsets returns the set of MCP-app-capable tool names
(MCPAppToolNames) so the agent treats their results specially; tool
classification is expressed via a single mcpToolKind classifier.
- MakeMCPAppModelResultCallback keeps the rich tool payload in chat history
for UI rendering while compacting what is sent to the model (avoids
redundant polling/tool churn), wired in agent.go only when MCP-app tools
are present; uses the typed MCP CallToolResult from the go-sdk.
- /api/mcp-apps/{namespace}/{name}/... endpoints to list tools, call tools,
and read ui:// resources from a RemoteMCPServer.
UI:
- Sandboxed McpAppRenderer (@mcp-ui/client) + ChatMcpAppsContext broker
host<->app messaging (sendMessage, visible tool calls, resource/tool-call
proxying); ChatLayoutUI mounts ChatMcpAppsProvider so widgets render.
- McpAppsInspector view (servers/[ns]/[name]/apps) reachable from the server
menu; ToolDisplay/ChatMessage/ToolCallDisplay render app widgets.
- sandbox_proxy.html restricts postMessage to the expected parent origin.
Tests: Go registry / model-result callback; UI context mapping, mcp-apps
server actions, and a ChatLayoutUI provider-mount regression test.
Adjacent chat file-upload/minimap UI is included to compile but is out of
scope (file-upload backend excluded), per the EP.
Includes design/EP-2046-chat-mcp-ui-widgets.md.
Signed-off-by: Dmytro Rashko <dmitriy.rashko@amdocs.com>
9943ffe to
09d6d13
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This pull request adds support for rendering interactive MCP UI widgets (MCP Apps) directly within the chat interface. It introduces backend and frontend changes to detect, handle, and render tools that provide UI resources, ensuring a richer and more interactive user experience. The backend now distinguishes between regular tools and those with UI widgets, compacts tool responses sent to the model to prevent unnecessary repeated calls, and exposes new endpoints for MCP-app interactions. The UI is updated to render these widgets inline and broker interactions between the app and the chat.
Backend: MCP App tool detection and handling
CreateToolsetsfunction inregistry.gonow returns both the toolsets and a set of tool names that support MCP Apps, enabling the agent to treat these tools differently. [1] [2] [3] [4] [5] [6]MakeMCPAppModelResultCallbackinmcp_apps.go) is added to compact the payload sent to the model for MCP App tools, replacing heavy render payloads with a terminal notice to prevent the model from re-invoking rendering tools unnecessarily. [1] [2]Testing and validation
mcp_apps_test.goto verify correct compaction of responses, error handling, and that only MCP App tools are affected by the new logic.Documentation and design
EP-2046-chat-mcp-ui-widgets.md) describes the motivation, goals, implementation details, test plan, and open questions for this feature.