npm / @modelcontextprotocol/sdk
@modelcontextprotocol/sdk
What changed in @modelcontextprotocol/sdk 1 to 2, from its official release notes, upgrade guides and advisories. Also covers @modelcontextprotocol/node. Sources checked 2026-11-30.
153 breaking12 security14 deprecations69 new APIs and options2 performance34 behavior and defaults4 tooling56 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@modelcontextprotocol/sdk 2246 changes
Breaking changes 147
The bundled Ajv validator now rejects $id or $ref values with invalid URI schemes.
On a 2025-11-25 connection, results from outputSchema built with z.object(...).meta({ id }) are no longer wrapped in { result }; read structuredContent directly.
The annotation is rejected on number parameters; the client omits the tool and the server responds to calls with -32020. Use z.int() or remove the annotation.
The client requires version 3.0.8 or later, which reduces time and memory for large messages received as a single SSE event.
When
argumentsis omitted, validates it as{}instead ofundefined, so top-level optional or default schemas no longer receiveundefined.HTTP client transports follow redirects only on the same origin by default; set
redirectPolicy: 'follow'to permit cross-origin redirects.Rejects connections while the server instance is already connected; create a server per request instead of sharing one across requests.
Checks whether the provider's client information is bound to the expected authorization server and throws AuthorizationServerMismatchError before sending anything if it is not.
The upgrade alone does not serve the 2026-07-28 revision; move the entry point to serveStdio or createMcpHandler to serve clients using it.
The Zod-specific type alias is removed; replace it with StandardSchemaV1.
Typed verbs perform async pre-work before sending; a same-tick abort can reject before the frame is sent and emits no notifications/cancelled, unlike v1.
Output-schema validators compile lazily on the first callTool against the cached tools/list entry; compilation errors surface before the request is sent.
The field type is widened from an object to unknown, allowing non-object JSON values; presence checks must compare against undefined rather than use truthiness.
A transport that already exposes sessionId skips the initialize handshake, leaving capabilities undefined and list verbs empty; expose sessionId only after the first request.
The result-schema argument is removed for spec methods.
Caps automatic list pagination at 64 pages by default; exceeding the limit throws SdkError(ListPaginationExceeded).
Role-aggregate unions and typed-method maps no longer include task vocabulary; deprecated Task* types remain individually importable.
Optional completable schemas invert their nesting: apply optional() to the result of completable rather than to its schema argument.
Localhost-class hosts now validate Origin by default. Browser clients from non-localhost origins need allowedOrigins; invalid or opaque Origin values are rejected.
Use createMcpHandler(() => createServer()) as an entry point to serve both 2025-era and 2026-07-28 clients.
The handler context replaces the extra parameter; context properties are remapped to ctx.mcpReq or ctx.http.
HTTP-specific context is optional; authInfo, req, and SSE close helpers are accessed through ctx.http?. and may be undefined, including on stdio.
The request ID is now accessed as ctx.mcpReq.id instead of extra.requestId.
The request abort signal is now accessed as ctx.mcpReq.signal instead of extra.signal.
HTTP request headers are now a standard Web Headers object, so read values with .get() instead of bracket access.
New handler-context helper replacing server.elicitInput.
Log notifications are request-related on every era and travel on the in-flight exchange; on 2025-era sessionful HTTP they move from standalone GET to per-request POST streams.
The schema argument must be dropped from nested low-level send calls; the codemod does not rewrite these calls.
In-flight request handlers are now aborted when the transport closes.
Every request handler now receives a structured context object as its second parameter instead of the flat RequestHandlerExtra object; context types no longer take type parameters.
Treats 502 Bad Gateway like 4xx and falls through to the next candidate URL; other 5xx responses still throw.
Rejects metadata whose issuer does not exactly match the URL it was fetched for, unless the validation opt-out is used.
The build layout changes to flat .mjs and .cjs siblings instead of /dist/cjs/ and /dist/esm/ flavor directories.
Elicitation content values are restricted to string, number, boolean, or string arrays; arbitrary objects no longer compile or pass schema validation.
ErrorCode is renamed to ProtocolErrorCode; RequestTimeout and ConnectionClosed move to SdkErrorCode.
Exported from @modelcontextprotocol/server only.
Client and server capability experimental payloads are now typed as JSON-compatible nested values rather than arbitrary objects.
getSchemaDescription is removed and has no replacement.
getSchemaShape is removed and has no replacement.
For interactive DCR, defaults to authorization_code and refresh_token in the registration body unless explicitly set.
Sampling's with-tools CreateMessageResult variant is now selected when either tools or toolChoice is present.
IsomorphicHeaders is replaced with the Web Standard Headers type, which uses .get() and .set() rather than bracket access.
hostHeaderValidation() moved to @modelcontextprotocol/express; its signature is unchanged.
Frames failing typed message-shape validation are dropped and reported through onerror; no response is sent.
Now exported from the client and server packages. Linked-pair halves must come from the same package import because the packages bundle separate copies with private state.
Schema objects must implement Standard Schema; raw shapes remain accepted only through deprecated registerTool/registerPrompt overloads.
Thrown when token operations use a non-HTTPS endpoint, except for the specified loopback hosts.
A transport error reports insufficient scope when configured to throw or when a non-OAuth AuthProvider cannot reauthorize.
This guard was removed; use isJSONRPCErrorResponse.
The name now matches both result and error responses; use isJSONRPCResultResponse to preserve the v1 result-only behavior.
IsomorphicHeaders is removed in favor of the Web Standard Headers object.
isOptionalSchema is removed and has no replacement.
The default validator dispatches by declared $schema: absent or 2020-12 uses 2020-12, 2019-09 uses 2019-09, and draft-07/06 uses draft-07; other dialects are rejected.
This alias was removed; use JSONRPCErrorResponse.
The JSONRPCError symbol is renamed to JSONRPCErrorResponse.
This alias was removed; use JSONRPCErrorResponseSchema.
The name now covers result and error responses; use JSONRPCResultResponse to preserve the v1 result-only behavior.
The schema now accepts both result and error responses; use JSONRPCResultResponseSchema to preserve the v1 result-only behavior.
Declared tools, resources, or prompts capabilities with empty objects are now advertised with listChanged: true; set false explicitly to opt out.
Client list methods return empty results without sending a request when the server did not advertise the corresponding capability.
Called without a cursor, client list methods fetch all pages and return an aggregate without nextCursor; passing a cursor still fetches one page.
localhostHostValidation() moved to @modelcontextprotocol/express; its signature is unchanged.
McpError is renamed to ProtocolError for protocol errors that cross the wire as JSON-RPC error responses.
This API moved from shared/protocol.js to the client or server package root.
The v1 SDK is split into packages; use this package for the client implementation.
Stdio client transport and utilities moved to this subpath; the package root does not export them.
Client middleware, FetchLike, InMemoryTransport, and AuthInfo are exported from the package root.
A codemod package is available to mechanically migrate fixed v1-to-v2 renames and update package dependencies.
Public Zod schema constants moved to this package; import raw *Schema constants from here.
Built-in HTTP framework support is split into adapter packages; this adapter declares Express as a peer dependency.
Built-in HTTP framework support is split into adapter packages; this adapter declares Fastify as a peer dependency.
Built-in HTTP framework support is split into adapter packages; this adapter declares Hono as a peer dependency.
Built-in HTTP framework support is split into adapter packages, including this Node adapter.
Node HTTP deployments import NodeStreamableHTTPServerTransport from this package; web-standard runtimes use WebStandardStreamableHTTPServerTransport from @modelcontextprotocol/server.
The v1 SDK is split into packages; use this package for the server implementation.
Authorization Server helpers are available as a deprecated, frozen v1 copy; migrate Authorization Server functionality to a dedicated IdP/OAuth library.
StdioServerTransport moved to this subpath; the package root does not export it.
Web-standard deployments import WebStandardStreamableHTTPServerTransport here; the package also exports InMemoryTransport, server event-store types, and runtime-neutral auth helpers.
Node.js 20 or newer is required to use v2.
Run the codemod at the package root to rewrite v1-to-v2 imports, symbols, registrations, and package dependencies.
In Node and Cloudflare Workers, fetch TypeError during OAuth discovery now throws instead of being swallowed as a CORS miss and returning undefined; browser behavior retains the CORS swallow.
The OAuth error constant is removed.
New base class for dedicated OAuth client-flow errors, distinct from OAuthError.
Implementers must persist and round-trip issuer and discovery state, pass expectedIssuer and callback iss, protect refresh tokens, set application_type correctly, track cross-request step-up failures, and choose insufficient-scope handling.
Replaces individual OAuth error classes; check error.code with OAuthErrorCode instead of using the removed classes.
Token exchange and refresh now throw OAuthError when the authorization server returns HTTP 200 with a JSON error body.
Stored tokens carry an optional issuer, and credentials stamped for another authorization server are treated as undefined on read.
parseSchemaAsync is removed; validate directly with the schema library.
Server entries validate the parsed media type and return 415 for POST requests whose type is not application/json; hand-rolled clients must set Content-Type.
The Protocol base class moved from shared/protocol.js to the client or server package root; each package exports a distinct compiled class.
With an already-aborted signal, request rejects with SdkError(RequestTimeout, reason) instead of throwing the raw signal.reason.
The McpError symbol is renamed to ProtocolError.
Reconstruct a typed protocol error from code, message, and data before throwing it from a relay handler; plain error-shaped objects are unspecified behavior.
Relayed JSON-RPC error messages no longer include the MCP error code prefix; match error.code rather than rendered message text.
ProtocolError replaces McpError for protocol errors sent as JSON-RPC error responses.
ErrorCode is renamed to ProtocolErrorCode; local-only RequestTimeout and ConnectionClosed members move to SdkErrorCode.
ProtocolErrorCode replaces ErrorCode for protocol error codes.
Pins legacy initialize negotiation and supplies modern probe candidates when present; list order defines preference, and a list without a pre-2026 version makes the handshake throw.
The experimental 2025-11 task side-channel through Protocol has been removed; remove task-related options and usages.
Non-JSON stdout lines are silently skipped instead of causing a SyntaxError and onerror; JSON that fails JSON-RPC validation still throws.
update() takes schema objects and does not auto-wrap raw shapes; wrap raw shapes with z.object() yourself.
Replace the v1 .prompt() registration API with registerPrompt.
Replace the v1 .resource() registration API with registerResource.
cacheHint is now a reserved, validated configuration key and is stripped from resource list metadata; invalid values throw RangeError.
Use this registration API with an explicit config object; a metadata argument is required, and pass {} when there is none.
Replace the v1 .tool() registration API with registerTool.
Use this registration API with an explicit config object; schema fields use Standard Schema.
Task-specific tool registration and handler APIs have been removed.
This type was removed; use ServerContext, ClientContext, or BaseContext.
Transport-managed Authorization, mcp-protocol-version, and Streamable HTTP mcp-session-id headers take precedence over same-named configured headers.
Exported method-union type used to select the spec-method handler overload when a method string is computed at runtime.
Experimental task streaming methods, including requestStream and callToolStream, have been removed; remove usages.
This type was renamed to ResourceTemplateReference.
Reading an unknown URI answers -32602 on every protocol revision; peers may still send the tolerated legacy -32002 code.
The spec wire type was renamed to ResourceTemplateType to resolve a name collision; the URI-template helper class is unchanged.
The spec wire type imported from types.js is renamed from ResourceTemplate to ResourceTemplateType; the URI-template helper class keeps its name.
SSE resumability behavior is enabled only for supported protocol versions at or above 2025-11-25; unknown future version strings no longer enable it.
SchemaInput<T> is removed; the codemod rewrites it to StandardSchemaWithJSON.InferInput<T>.
The Zod-specific type alias is removed; replace it with StandardSchemaV1.InferOutput.
The Zod-specific schemaToJson helper is removed; use fromJsonSchema() for raw JSON Schema or the schema library's native conversion.
Local-only error codes such as RequestTimeout and ConnectionClosed are routed to SdkErrorCode.
StreamableHTTPError is renamed to SdkHttpError; constructor argument shape changed and calls need review.
SdkHttpError now assigns its class name to .name; name-based classifiers must account for SdkHttpError.
HTTP status is read from .status rather than .code on SdkHttpError.
Construct SdkHttpError with an SdkErrorCode string as the first argument and HTTP status details in the third-argument data object.
The v1 Zod JSON Schema compatibility module and toJsonSchemaCompat are removed.
The deprecated variadic registration method was removed; use registerPrompt with an explicit config object.
The deprecated variadic registration method was removed; use registerResource with an explicit config object.
The deprecated variadic registration method was removed; use registerTool with an explicit config object.
Use serveStdio(() => createServer()) as an entry point to serve both 2025-era and 2026-07-28 clients.
Low-level notification-handler registration now uses method strings; spec handlers receive the full parsed notification envelope, while custom handlers use a schema-based three-argument form.
Handler registration now takes a method string instead of a schema; the old schema-first form throws a TypeError at registration.
Validators now validate the neutral model: result entries reject resultType, and 2025-only task message types and RequestMetaEnvelope are removed from the public set.
Removed; migrate to Streamable HTTP. A frozen v1 copy is available as a temporary bridge.
SchemaInput<T> is rewritten to StandardSchemaWithJSON.InferInput<T>.
Outbound write failures reject the pending send and close the transport through onerror/onclose instead of surfacing an unhandled stream error.
Custom requestInit.headers.Accept values are appended to the required application/json and text/event-stream media types instead of replacing them.
StreamableHTTPError is removed; use SdkHttpError for HTTP transport errors.
Task store and in-memory task store APIs have been removed.
Non-existent tools, disabled tools, and inputSchema validation failures now return MCP protocol-level errors instead of CallToolResult values with isError: true.
Advertised tool input schemas change shape to JSON Schema 2020-12 idioms, different additionalProperties handling, and no execution.taskSupport member.
Validates the callback issuer against validated authorization-server metadata before exchanging the code; pass URLSearchParams to provide code and iss.
unwrapOptionalSchema is removed and has no replacement.
Removed because WebSocket is not a spec transport; use StreamableHTTPClientTransport for remote servers or StdioClientTransport for local servers.
Raw Zod shapes supplied as inputSchema, outputSchema, argsSchema, or uriSchema are wrapped with z.object().
The v2 packages depend on zod ^4.2.0; upgrading a zod@3-pinned workspace can deduplicate nested copies.
Zod v3 is no longer supported; SDK-bound schemas must use Zod v4 or another Standard Schema implementation.
Security 6
MCP TypeScript SDK: One HTTP request within the default size limit could exhaust server memory during validation
Adds
expectedResourceto accept only tokens issued for this server, based on the token's audience.Handles one request, so create the server and transport inside the request handler or
createMcpHandlerfactory.MCP TypeScript SDK: OAuth client could send credentials to an authorization server chosen by the MCP server
createMcpHandler does not check Host or Origin headers; mount host and origin validation in front of it when using enableDnsRebindingProtection.
Optional provider methods persist and retrieve discovery state so the callback leg can verify the authorization server targeted by the redirect.
Deprecations 13
Machine-to-machine OAuth providers should be constructed with expectedIssuer set to the issuer of the authorization server the credentials were registered with; omitting it is deprecated and logs a warning.
New handler-context helper replacing server.sendLoggingMessage; it is deprecated, and its notification becomes request-related on every protocol era.
New handler-context helper replacing server.createMessage; it is deprecated.
Use fromJsonSchema() to register raw JSON Schema or to register host-converted consumer-authored schemas.
Deprecated as of protocol version 2026-07-28; the deprecation is annotation-only and the API remains functional.
The logging capability schema field is deprecated as of protocol version 2026-07-28.
The method remains written for back-compat but is deprecated and is no longer read by the SDK.
Dynamic Client Registration is deprecated; prefer Client ID Metadata Documents.
The roots capability schema field is deprecated as of protocol version 2026-07-28.
The sampling capability schema field is deprecated as of protocol version 2026-07-28.
Deprecated as of protocol version 2026-07-28; remains functional with its v1 signature and wire behavior during the deprecation window.
This accessor remains functional but is deprecated; on 2026-07-28 requests, prefer ctx.mcpReq.envelope.
Deprecated as of protocol version 2026-07-28; remains functional with its v1 call signature and wire behavior.
New APIs and options 43
Loads a folder of skills for a server to publish over MCP; supported on 2025-11-25 and 2026-07-28.
OAuthClientProvider can implement this method to include scope in token refresh requests when an authorization server requires it; the default request is unchanged.
ServerEvent accepts optional params, allowing gateways to forward change notifications with their _meta.
Attaches skills to a server for publication over MCP. This API is experimental and may change in a minor release.
Lets a client list, read, and verify skills published over MCP.
In @modelcontextprotocol/server-legacy, requireBearerAuth accepts the optional expectedResource to accept only tokens issued for this server. It is off unless set.
Adds an
McpServeroption that limits the number of array elements and object members in a tool call's arguments; it is off unless set.Can be served and called on a 2026-07-28 connection as part of the Tasks extension.
Accepts the optional issuer field so a provider that reads its storage back through the schema keeps it.
Adapts an OAuthClientProvider for use with the widened transport authProvider option.
The auth() inline options object becomes a named type with iss, skipIssuerMetadataValidation, and forceReauthorization fields.
Reports a mismatch between a recorded authorization server and the current one.
A minimal interface supports static-token and other non-OAuth bearer authentication; transports call token before requests and onUnauthorized after 401.
Cacheable client verbs may return fresh server-stamped cached entries; per-call cacheMode can refresh or bypass the cache.
connect accepts a cached era verdict through prior, allowing modern connections to skip discovery round trips or known legacy servers to skip the probe.
Adds a client option for partitioning response-cache entries.
Adds a client option for the default response-cache TTL.
Set this option to true to restore the v1 throw when a list method is called for an unadvertised capability.
Although v2 is ESM-first, it ships a CommonJS build so CommonJS projects can use require directly without a dynamic import shim.
New exported type extending RequestOptions with prior?: PriorDiscovery.
The legacy option can be set to 'reject' when creating a handler alongside routing for 2025-era clients.
Use exported guards rather than the in operator to discriminate passthrough result unions, whose index signatures prevent property-based narrowing.
Custom entries composing classifyInboundRequest or PerRequestHTTPServerTransport can use the exported helper to apply JSON Content-Type validation.
Use isLegacyRequest to route HTTP-session requests to the transport serving 2025-era clients.
Client and server export keyed type guards as a Zod-free alternative for checking MCP spec values.
A dedicated error reports authorization-server issuer mismatches.
Custom three-argument handlers now receive _meta, except reserved io.modelcontextprotocol/* envelope keys; strict parameter schemas should allow an optional _meta member.
A typed ProtocolError subclass carries data.requiredCapabilities.
Explicit validator subpaths expose named backend classes for customization; importing a backend subpath requires its corresponding peer dependency.
Exported method-union type used to select the spec notification-handler overload for computed method strings.
New exported type representing a cached modern discovery result or a legacy verdict.
Reconstructs the typed subclass from code, message, and data, including plain wire shapes and SDK copies predating brand-matched instanceof.
Gains an optional scope parameter that overrides clientMetadata.scope in the registration body.
Registration rejection errors carry status, body, and submittedMetadata.
A typed ProtocolError subclass for unknown resources carries .uri.
ResponseCacheStore adds delete(key) for removing a cached entry.
Result types are inferred from the method name through this map.
SdkError represents local SDK errors that do not cross the wire and uses SdkErrorCode.
Static isInstance guards brand-match errors across separately bundled SDK copies and narrow the type in TypeScript.
SdkErrorCode identifies local SDK errors, including request timeouts and connection-closed errors.
SdkHttpError extends SdkError for HTTP transport errors and exposes typed .status and .statusText fields.
Client and server export synchronous StandardSchemaV1 validators as a Zod-free alternative to raw Zod schemas.
The framework-agnostic validateHostHeader helper is available from @modelcontextprotocol/server.
Performance 1
No longer converts tool schemas up front, avoiding repeated conversion on each request when a server is built per request.
Behavior and default changes 19
@modelcontextprotocol/node accepts version 1.x or 2.x; a new install resolves version 2.x.
Express, Fastify, and Hono app helpers accept
<scheme>://*entries, allowing servers to admit MCP clients running as browser extensions.Refreshes once after a 401 on connect instead of retrying without limit.
Accepts
<scheme>://*origin entries, allowing servers to admit MCP clients running as browser extensions.When called without a cursor, follows nextCursor until the server stops sending one, returning the whole list.
Hostnames ending in .localhost count as loopback for OAuth token endpoints, supporting host-based multi-tenant local setups.
The DCR default is derived from redirect_uris: loopback or custom URI schemes use native; otherwise web.
The transport option now accepts AuthProvider or OAuthClientProvider; OAuthClientProvider implementations continue to work through an internal adapter.
Spec-method calls no longer require a result-schema argument; the SDK resolves it from the method name.
Use the raw request method for page-level observation; unlike typed list verbs, it never aggregates pagination.
Spec-method sends no longer require a result-schema argument; custom methods still do.
The in-memory response cache is now bounded, with a default capacity of 512 entries.
The SDK selects a JSON Schema validator by runtime: AJV on Node.js and @cfworker/json-schema on Cloudflare Workers; Workers users can remove explicit configuration.
McpServer installs handlers for declared primitive capabilities even with no registrations, so empty list requests return empty results rather than Method not found.
Tool output schemas may now have non-object roots; for non-object structuredContent without its own text block, the SDK auto-appends a JSON.stringify text block.
Spec-method calls no longer require a result schema; the SDK resolves and validates the spec result by method name. Custom methods still require a schema, and arbitrary-method relays must keep passing one.
A buffer limit is added for v1 stdio.
Objects and nominal types from v1-imported and v2-imported code do not interoperate; keep them separated across process or transport boundaries.
Request-related events emitted after closeSSE(), and final responses without a connected per-request stream, are persisted to eventStore for replay.
Tooling 2
The codemod keeps a file's leading comment block and directives above the rewritten imports.
CommonJS test runners such as Jest no longer need a moduleNameMapper workaround to import the v2 packages; remove v1 mappings to dist/*.mjs.
Fixes and other changes 15
The handler now sends Allow: POST on every 405 response.
A Server connected to a per-request transport at a modern revision now binds that revision instead of answering -32022.
Updating the title of a resource or resource template now appears in list responses.
Becomes a regular dependency of
@modelcontextprotocol/node, so installs with strict peer-dependency checking no longer fail.Types the callback correctly when no
argsSchemais given.Reports when a probe receives an unusable 2xx reply instead of presenting it as a network failure.
No longer lets a rejection escape as a process-level unhandled rejection, and no longer hangs when a send never settles.
No longer overflows the stack when the factory returns the same server instance for more than one request; a fresh instance per request is still required.
Inlining the jose types used by the DPoP API in declaration files restores type-checking for CommonJS TypeScript projects.
Preserves _meta on input_required results.
Sending a notification on a closed connection no longer produces a briefly unhandled promise rejection.
createMcpHandler ends a subscriptions/listen stream right after the acknowledgement when it honored none of the requested notification types.
CacheEntry.value and the set() entry value are JSON-serialized result documents (string), not unknown; persist and return the value verbatim.
On the legacy era, inbound results missing content default to []; 2026-07-28 connections remain strict, and content-less handler results are normalized before reaching the wire.
The stdio implementation always sets windowsHide on Windows, rather than doing so only in Electron.
@modelcontextprotocol/sdk 198 changes
Breaking changes 6
Stored OAuth tokens and client information now include an issuer field; storage that rejects unknown fields needs to allow it.
Null requested TTLs are disallowed, preventing an infinite TTL.
Plain JSON Schema objects passed as inputSchema are now rejected.
Removes loose or passthrough types not allowed or defined by the MCP spec, along with Task types.
Updates the signature to provide a properly typed ToolCallback.
Request payloads are decoupled and passthrough iteration is removed.
Security 6
Keep tasks in the in-memory task store within the session that created them.
HTTP request bodies are read with a size limit, preventing unbounded body reads.
MCP TypeScript SDK: HTTP server transports and handlers did not limit request body size or JSON-RPC batch length
@modelcontextprotocol/sdk has cross-client data leak via shared server/transport instance reuse
Anthropic's MCP TypeScript SDK has a ReDoS vulnerability
Model Context Protocol (MCP) TypeScript SDK does not enable DNS rebinding protection by default
Deprecations 1
Marks the old elicitInput overload as deprecated.
New APIs and options 26
Servers and clients can advertise extensions in the capability object.
Adds discoverOAuthServerInfo() to v1.x for discovering OAuth server information.
Adds a url property to the RequestInfo interface.
Adds streaming methods for elicitation and sampling.
Client Credentials providers now support scopes.
Changed handlers can be listed on the client constructor.
Adds a fetch transport.
The Icon schema gains a theme property.
The Implementation schema gains an optional description field.
Role is now a reusable type instead of an inline type.
Resource annotations are now optional, allowing developers to include them when defining resources.
Adds a client credentials flow for machine-to-machine use without user interaction.
Adds a closeSSEStream callback to RequestHandlerExtra.
Adds closeStandaloneSSEStream for GET stream polling.
Adds backwards-compatible overloads for SEP-1577.
Adds the invalid_target OAuth error from RFC 8707.
Adds task support in line with SEP-1686.
Adds URL-based client metadata registration.
Implements sampling with tools.
Implements SSE polling via server-side disconnect.
Adds URL-based elicitation support.
Supports Zod v4 while retaining backwards compatibility with v3.25+.
Elicitation schemas support default values.
registerTool accepts ZodType<object> for input and output schemas, allowing object schemas to be used for both.
Tool names have a specified format.
JSON schema validator providers are now pluggable, allowing developers to use different validators.
Performance 1
Adds caching for OAuth server discovery.
Behavior and default changes 15
Registration is allowed after connect() when the capability was declared.
Accept tools/call and prompts/get requests that omit arguments.
JSON-RPC batch length is bounded.
The Streamable HTTP server transport sends SSE keep-alive comment frames.
Loopback port handling was relaxed to align with RFC 8252.
Resource metadata is now used by default to determine supported scopes.
When the server omits this field, the SDK now defaults to client_secret_basic.
Adds validation for protocol dates.
Allows HTTP issuer URLs when development mode is enabled.
Request header validation now allows requests without an Origin header because they are not relevant to server DNS rebinding protection.
Uses catchall on inputSchema and outputSchema to support JSON Schema 2020-12.
Adjusts authentication scope management to align with SEP-835.
Supports upscoping after an insufficient_scope 403 response.
Metadata discovery uses only path-based discovery URLs from the authorization server.
An empty string is now accepted as a valid URL in the DCR workflow.
Tooling 2
Typing exports are added to the package, enabling consumers to resolve the package's TypeScript types.
Adds an ESLint rule to prefer node protocols.
Fixes and other changes 41
Optional Transport properties now explicitly include undefined in their types.
Authentication preserves resource URIs without a trailing slash.
Content-Type is validated using its parsed media type rather than a substring match.
Fixes the lifecycle of the Streamable HTTP server transport's SSE keep-alive timer.
Supports Zod 3.25 method literals.
Server errors prioritize Zod issues and format them, making validation failures clearer.
The v1.x branch is treated as the primary branch for the npm latest tag, affecting which release users receive when installing the package without specifying a version.
ResourceSchema gains the missing size field, making that field available in the schema's types.
onerror is now called for transport errors that were previously silently swallowed, allowing developers to handle those errors.
Uses the correct schema for client sampling validation when tools are present.
Prevents Hono from overriding the global Response object.
Spec types received backwards compatibility changes.
Automatic completion support is not provided unless needed.
Fixes support for updating the output schema.
Fixes schema description extraction for Zod v4.
closeSSEStream is skipped for old protocol versions.
HTTP connections are released after POST responses.
Priming events are skipped for old protocol versions.
Fixes infinite retries when maxRetries is set to 0.
Updates the protocol version to 2025-11-25.
Normalizes null to undefined in the content field.
Coerces expires_in to a number.
HTTP error response bodies are now consumed.
Fixes JSON parse errors for SSE events with empty data.
Improves SSE reconnection behavior.
Normalizes headers in the SSE transport.
Fixes stdio servers hanging.
Fixes transport instantiation.
Client send() now uses StreamableHTTPError instead of a plain Error.
Calls tasks/result to deliver side-channel messages.
Allows Zod 4 transformations.
Fixes optional argument handling in prompts for Zod V4.
Disabled SSE priming events to preserve backwards compatibility with clients that crash on empty SSE data.
Updates handling to match upstream RC schema changes for form mode elicitation requests.
Auth requests now receive the RequestInit options.
Validates constraints for tools, tool_use, and tool_result in sampling.
Fixes the March spec fallback for metadata discovery.
Support the scope parameter in WWW-Authenticate for SEP-835.
The SDK now prefers the token_endpoint_auth_method returned by DCR registration.
Fixes handling of Zod-to-JSONSchema pipe strategies.
Auth metadata requests now include an Accept header.