Skip to content

fix(shared): stop referencing the DOM-only HeadersInit in normalizeHeaders - #3069

Open
ziadantar90 wants to merge 1 commit into
modelcontextprotocol:v1.xfrom
ziadantar90:fix/normalize-headers-no-dom-global
Open

ziadantar90 wants to merge 1 commit into
modelcontextprotocol:v1.xfrom
ziadantar90:fix/normalize-headers-no-dom-global

Conversation

@ziadantar90

Copy link
Copy Markdown

Fixes #2568.

normalizeHeaders took a bare HeadersInit, which is a DOM lib type alias. Node-only projects without the DOM lib and with skipLibCheck: false fail on the published transport.d.ts with TS2304: Cannot find name 'HeadersInit'.

The parameter is now RequestInit['headers'] | undefined. That's the same type, and RequestInit is available from @types/node. Runtime behavior is unchanged.

I left the two local HeadersInit & Record<string, string> variables in sse.ts and streamableHttp.ts alone, since they don't show up in the published types.

Added a changeset and tests for normalizeHeaders (undefined, Headers, tuple array, plain object). vitest on test/shared/transport.test.ts, tsc, eslint and prettier pass locally.

…aders

HeadersInit is a DOM lib type alias, so Node-only projects without the
DOM lib fail with TS2304 when skipLibCheck is off. RequestInit['headers']
is the same type and is available from @types/node.

Fixes modelcontextprotocol#2568

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018dKyMg1Frb5EXMwBaEw51t
@ziadantar90
ziadantar90 requested a review from a team as a code owner October 22, 2026 14:34
@changeset-bot

changeset-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a8f0179

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Oct 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@modelcontextprotocol/sdk@3069

commit: a8f0179

@claude claude Bot added the v1 Issues / PRs related to v1.x label Oct 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1 Issues / PRs related to v1.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant