Enable support for Http based MCP resources#276580
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enables support for HTTP-based MCP (Model Context Protocol) resources by adding validation and web content extraction capabilities. The changes allow VS Code to fetch and display HTTP/HTTPS resources from MCP servers through the web content extractor service.
Key Changes
- Adds
ValidateHttpResourcesfunction to validate HTTP/HTTPS resource requests against MCP server configurations - Modifies
McpResourceFilesystemto use web content extraction for HTTP-based resources instead of MCP server calls - Updates directory detection logic to use path-based checking instead of content-based checking
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
src/vs/workbench/contrib/mcp/common/mcpTypesUtils.ts |
Adds new ValidateHttpResources function to validate HTTP resource URIs against MCP server transport type and authority |
src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.ts |
Implements HTTP resource extraction via IWebContentExtractorService, updates directory detection logic, and adds helper function for path checking |
src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.ts |
Adds trailing newline (whitespace-only change) |
src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts |
Changes attachment handling to return early instead of adding context (unrelated to MCP HTTP resources) |
b8901da to
d83fbb2
Compare
d83fbb2 to
d3eec1a
Compare
| return { | ||
| contents: result.map(r => { | ||
| if (r.status === 'ok') { | ||
| return { uri: resourceURI.toString(), text: r.result }; |
There was a problem hiding this comment.
If the status is not okay, we should fall back to requesting the resource from the MCP server
| */ | ||
| export function ValidateHttpResources(resource: URI, server: IMcpServer | undefined) { | ||
| let isResourceRequestValid = false; | ||
| if (resource.path.startsWith('/http/')) { |
There was a problem hiding this comment.
I suggest matching the protocol unpacked resourceURL instead just so you know you're validating against the real URL that's being requested--and avoid the implicit dependency on how the namespaces resource URIs get constructed
fixes #259253
Screen.Recording.2025-11-10.123107.mp4