@modelcontextprotocol/server
2.4.0 · 23 Oct 2026Apache-2.033.9M / weekRepositoryHomepagenpmAtom feed
Upgrading @modelcontextprotocol/server From 2.0.0 to 2.1.0
1 release in betweenevery note read
Before you upgrade
Tick each one off as you go- Deprecated2.1.0
Security
3 advisories still affect 2.1.0
- MCP TypeScript SDK: One HTTP request within the default size limit could exhaust server memory during validationhigh · GHSA-46jr-4wx8-v453
- MCP TypeScript server SDK: Shared transport or server instances delivered one HTTP client's messages to anotherhigh · GHSA-jm63-cq47-j5jp
- MCP TypeScript SDK: Server bearer authentication accepted tokens issued for another servicemoderate · GHSA-rvq5-wwqv-78pq
Upgrading to 2.3.0 clears them.
Fixes 1 advisory affecting 2.0.0
Release by release
- Deprecated
SdkErrorandSdkHttpErroraccept standardErrorOptionsas an optional fourth constructor argument and forward it toError, so a wrapped error is reachable through the standardError.causechain. Version-negotiation probe failures (SdkErrorCode.EraNegotiationFailed) now use it: the underlyingTypeError: fetch failedand the DNS or socket error beneath it surface viaerror.cause, so pino, Sentry, andutil.inspectrenderENOTFOUND/ECONNREFUSED/ETIMEDOUTinstead of stopping at theSdkError(#2657). The previouserror.data.causeslot is still populated for compatibility but is deprecated and slated for removal; readerror.causeinstead. - New
Add request-time OAuth scope challenges for tools, resources, resource templates, and prompts. Each primitive's
scopeChallengecallback receives the parsed request and verified authentication info, then either continues or returns the exact scope set for aninsufficient_scoperesponse.requireScopesprovides a small helper for static all-of checks. - Fixed
Treat request id
0as a real id. Two guards tested aRequestIdfor truthiness, so the legal JSON-RPC ids0and''were read as absent. Id0is not a corner case: the outbound request counter is zero-based, so it is the first id every peer assigns, which on the server→client leg is the firstsampling/createMessage,elicitation/create, orroots/lista server sends. - Fixed
Stop sending
notifications/cancelledfor theinitializehandshake. The spec is explicit that a client MUST NOT attempt to cancel itsinitializerequest, but the outbound cancel path fired for any in-flight request: aborting theAbortSignalpassed toconnect(), or letting the handshake hit its timeout, put a forbidden cancellation on the wire naming the initialize request id.
- Deprecated
1 internal line (docs, tests, tooling) left out.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.