Version Packages (alpha)#175
Open
github-actions[bot] wants to merge 1 commit into
Open
Conversation
9bf0e19 to
b798e3c
Compare
df38f93 to
59df763
Compare
5582238 to
b362edf
Compare
89b57bb to
085b09c
Compare
e385700 to
41a64d9
Compare
f341bd3 to
636fae5
Compare
ada79de to
d9110e9
Compare
e956327 to
ee99040
Compare
752fad9 to
894c2e2
Compare
c5aad6d to
e9f4a90
Compare
72ccc3f to
3b6840e
Compare
e6326bb to
53f503a
Compare
940e536 to
c2e832f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or setup this action to publish automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
mainis currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, runchangeset pre exitonmain.Releases
@modelcontextprotocol/client@2.0.0-alpha.3
Minor Changes
#2049
4f226c1Thanks @KKonstantinov! - AddSdkHttpErrorsubclasswith typed
.status/.statusTextaccessors for HTTP transport failures.StreamableHTTPClientTransportnow throwsSdkHttpError(which extendsSdkError) for non-OK HTTP responses;SSEClientTransportthrowsSdkHttpErrorfor 401-after-reauth (circuit breaker).#1974
db83829Thanks @felixweinberger! - Add custom (non-spec)method support: a 3-arg
setRequestHandler(method, schemas, handler)/setNotificationHandler(method, schemas, handler)form for vendor-prefixed methods, and arequest(req, resultSchema)overload (also onctx.mcpReq.send) for typed custom-method results. Spec-methodcalls are unchanged.
Response result-schema validation failure now rejects with
SdkError(InvalidResult)instead of a rawZodError. AddsSdkErrorCode.InvalidResult.#1653
6bec24aThanks @rechedev9! - AddvalidateClientMetadataUrl()utility for early validation of
clientMetadataUrlExports a
validateClientMetadataUrl()function thatOAuthClientProviderimplementations can call in their constructors to fail fast on invalid URL-based client IDs, instead of discovering the error deep in the auth flow.#1887
96db044Thanks @felixweinberger! - ExportisSpecTypeandspecTypeSchemasrecords for runtime validation of any MCP spec type by name.isSpecType.ContentBlock(value)is a type predicate;specTypeSchemas.ContentBlockis aStandardSchemaV1Sync<ContentBlock>validator —validate()returns the result synchronously. Guards arestandalone functions, so
arr.filter(isSpecType.ContentBlock)works. Also export theSpecTypeName,SpecTypes, andStandardSchemaV1Synctypes.#1871
9fc9070Thanks @felixweinberger! - Move stdio transportsto a
./stdiosubpath export. ImportStdioClientTransport,getDefaultEnvironment,DEFAULT_INHERITED_ENV_VARS, andStdioServerParametersfrom@modelcontextprotocol/client/stdio, andStdioServerTransportfrom@modelcontextprotocol/server/stdio. The@modelcontextprotocol/clientroot entry no longer pulls innode:child_process,node:stream, orcross-spawn, fixing bundling for browser and Cloudflare Workers targets; the@modelcontextprotocol/serverroot entry drops itsnode:streamreference. Node.js, Bun, andDeno consumers update the import path; runtime behavior is unchanged.
Patch Changes
#1897
434b2f1Thanks @felixweinberger! - Stop bundling@cfworker/json-schemainto the main package barrel. PreviouslyCfWorkerJsonSchemaValidatorwas re-exported from the core internal barrel, so tsdown inlined the@cfworker/json-schemadependency into every consumer's bundle even when it was never used. The named validatorclasses are now reachable only via the explicit
@modelcontextprotocol/{client,server}/validators/{ajv,cf-worker}subpaths and the runtime_shimsconditional, so consumers that import only from the root entry point no longer ship the validator dep.#1834
42cb6b2Thanks @felixweinberger! - ExportInMemoryTransportfor in-process testing.#1898
2a7611dThanks @felixweinberger! - Add top-leveltypesfield (and
typesVersionson client/server for their subpath exports) so consumers on legacymoduleResolution: "node"can resolve type declarations. Theexportsmap remains the source of truth fornodenext/bundlerresolution. ThetypesVersionsmap includes entriesfor subpaths added by sibling PRs in this series (
zod-schemas,stdio); those entries are no-ops until the correspondingdist/*.d.mtsfiles exist.#1655
1eb3123Thanks @nielskaspers! - fix(client): append customAccept headers to spec-required defaults in StreamableHTTPClientTransport
Custom Accept headers provided via
requestInit.headersare now appended to the spec-mandated Accept types instead of being overwritten. This ensures the required media types (application/json, text/event-streamfor POST;text/event-streamfor GET SSE) are always presentwhile allowing users to include additional types for proxy/gateway routing.
#2088
16d13abThanks @mattzcarey! - Bundle automatic JSON Schemavalidator defaults in
@modelcontextprotocol/clientand@modelcontextprotocol/serverruntime shims.Client and server pick the right validator automatically based on the runtime: the Node shim uses AJV, the browser/workerd shim uses
@cfworker/json-schema. Both backends are bundled into the shim chunks that select them, so the default code path needs no extra installs —import { McpServer } from '@modelcontextprotocol/server'does not pullajvor@cfworker/json-schemainto the root entry chunk.The named validator classes remain part of the public surface for consumers who want to customize the built-in backend (pre-register schemas by
$id, register custom AJV formats, switch dialects, change@cfworker/json-schemadraft). They are exposed through explicitsubpaths so they do not bloat the root index chunk:
import { AjvJsonSchemaValidator } from '@modelcontextprotocol/{client,server}/validators/ajv'import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/{client,server}/validators/cf-worker'Importing from one of these subpaths means the corresponding peer dep (
ajv+ajv-formats, or@cfworker/json-schema) must be in yourpackage.json. The shim keeps its own vendored copy for the default path, so a project can use the subpath in some files and rely on thedefault in others.
The
jsonSchemaValidatorinterface remains the public extension point for replacing validation entirely with a custom implementation.#1976
55b1f06Thanks @felixweinberger! - refactor: subclassesoverride
_wrapHandlerhook instead of redeclaringsetRequestHandler.#1895
b256546Thanks @felixweinberger! - Fix runtime crash ontools/listwhen a tool'sinputSchemacomes from zod 4.0–4.1. The SDK requires~standard.jsonSchema(StandardJSONSchemaV1, added in zod 4.2.0); previously a missingjsonSchemacrashed atundefined[io].standardSchemaToJsonSchemanow detects zod 4 schemas lackingjsonSchemaand falls back to the SDK-bundledz.toJSONSchema(), emitting a one-time console warning. zod 3 schemas (which the bundled zod 4 converter cannot introspect) and non-zod schema libraries withoutjsonSchemaget a clear error pointing tofromJsonSchema(). Theworkspace zod catalog is also bumped to
^4.2.0.@modelcontextprotocol/express@2.0.0-alpha.3
Minor Changes
7cccc2aThanks @felixweinberger! - Add OAuthResource-Server glue to the Express adapter:
requireBearerAuthmiddleware (token verification + RFC 6750WWW-Authenticatechallenges),mcpAuthMetadataRouter(serves RFC 9728 Protected Resource Metadata and mirrors RFC 8414 AS metadata at the resource origin), thegetOAuthProtectedResourceMetadataUrlhelper, and theOAuthTokenVerifierinterface. These restore the v1src/server/authResource-Server pieces as first-class v2 API so MCP servers can plug into an external Authorization Server with a few lines of Express wiring.Patch Changes
#1898
2a7611dThanks @felixweinberger! - Add top-leveltypesfield (and
typesVersionson client/server for their subpath exports) so consumers on legacymoduleResolution: "node"can resolve type declarations. Theexportsmap remains the source of truth fornodenext/bundlerresolution. ThetypesVersionsmap includes entriesfor subpaths added by sibling PRs in this series (
zod-schemas,stdio); those entries are no-ops until the correspondingdist/*.d.mtsfiles exist.Updated dependencies [
434b2f1,db83829,42cb6b2,df4b6cc,2c0c481,2a7611d,e15a8ef,96db044,9fc9070,16d13ab,55b1f06,b256546]:@modelcontextprotocol/server@2.0.0-alpha.3
Minor Changes
#1974
db83829Thanks @felixweinberger! - Add custom (non-spec)method support: a 3-arg
setRequestHandler(method, schemas, handler)/setNotificationHandler(method, schemas, handler)form for vendor-prefixed methods, and arequest(req, resultSchema)overload (also onctx.mcpReq.send) for typed custom-method results. Spec-methodcalls are unchanged.
Response result-schema validation failure now rejects with
SdkError(InvalidResult)instead of a rawZodError. AddsSdkErrorCode.InvalidResult.#1887
96db044Thanks @felixweinberger! - ExportisSpecTypeandspecTypeSchemasrecords for runtime validation of any MCP spec type by name.isSpecType.ContentBlock(value)is a type predicate;specTypeSchemas.ContentBlockis aStandardSchemaV1Sync<ContentBlock>validator —validate()returns the result synchronously. Guards arestandalone functions, so
arr.filter(isSpecType.ContentBlock)works. Also export theSpecTypeName,SpecTypes, andStandardSchemaV1Synctypes.#1871
9fc9070Thanks @felixweinberger! - Move stdio transportsto a
./stdiosubpath export. ImportStdioClientTransport,getDefaultEnvironment,DEFAULT_INHERITED_ENV_VARS, andStdioServerParametersfrom@modelcontextprotocol/client/stdio, andStdioServerTransportfrom@modelcontextprotocol/server/stdio. The@modelcontextprotocol/clientroot entry no longer pulls innode:child_process,node:stream, orcross-spawn, fixing bundling for browser and Cloudflare Workers targets; the@modelcontextprotocol/serverroot entry drops itsnode:streamreference. Node.js, Bun, andDeno consumers update the import path; runtime behavior is unchanged.
Patch Changes
#1897
434b2f1Thanks @felixweinberger! - Stop bundling@cfworker/json-schemainto the main package barrel. PreviouslyCfWorkerJsonSchemaValidatorwas re-exported from the core internal barrel, so tsdown inlined the@cfworker/json-schemadependency into every consumer's bundle even when it was never used. The named validatorclasses are now reachable only via the explicit
@modelcontextprotocol/{client,server}/validators/{ajv,cf-worker}subpaths and the runtime_shimsconditional, so consumers that import only from the root entry point no longer ship the validator dep.#1834
42cb6b2Thanks @felixweinberger! - ExportInMemoryTransportfor in-process testing.#1788
df4b6ccThanks @claygeo! - Prevent stack overflow inStreamableHTTPServerTransport.close() with re-entrant guard
#1855
2c0c481Thanks @Christian-Sidak! - Add| undefinedtooptional callback and function properties on
WebStandardStreamableHTTPServerTransportOptions(sessionIdGenerator,onsessioninitialized,onsessionclosed) and corresponding private fields.This fixes TS2430 errors for consumers using
exactOptionalPropertyTypes: truewithoutskipLibCheck, where optional properties with function types need explicit| undefinedto match their emitted declarations.#1898
2a7611dThanks @felixweinberger! - Add top-leveltypesfield (and
typesVersionson client/server for their subpath exports) so consumers on legacymoduleResolution: "node"can resolve type declarations. Theexportsmap remains the source of truth fornodenext/bundlerresolution. ThetypesVersionsmap includes entriesfor subpaths added by sibling PRs in this series (
zod-schemas,stdio); those entries are no-ops until the correspondingdist/*.d.mtsfiles exist.#1901
e15a8efThanks @felixweinberger! -registerTool/registerPromptaccept a raw Zod shape ({ field: z.string() }) forinputSchema/outputSchema/argsSchemain addition to a wrapped Standard Schema. Raw shapes are auto-wrapped withz.object(). The raw-shape overloads are@deprecated; prefer wrappingwith
z.object().Also widens the
completable()constraint fromStandardSchemaWithJSONtoStandardSchemaV1so v1'scompletable(z.string(), fn)continues to work.#2088
16d13abThanks @mattzcarey! - Bundle automatic JSON Schemavalidator defaults in
@modelcontextprotocol/clientand@modelcontextprotocol/serverruntime shims.Client and server pick the right validator automatically based on the runtime: the Node shim uses AJV, the browser/workerd shim uses
@cfworker/json-schema. Both backends are bundled into the shim chunks that select them, so the default code path needs no extra installs —import { McpServer } from '@modelcontextprotocol/server'does not pullajvor@cfworker/json-schemainto the root entry chunk.The named validator classes remain part of the public surface for consumers who want to customize the built-in backend (pre-register schemas by
$id, register custom AJV formats, switch dialects, change@cfworker/json-schemadraft). They are exposed through explicitsubpaths so they do not bloat the root index chunk:
import { AjvJsonSchemaValidator } from '@modelcontextprotocol/{client,server}/validators/ajv'import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/{client,server}/validators/cf-worker'Importing from one of these subpaths means the corresponding peer dep (
ajv+ajv-formats, or@cfworker/json-schema) must be in yourpackage.json. The shim keeps its own vendored copy for the default path, so a project can use the subpath in some files and rely on thedefault in others.
The
jsonSchemaValidatorinterface remains the public extension point for replacing validation entirely with a custom implementation.#1976
55b1f06Thanks @felixweinberger! - refactor: subclassesoverride
_wrapHandlerhook instead of redeclaringsetRequestHandler.#1895
b256546Thanks @felixweinberger! - Fix runtime crash ontools/listwhen a tool'sinputSchemacomes from zod 4.0–4.1. The SDK requires~standard.jsonSchema(StandardJSONSchemaV1, added in zod 4.2.0); previously a missingjsonSchemacrashed atundefined[io].standardSchemaToJsonSchemanow detects zod 4 schemas lackingjsonSchemaand falls back to the SDK-bundledz.toJSONSchema(), emitting a one-time console warning. zod 3 schemas (which the bundled zod 4 converter cannot introspect) and non-zod schema libraries withoutjsonSchemaget a clear error pointing tofromJsonSchema(). Theworkspace zod catalog is also bumped to
^4.2.0.@modelcontextprotocol/fastify@2.0.0-alpha.3
Patch Changes
#1898
2a7611dThanks @felixweinberger! - Add top-leveltypesfield (and
typesVersionson client/server for their subpath exports) so consumers on legacymoduleResolution: "node"can resolve type declarations. Theexportsmap remains the source of truth fornodenext/bundlerresolution. ThetypesVersionsmap includes entriesfor subpaths added by sibling PRs in this series (
zod-schemas,stdio); those entries are no-ops until the correspondingdist/*.d.mtsfiles exist.Updated dependencies [
434b2f1,db83829,42cb6b2,df4b6cc,2c0c481,2a7611d,e15a8ef,96db044,9fc9070,16d13ab,55b1f06,b256546]:@modelcontextprotocol/hono@2.0.0-alpha.3
Patch Changes
#1898
2a7611dThanks @felixweinberger! - Add top-leveltypesfield (and
typesVersionson client/server for their subpath exports) so consumers on legacymoduleResolution: "node"can resolve type declarations. Theexportsmap remains the source of truth fornodenext/bundlerresolution. ThetypesVersionsmap includes entriesfor subpaths added by sibling PRs in this series (
zod-schemas,stdio); those entries are no-ops until the correspondingdist/*.d.mtsfiles exist.Updated dependencies [
434b2f1,db83829,42cb6b2,df4b6cc,2c0c481,2a7611d,e15a8ef,96db044,9fc9070,16d13ab,55b1f06,b256546]:@modelcontextprotocol/node@2.0.0-alpha.3
Patch Changes
#1896
5433f40Thanks @felixweinberger! - Markhonopeerdependency as optional.
@modelcontextprotocol/nodeonly usesgetRequestListenerfrom@hono/node-server(Node HTTP ↔ Web Standard conversion), which does not require thehonoframework at runtime. Consumers no longer need to installhonoto useNodeStreamableHTTPServerTransport. Note:@hono/node-serveritself still declareshonoas a hard peer, so package managers may emit a warning; this is upstream and harmless forgetRequestListener-only usage.#1898
2a7611dThanks @felixweinberger! - Add top-leveltypesfield (and
typesVersionson client/server for their subpath exports) so consumers on legacymoduleResolution: "node"can resolve type declarations. Theexportsmap remains the source of truth fornodenext/bundlerresolution. ThetypesVersionsmap includes entriesfor subpaths added by sibling PRs in this series (
zod-schemas,stdio); those entries are no-ops until the correspondingdist/*.d.mtsfiles exist.Updated dependencies [
434b2f1,db83829,42cb6b2,df4b6cc,2c0c481,2a7611d,e15a8ef,96db044,9fc9070,16d13ab,55b1f06,b256546]:@modelcontextprotocol/core@2.0.0-alpha.2
Minor Changes
#2049
4f226c1Thanks @KKonstantinov! - AddSdkHttpErrorsubclasswith typed
.status/.statusTextaccessors for HTTP transport failures.StreamableHTTPClientTransportnow throwsSdkHttpError(which extendsSdkError) for non-OK HTTP responses;SSEClientTransportthrowsSdkHttpErrorfor 401-after-reauth (circuit breaker).#1974
db83829Thanks @felixweinberger! - Add custom (non-spec)method support: a 3-arg
setRequestHandler(method, schemas, handler)/setNotificationHandler(method, schemas, handler)form for vendor-prefixed methods, and arequest(req, resultSchema)overload (also onctx.mcpReq.send) for typed custom-method results. Spec-methodcalls are unchanged.
Response result-schema validation failure now rejects with
SdkError(InvalidResult)instead of a rawZodError. AddsSdkErrorCode.InvalidResult.#2088
16d13abThanks @mattzcarey! - Bundle automatic JSON Schemavalidator defaults in
@modelcontextprotocol/clientand@modelcontextprotocol/serverruntime shims.Client and server pick the right validator automatically based on the runtime: the Node shim uses AJV, the browser/workerd shim uses
@cfworker/json-schema. Both backends are bundled into the shim chunks that select them, so the default code path needs no extra installs —import { McpServer } from '@modelcontextprotocol/server'does not pullajvor@cfworker/json-schemainto the root entry chunk.The named validator classes remain part of the public surface for consumers who want to customize the built-in backend (pre-register schemas by
$id, register custom AJV formats, switch dialects, change@cfworker/json-schemadraft). They are exposed through explicitsubpaths so they do not bloat the root index chunk:
import { AjvJsonSchemaValidator } from '@modelcontextprotocol/{client,server}/validators/ajv'import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/{client,server}/validators/cf-worker'Importing from one of these subpaths means the corresponding peer dep (
ajv+ajv-formats, or@cfworker/json-schema) must be in yourpackage.json. The shim keeps its own vendored copy for the default path, so a project can use the subpath in some files and rely on thedefault in others.
The
jsonSchemaValidatorinterface remains the public extension point for replacing validation entirely with a custom implementation.Patch Changes
#1930
bdfd7f0Thanks @Christian-Sidak! - FixrequestStreamtocall
tasks/resultfor failed tasks instead of yielding a hardcodedProtocolError. When a task reaches thefailedterminal status, the stream now retrieves and yields the actual stored result (matching the behavior forcompletedtasks), as required by the spec.#1901
e15a8efThanks @felixweinberger! -registerTool/registerPromptaccept a raw Zod shape ({ field: z.string() }) forinputSchema/outputSchema/argsSchemain addition to a wrapped Standard Schema. Raw shapes are auto-wrapped withz.object(). The raw-shape overloads are@deprecated; prefer wrappingwith
z.object().Also widens the
completable()constraint fromStandardSchemaWithJSONtoStandardSchemaV1so v1'scompletable(z.string(), fn)continues to work.#1976
55b1f06Thanks @felixweinberger! - refactor: subclassesoverride
_wrapHandlerhook instead of redeclaringsetRequestHandler.#1768
866c08dThanks @felixweinberger! - Allow additional JSONSchema properties in elicitInput's requestedSchema type by adding .catchall(z.unknown()), matching the pattern used by inputSchema. This fixes type incompatibility when using Zod v4's .toJSONSchema() output which includes extra properties like $schema and additionalProperties.
#1895
b256546Thanks @felixweinberger! - Fix runtime crash ontools/listwhen a tool'sinputSchemacomes from zod 4.0–4.1. The SDK requires~standard.jsonSchema(StandardJSONSchemaV1, added in zod 4.2.0); previously a missingjsonSchemacrashed atundefined[io].standardSchemaToJsonSchemanow detects zod 4 schemas lackingjsonSchemaand falls back to the SDK-bundledz.toJSONSchema(), emitting a one-time console warning. zod 3 schemas (which the bundled zod 4 converter cannot introspect) and non-zod schema libraries withoutjsonSchemaget a clear error pointing tofromJsonSchema(). Theworkspace zod catalog is also bumped to
^4.2.0.@modelcontextprotocol/test-e2e@2.0.0-alpha.1
Patch Changes
#2203
4a5c863Thanks @felixweinberger! - Add consumer-sourcede2e requirements (behaviors real SDK dependents rely on) and run the interaction matrix over the legacy HTTP+SSE transport, with known failures recording where v2 intentionally differs.
#2179
1998a18Thanks @felixweinberger! - Add the end-to-endbehavior test suite as a workspace package: a requirements manifest covering protocol-visible SDK behavior across the in-memory, stdio, and Streamable HTTP transports, ported from the v1.x branch and extended with coverage for v2 features.