chore: remove CommonJS Support and Update to Node.js 20+ #1140
+4,639
−4,672
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
require(ESM)support: Recent Node.js versions allow ESM-only packages to work in CommonJS codebases, removing a major adoption blockerRelated: https://antfu.me/posts/move-on-to-esm-only
Node.js 20 specifically improved:
How Has This Been Tested?
passed all existing tests
Breaking Changes
YES - This is a breaking change:
Types of changes
Checklist
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: