inspector icon indicating copy to clipboard operation
inspector copied to clipboard

fix(client): preserve Request options in proxy fetch

Open go165 opened this issue 5 months ago • 1 comments

Summary

  • Normalize proxy fetch inputs with new Request(input, init) before serializing them for /fetch
  • Preserve Request method, headers, and body instead of forwarding only Request.url
  • Add regression coverage for Request inputs and explicit init overrides

Closes #1207.

Validation

  • git diff --check
  • /home/ubuntu/modelcontextprotocol-inspector/clients/web/node_modules/.bin/prettier --check client/src/lib/proxyFetch.ts client/src/lib/__tests__/proxyFetch.test.ts
  • Manual Node 24 check that new Request() preserves POST method, lower-cased headers, and text body for the reported Request-input case

I attempted the focused Jest command npm test -- --runTestsByPath src/lib/__tests__/proxyFetch.test.ts --runInBand, but this fresh worktree did not have jest installed. A scoped npm ci --workspace=client --include-workspace-root=false --ignore-scripts then failed on registry download with ECONNRESET for xml-name-validator-4.0.0.tgz, so I did not keep retrying registry downloads.

go165 avatar Jun 14 '26 14:06 go165

Validation update for the latest head 3746d533:

  • npm ci --workspace=client --include-workspace-root=false --ignore-scripts
  • npm test -- --runTestsByPath src/lib/__tests__/proxyFetch.test.ts --runInBand (12 passed)
  • npx prettier --check client/src/lib/proxyFetch.ts client/src/lib/__tests__/proxyFetch.test.ts
  • git diff --check origin/main...HEAD

GitHub reports the pushed commit signature as verified.

go165 avatar Jun 14 '26 15:06 go165

Closing: this targets the v1 codebase, which is deprecated.

When this PR was opened, main still held v1 — the diff is against client/src/…, the v1 layout. main has since become the release branch for v2 (clients/web/…, core/…), and the v1 line lives on v1/main, where it accepts security fixes only and takes no feature or non-security bug work. There is no branch this change could be retargeted to.

Thanks for taking the time to write it — that is genuinely appreciated, and the fact that it sat unanswered this long is on us, not on you. A sweep of deprecated v1 PRs ran on 2026-07-31 and selected on base branch v1/main; this one says main, so it was missed rather than passed over.

One thing worth knowing for anything you send next: the repo has since moved to an issues, not pull requests policy (CONTRIBUTING.md) — maintainers handle design and implementation, and external contributions come in as detailed issues. That policy landed after this PR was opened, so it is not the reason for this close; it is just where to start next time. If the underlying problem still reproduces on current v2, an issue describing it would be welcome.

cliffhall avatar Sep 18 '26 14:09 cliffhall