-
Notifications
You must be signed in to change notification settings - Fork 37.3k
chat: support MCP apps #285864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chat: support MCP apps #285864
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements the MCP apps proposal to enable MCP servers to provide custom UI for tool invocations within VS Code's chat interface. The feature is controlled by the experimental chat.mcp.apps.enabled setting (disabled by default) and requires deep integration with the core webview and chat rendering systems.
Key changes include:
- New
onDidRemount()lifecycle method for chat content parts to handle DOM detachment/reattachment scenarios - Optional
containerparameter forcreateWebviewOverlayto support explicit parent containers, avoiding webview flickering during re-renders - MCP Apps protocol implementation with bidirectional JSON-RPC communication between host and MCP app webviews
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/contrib/webview/browser/webview.ts |
Extends WebviewInitInfo with new WebviewOverlayInitInfo interface that adds optional container parameter |
src/vs/workbench/contrib/webview/browser/overlayWebview.ts |
Implements explicit container support with window validation to ensure consistency |
src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.ts |
Defines complete MCP Apps protocol types and schemas from the external specification |
src/vs/workbench/contrib/mcp/common/mcpTypesUtils.ts |
Adds findMcpServer utility for asynchronous server lookup and translateMcpLogMessage for logging |
src/vs/workbench/contrib/mcp/common/mcpTypes.ts |
Extends MCP tool types with visibility flags and UI resource metadata |
src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.ts |
Refactors logging to use shared translateMcpLogMessage utility |
src/vs/workbench/contrib/mcp/common/mcpServer.ts |
Parses tool visibility and UI metadata from MCP tool definitions |
src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.ts |
Filters app-only tools from language model tool registration and attaches MCP app data to tool invocations |
src/vs/workbench/contrib/mcp/browser/mcpToolCallUI.ts |
Implements MCP app resource loading, tool/resource proxying, and host context management |
src/vs/workbench/contrib/chat/common/tools/languageModelToolsService.ts |
Adds mcpOutput field to tool result details for MCP app rendering |
src/vs/workbench/contrib/chat/common/chatService/chatService.ts |
Extends tool invocation data structure with MCP app metadata |
src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts |
Integrates MCP app webview pool into chat rendering pipeline with remount tracking |
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.ts |
Renders MCP app UI alongside traditional tool output with conditional rendering based on confirmation state |
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppWebviewPool.ts |
Implements reference-counted webview pool with delayed disposal for handling re-renders |
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.ts |
View layer for MCP app webviews that coordinates with pool and model |
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.ts |
Core model managing MCP app lifecycle, JSON-RPC communication, CSP injection, and message routing |
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.ts |
Fixes rendering bug where empty output array was treated as truthy |
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.ts |
Adds onDidRemount lifecycle hook and mcpAppWebviewPool to render context |
src/vs/workbench/contrib/chat/browser/chat.contribution.ts |
Registers new experimental configuration setting |
src/vs/platform/mcp/common/mcpManagement.ts |
Exports configuration constant for MCP apps feature flag |
src/vs/base/browser/touch.ts |
Adds isHoverDevice() utility for MCP app device capability reporting |
...orkbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.ts
Outdated
Show resolved
Hide resolved
...orkbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.ts
Show resolved
Hide resolved
...orkbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts.ts
Outdated
Show resolved
Hide resolved
...orkbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.ts
Show resolved
Hide resolved
...orkbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.ts
Show resolved
Hide resolved
...ch/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppWebviewPool.ts
Outdated
Show resolved
Hide resolved
aa89551 to
f721b61
Compare
f721b61 to
507ecc7
Compare
|
That's awesome, thanks @connor4312 ! 🔥 Looking into the issues you've surfaced. BTW, if it helps, MCP-UI provides the recommended MCP Apps client SDK (used by Postman and soon Goose) which it supports in an alpha that'll be released this week. |
...kbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.ts
Outdated
Show resolved
Hide resolved
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
|
|
Will merge after branching for the December release happens |
Implements the MCP apps proposal. Unlike MCP UI, some deeper integration is needed so I opted to do it entirely within core. Controlled by the
chat.mcp.apps.enabledsetting which is disabled by default for the moment.This supports all capabilities of MCP apps to the best I can tell, and all of their examples work (barring modelcontextprotocol/ext-apps#199). Some notable changes outside of the new MCP stuff:
There is a new
onDidRemountmethod of chat parts. @mjbvz you may prefer to adopt this instead of what's currently there.I added a new optional
containertocreateWebviewOverlay. The way I arrived on this was:scrolllistener and manually clipping to the container, we can make this work by just letting the overlay webview explicitly parent into the scroll containerThough if we think this is not good I could also try and dive deeper into the rerenders in (i) to see what's happening there, but I'm unsure how readily solvable that will be 😛
Kapture.2026-01-04.at.21.04.07.mp4
Closes #260218