Skip to content

Enable support for Http based MCP resources#276580

Merged
dileepyavan merged 3 commits intomainfrom
DileepY/MCP_httpResources
Nov 12, 2025
Merged

Enable support for Http based MCP resources#276580
dileepyavan merged 3 commits intomainfrom
DileepY/MCP_httpResources

Conversation

@dileepyavan
Copy link
Member

@dileepyavan dileepyavan commented Nov 10, 2025

fixes #259253

Screen.Recording.2025-11-10.123107.mp4

Copilot AI review requested due to automatic review settings November 10, 2025 19:43
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 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 ValidateHttpResources function to validate HTTP/HTTPS resource requests against MCP server configurations
  • Modifies McpResourceFilesystem to 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)

@dileepyavan dileepyavan marked this pull request as ready for review November 10, 2025 20:16
@vs-code-engineering vs-code-engineering bot added this to the November 2025 milestone Nov 10, 2025
Tyriar
Tyriar previously approved these changes Nov 10, 2025
@dileepyavan dileepyavan force-pushed the DileepY/MCP_httpResources branch from b8901da to d83fbb2 Compare November 10, 2025 21:38
@dileepyavan dileepyavan force-pushed the DileepY/MCP_httpResources branch from d83fbb2 to d3eec1a Compare November 10, 2025 21:44
Copy link
Member

@connor4312 connor4312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple small comments!

return {
contents: result.map(r => {
if (r.status === 'ok') {
return { uri: resourceURI.toString(), text: r.result };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@dileepyavan dileepyavan merged commit 6957717 into main Nov 12, 2025
28 checks passed
@dileepyavan dileepyavan deleted the DileepY/MCP_httpResources branch November 12, 2025 00:31
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Dec 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for MCP resources with https:// scheme

5 participants