Skip to content

fix(packages): add types/typesVersions for legacy moduleResolution: node#1898

Draft
felixweinberger wants to merge 1 commit intomainfrom
fweinberger/v2-bc-typesversions
Draft

fix(packages): add types/typesVersions for legacy moduleResolution: node#1898
felixweinberger wants to merge 1 commit intomainfrom
fweinberger/v2-bc-typesversions

Conversation

@felixweinberger
Copy link
Copy Markdown
Contributor

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

v2 packages use exports maps only. TypeScript's legacy moduleResolution: node (Node10) ignores exports, so every import is TS2307. This adds types to leaf packages and a narrow typesVersions map where subpaths exist.

Motivation and Context

v2 packages use exports maps only. TypeScript's legacy moduleResolution: node (Node10) ignores exports, so every import is TS2307. This adds types to leaf packages and a narrow typesVersions map where subpaths exist.

v1 vs v2 pattern & evidence

v1 pattern:

v1 also relied on `exports`, but legacy resolution worked for the root because v1 had `main`/`types` fields

v2-native:

Same  but the naive `typesVersions: {*:{*:[dist/*]}}` form *breaks* (remaps `types` through itself). This is the correct narrow form.

Evidence: Validated against tsconfigs using moduleResolution: node — resolves cleanly.

How Has This Been Tested?

  • Typecheck IS the 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 — additive @deprecated shim. Removed in v3.

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: 8d41f04

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

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/client Patch
@modelcontextprotocol/server Patch
@modelcontextprotocol/node Patch
@modelcontextprotocol/express Patch
@modelcontextprotocol/fastify Patch
@modelcontextprotocol/hono 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@1898

@modelcontextprotocol/server

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

@modelcontextprotocol/express

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

@modelcontextprotocol/fastify

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

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: 8d41f04

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