Skip to content

Remove Content-Length header from MCP requests since it's disallowed by fetch#320034

Merged
dmitrivMS merged 1 commit into
mainfrom
dev/dmitriv/fix-mcp-content-length-header
Jun 5, 2026
Merged

Remove Content-Length header from MCP requests since it's disallowed by fetch#320034
dmitrivMS merged 1 commit into
mainfrom
dev/dmitriv/fix-mcp-content-length-header

Conversation

@dmitrivMS
Copy link
Copy Markdown
Contributor

Fixes #318830
Fixes #319688
Fixes #319913

Copilot AI review requested due to automatic review settings June 5, 2026 01:56
@dmitrivMS dmitrivMS added the mcp label Jun 5, 2026
@dmitrivMS dmitrivMS requested a review from TylerLeonhardt June 5, 2026 01:56
@dmitrivMS dmitrivMS enabled auto-merge (squash) June 5, 2026 01:56
@dmitrivMS dmitrivMS self-assigned this Jun 5, 2026
Copy link
Copy Markdown
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 addresses a regression in VS Code’s MCP HTTP transport by removing the explicit Content-Length request header, which is forbidden by fetch and can cause requests to fail before any network connection is attempted. It also improves diagnostics by expanding error stringification to include nested Error.cause details.

Changes:

  • Stop sending Content-Length in MCP HTTP POST requests (streamable HTTP + legacy SSE) to avoid fetch-forbidden header failures.
  • Improve logged/error-state messages by including a limited chain of Error.cause messages via a new stringifyError() helper.
Show a summary per file
File Description
src/vs/workbench/api/common/extHostMcp.ts Removes Content-Length from MCP HTTP request headers and enhances error messages to include cause chains.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread src/vs/workbench/api/common/extHostMcp.ts
@dmitrivMS dmitrivMS merged commit 8c026b1 into main Jun 5, 2026
26 checks passed
@dmitrivMS dmitrivMS deleted the dev/dmitriv/fix-mcp-content-length-header branch June 5, 2026 02:22
@vs-code-engineering vs-code-engineering Bot added this to the 1.124.0 milestone Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VS Code Insiders MCP + OAuth Protected Resource Regression (works in Stable, fails in Insiders) remote figma mcp MCP HTTP Client Regression

3 participants