Skip to content

Cannot connect to MCP server via SSE using trusted developer certificate #248170

@hansmbakker

Description

@hansmbakker
  • Copilot Chat Extension Version: 1.307.1529
  • VS Code Version: 1.99.3 (User setup)
  • OS Version: Windows 24H2 (26100.3775)
  • Logs:
2025-04-25 10:42:10.841 [info] Connection state: Starting
2025-04-25 10:42:10.845 [info] Starting server from LocalProcess extension host
2025-04-25 10:42:10.880 [info] Connection state: Error Error connecting to https://localhost:5001/sse: TypeError: fetch failed

Steps to Reproduce:

  1. Create local MCP server using SSE transport (e.g. similar to https://github.com/jamesmontemagno/MonkeyMCP/tree/main/MonkeyMCPSSE)
  2. In https mode, dotnet uses a self-signed developer certificate that is trusted by the system
  3. Add it to mcp.json:
{
  "servers": {
      "myserver": {
          "type": "sse",
          "url": "https://localhost:5001/sse"
      }
  }
}
  1. Let VS Code connect to the MCP server - the MCP logs will show the logs above (Connection state: Error Error connecting to https://localhost:5001/sse: TypeError: fetch failed)
  2. Let VS Code run the MCP server using http (so without certificates) and update mcp.json
  3. Connect again - this time it works.

Additional context:
When trying to connect to it with the MCP Inspector, I get errors there like:

New SSE connection
Query parameters: [Object: null prototype] {
  transportType: 'sse',
  url: 'https://localhost:5001'
}
SSE transport: url=https://localhost:5001, headers=Accept
Error in /sse route: SseError: SSE error: TypeError: fetch failed: self-signed certificate
    at _eventSource.onerror (file:///X:/packages/npm/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js:69:31)
    at EventSource.scheduleReconnect_fn (file:///X:/packages/npm/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:248:53)
    at file:///X:/packages/npm/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:98:174
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  code: undefined,
  event: {
    type: 'error',
    message: 'TypeError: fetch failed: self-signed certificate',
    code: undefined,
    defaultPrevented: false,
    cancelable: false,
    timeStamp: 151747.9074
  }
}

I can imagine that VS Code has the same issue.

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugchat-mcpconfirmedIssue has been confirmed by VS Code Team memberelectronIssues and items related to Electronfeature-requestRequest for new features or functionalityupstreamIssue identified as 'upstream' component related (exists outside of VS Code)

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions