Skip to content

feat(compat): re-export StreamableHTTPServerTransport + EventStore types from /node#1904

Open
felixweinberger wants to merge 2 commits intomainfrom
fweinberger/v2-bc-transport-aliases
Open

feat(compat): re-export StreamableHTTPServerTransport + EventStore types from /node#1904
felixweinberger wants to merge 2 commits intomainfrom
fweinberger/v2-bc-transport-aliases

Conversation

@felixweinberger
Copy link
Copy Markdown
Contributor

@felixweinberger felixweinberger commented Apr 15, 2026

Part of the v2 backwards-compatibility series — see reviewer guide.

v2 renamed StreamableHTTPServerTransportNodeStreamableHTTPServerTransport. v2 already kept the Options type alias (incoherent). This adds the class alias + EventStore/EventId/StreamId re-exports.

Motivation and Context

v2 renamed StreamableHTTPServerTransportNodeStreamableHTTPServerTransport. v2 already kept the Options type alias (incoherent). This adds the class alias + EventStore/EventId/StreamId re-exports.

v1 vs v2 pattern & evidence

v1 pattern:

`import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'`

v2-native:

`import { NodeStreamableHTTPServerTransport } from '@modelcontextprotocol/node'`

Evidence: GitHub code search: ~1,700 files.

How Has This Been Tested?

  • Import-compiles test
  • Integration: validated bump-only against 5 OSS repos via the v2-bc-integration validation branch
  • pnpm typecheck:all && pnpm lint:all && pnpm test:all green

Breaking Changes

None.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added or updated documentation as needed

Additional context

Stacks on: none

@felixweinberger felixweinberger added the v2-bc v2 backwards-compatibility series label Apr 15, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: 55d3879

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

This PR includes changesets to release 1 package
Name Type
@modelcontextprotocol/node Patch

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

@felixweinberger felixweinberger added this to the v2.0.0-bc milestone Apr 15, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 15, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@1904

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@1904

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@1904

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@1904

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@1904

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@1904

commit: 55d3879

Comment thread packages/middleware/node/src/index.ts Outdated
@felixweinberger felixweinberger force-pushed the fweinberger/v2-bc-transport-aliases branch from 3d48f5e to e5af3b3 Compare April 16, 2026 15:51
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

LGTM — the force-push drops @deprecated to match the existing StreamableHTTPServerTransportOptions precedent, which resolves the bundler-stripping concern; remaining note on the PR description wording is non-blocking.

Extended reasoning...

Overview

Adds 7 lines to packages/middleware/node/src/index.ts: a v1-compat alias StreamableHTTPServerTransportNodeStreamableHTTPServerTransport and type re-exports of EventStore/EventId/StreamId from @modelcontextprotocol/server. Ships with a vitest file asserting runtime identity (.toBe) and type-level exports (expectTypeOf), plus a changeset. No logic, no transport behaviour change — pure re-exports.

What changed since my last review

My earlier inline comment (on commit 3d48f5e) flagged that an @deprecated JSDoc on the export specifier was being stripped by tsdown's dts bundler. The author force-pushed e5af3b3, which resolves this by removing @deprecated entirely rather than restructuring to preserve it. The comment now reads "v1 name. The v2-preferred name is…", the "keep until v3" comment is gone, and the test no longer needs an eslint-disable. This is a valid resolution: it matches the pre-existing StreamableHTTPServerTransportOptions alias at streamableHttp.ts:22, which also carries no @deprecated. The new inline nit notes the only residual mismatch (PR description still says "@deprecated shim. Removed in v3"), but the changeset file — which is what actually ships in the CHANGELOG — makes no such claim and is accurate.

Security risks

None. Re-exporting an existing class under an additional name and re-exporting types has no runtime attack surface.

Level of scrutiny

Low. This is part of the labelled v2-bc series with an established reviewer guide, the pattern (un-deprecated compat alias) already exists in the same file for the Options type, and the additions are purely additive. The repo's "burden of proof on addition" principle is satisfied by the cited ~1,700 v1 call sites and the incoherence of shipping the Options alias without the class alias.

Other factors

Test coverage is appropriate for what's being added (identity + type-compiles). The earlier inline comment is now stale against the force-pushed diff; the new nit-level inline comment supersedes it and is informational only.

Comment thread packages/middleware/node/src/index.ts Outdated
…type re-exports to @modelcontextprotocol/node

v1 code imports `StreamableHTTPServerTransport`, `EventStore`, `EventId`, and `StreamId` from `@modelcontextprotocol/sdk/server/streamableHttp.js`. Re-export them from `@modelcontextprotocol/node` (alias is `@deprecated`, types pass through from `@modelcontextprotocol/server`) so the migration is a package-name swap.
@felixweinberger felixweinberger force-pushed the fweinberger/v2-bc-transport-aliases branch from e5af3b3 to 6f5ee9c Compare April 16, 2026 19:57
Comment thread packages/middleware/node/src/index.ts Outdated
@felixweinberger
Copy link
Copy Markdown
Contributor Author

@claude review

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

LGTM — the const+type alias pattern now lands @deprecated in the bundled dist/index.d.mts (lines 333–336), so consumers get the migration signal.

Extended reasoning...

Overview

Adds v1-compat exports to @modelcontextprotocol/node: a deprecated StreamableHTTPServerTransport alias (const + type) for NodeStreamableHTTPServerTransport, plus EventStore/EventId/StreamId type re-exports from @modelcontextprotocol/server. Three files: a 10-line index.ts, a changeset, and a vitest compat test asserting value and type identity.

Resolution of prior feedback

My last open comment (3096050008) flagged that inline-specifier @deprecated was stripped by tsdown. Commit 55d3879 switched to the export const + export type declaration pair I suggested. Verified against the built artifact: dist/index.d.mts now emits declare const StreamableHTTPServerTransport and type StreamableHTTPServerTransport each carrying /** @deprecated … */ (lines 333–336), and the final export list references the new declaration rather than an inline as specifier. The deprecation now reaches npm consumers.

Security risks

None. Purely additive re-exports with no runtime logic beyond a const reference assignment; no transport, auth, or I/O changes.

Level of scrutiny

Low. This is a mechanical compat shim in a package barrel file, part of an established v2-bc series with a documented reviewer guide. The only non-trivial concern (JSDoc surviving dts bundling) has been verified fixed against the build output.

Other factors

  • compat.test.ts covers both value identity (toBe) and type identity (expectTypeOf).
  • Changeset prose matches the implementation (no v3-removal claim, just "v1-compat re-exports").
  • EventStore/EventId/StreamId are plain type re-exports without @deprecated, which is consistent with them being part of the transport's public options surface rather than renamed symbols.

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

Labels

v2-bc v2 backwards-compatibility series

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant