Skip to content

Conversation

@ryoppippi
Copy link

@ryoppippi ryoppippi commented Nov 19, 2025

Summary

This PR modernises the MCP TypeScript SDK by removing CommonJS (CJS) build support and updating the minimum Node.js version requirement from 18 to 20. The package now exclusively uses ECMAScript modules (ESM).

Motivation and Context

Node.js 18 reaches end-of-life in April 2025, and Node.js 20 is now the active LTS version. By requiring Node.js 20+ and adopting ESM-only, we:

  • Node.js 20+ has stable ESM support: Node.js 20 provides mature and stable ESM implementation with proper module resolution, making it safe to drop CJS fallbacks
  • Ecosystem has matured: ESM adoption has grown from 7.8% (2021) to 25.8% (2024), with modern tooling treating ESM as first-class citizens
  • require(ESM) support: Recent Node.js versions allow ESM-only packages to work in CommonJS codebases, removing a major adoption blocker
  • Reduced maintenance burden: Dual format builds introduce complexity, dependency conflicts, and doubled package sizes

Related: https://antfu.me/posts/move-on-to-esm-only

Node.js 20 specifically improved:

  • ESM loader stability and performance
  • Better ESM/CJS interoperability
  • Native support for package.json "exports" field patterns
  • Reduced friction when using pure ESM packages

How Has This Been Tested?

passed all existing tests

Breaking Changes

YES - This is a breaking change:

  • Minimum Node.js version: Users must upgrade from Node.js 18 to Node.js 20 or higher

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally (1,106 tests passing)
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

This change is part of modernising the SDK to align with current Node.js LTS versions and ecosystem best practices. The removal of CommonJS support simplifies the codebase and build process whilst adopting the JavaScript standard module system.

Node.js version support timeline:

  • Node.js 18: EOL April 2025
  • Node.js 20: Active LTS until April 2026
  • Node.js 22: Current release (becomes LTS in October 2025)

@ryoppippi ryoppippi requested a review from a team as a code owner November 19, 2025 21:16
@ryoppippi ryoppippi force-pushed the remove-cjs branch 2 times, most recently from 1d50017 to 8a0f017 Compare November 19, 2025 21:18
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 19, 2025

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/sdk@1140

commit: 71db696

@mattzcarey
Copy link
Contributor

Hey we won't be able to merge this any time soon since it's breaking. There will be a major version sometime in the future and these are on my list :)

@KKonstantinov KKonstantinov added this to the v2 milestone Nov 22, 2025
@KKonstantinov KKonstantinov added the v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes label Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants