Skip to content

Conversation

@connor4312
Copy link
Member

@connor4312 connor4312 commented Jan 5, 2026

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.enabled setting 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 onDidRemount method of chat parts. @mjbvz you may prefer to adopt this instead of what's currently there.

  • I added a new optional container to createWebviewOverlay. The way I arrived on this was:

    1. webview elements alone are not the best in chat because they flicker when parts get re-rendered and they get re-created
    2. overlay webviews fix this, but they do not natively track the scroll position
    3. rather that adding a scroll listener and manually clipping to the container, we can make this work by just letting the overlay webview explicitly parent into the scroll container

    Though 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

Copy link
Contributor

Copilot AI left a 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 container parameter for createWebviewOverlay to 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

@connor4312 connor4312 force-pushed the connor4312/mcp-apps branch from f721b61 to 507ecc7 Compare January 5, 2026 06:19
@idosal
Copy link

idosal commented Jan 5, 2026

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.

@connor4312 connor4312 marked this pull request as ready for review January 6, 2026 20:56
@connor4312 connor4312 enabled auto-merge (squash) January 6, 2026 20:56
@vs-code-engineering
Copy link

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/base/browser/touch.ts

@vs-code-engineering vs-code-engineering bot added this to the December 2025 milestone Jan 6, 2026
@connor4312 connor4312 disabled auto-merge January 6, 2026 20:59
@connor4312
Copy link
Member Author

Will merge after branching for the December release happens

@connor4312 connor4312 modified the milestones: December 2025, January 2026 Jan 6, 2026
@connor4312 connor4312 merged commit ec711a3 into main Jan 7, 2026
23 checks passed
@connor4312 connor4312 deleted the connor4312/mcp-apps branch January 7, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Built-in support for MCP-UI

5 participants