You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make JSON Schema validator backends optional inside core and bundle client/server runtime defaults.
8
+
9
+
`@modelcontextprotocol/core` now keeps runtime validator providers behind explicit internal provider subpaths, with both AJV and `@cfworker/json-schema` treated as optional peer dependencies. The root core barrel no longer re-exports runtime validator providers, so importing core
10
+
does not force either backend.
11
+
12
+
`@modelcontextprotocol/client` and `@modelcontextprotocol/server` provide runtime defaults automatically: Node shims use AJV, while browser/workerd shims use `@cfworker/json-schema`. Those default backends are bundled into the shim chunks that select them, so client/server
13
+
consumers do not need to install validator backends or import explicit validators for the default runtime behavior.
14
+
15
+
Advanced users can still pass their own `jsonSchemaValidator` implementation through client/server options.
|`@modelcontextprotocol/sdk/server/streamableHttp.js`|`@modelcontextprotocol/node` (class renamed to `NodeStreamableHTTPServerTransport`) OR `@modelcontextprotocol/server` (web-standard `WebStandardStreamableHTTPServerTransport` for Cloudflare Workers, Deno, etc.) |
56
56
|`@modelcontextprotocol/sdk/server/sse.js`| REMOVED (migrate to Streamable HTTP) |
|`@modelcontextprotocol/sdk/types.js`|`@modelcontextprotocol/client` or `@modelcontextprotocol/server`|
65
+
|`@modelcontextprotocol/sdk/shared/protocol.js`|`@modelcontextprotocol/client` or `@modelcontextprotocol/server`|
66
+
|`@modelcontextprotocol/sdk/shared/transport.js`|`@modelcontextprotocol/client` or `@modelcontextprotocol/server`|
67
+
|`@modelcontextprotocol/sdk/shared/uriTemplate.js`|`@modelcontextprotocol/client` or `@modelcontextprotocol/server`|
68
+
|`@modelcontextprotocol/sdk/shared/auth.js`|`@modelcontextprotocol/client` or `@modelcontextprotocol/server`|
69
69
|`@modelcontextprotocol/sdk/shared/stdio.js`|`@modelcontextprotocol/client` or `@modelcontextprotocol/server` (`ReadBuffer`, `serializeMessage`, `deserializeMessage` are in the root barrel; the `./stdio` subpath only has the transport class) |
70
70
71
71
Notes:
@@ -323,7 +323,8 @@ new URL(ctx.http?.req?.url).searchParams.get('debug')
323
323
324
324
### Server-side auth
325
325
326
-
Resource Server helpers (`requireBearerAuth`, `mcpAuthMetadataRouter`, `getOAuthProtectedResourceMetadataUrl`, `OAuthTokenVerifier`) are first-class in `@modelcontextprotocol/express`. Authorization Server helpers (`mcpAuthRouter`, `OAuthServerProvider`, `ProxyOAuthServerProvider`, `authenticateClient`, `allowedMethods`, etc.) are removed from the core SDK; use an external IdP/OAuth library. See `examples/server/src/` for demos.
326
+
Resource Server helpers (`requireBearerAuth`, `mcpAuthMetadataRouter`, `getOAuthProtectedResourceMetadataUrl`, `OAuthTokenVerifier`) are first-class in `@modelcontextprotocol/express`. Authorization Server helpers (`mcpAuthRouter`, `OAuthServerProvider`,
327
+
`ProxyOAuthServerProvider`, `authenticateClient`, `allowedMethods`, etc.) are removed from the core SDK; use an external IdP/OAuth library. See `examples/server/src/` for demos.
Copy file name to clipboardExpand all lines: docs/migration.md
+41-28Lines changed: 41 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,7 +137,8 @@ const transport = new StreamableHTTPClientTransport(new URL('http://localhost:30
137
137
138
138
Resource Server helpers (`requireBearerAuth`, `mcpAuthMetadataRouter`, `getOAuthProtectedResourceMetadataUrl`, `OAuthTokenVerifier`) are now first-class in `@modelcontextprotocol/express`.
139
139
140
-
Authorization Server helpers (`mcpAuthRouter`, `OAuthServerProvider`, `ProxyOAuthServerProvider`, `authenticateClient`, `allowedMethods`, etc.) have been removed from the core SDK; new code should use a dedicated IdP/OAuth library. See the [examples](../examples/server/src/) for a working demo with `better-auth`.
140
+
Authorization Server helpers (`mcpAuthRouter`, `OAuthServerProvider`, `ProxyOAuthServerProvider`, `authenticateClient`, `allowedMethods`, etc.) have been removed from the core SDK; new code should use a dedicated IdP/OAuth library. See the [examples](../examples/server/src/) for
141
+
a working demo with `better-auth`.
141
142
142
143
Note: `AuthInfo` has moved from `server/auth/types.ts` to the core types and is now re-exported by `@modelcontextprotocol/client` and `@modelcontextprotocol/server`.
@@ -429,8 +438,8 @@ Common method string replacements:
429
438
430
439
### `Protocol.request()`, `ctx.mcpReq.send()`, and `Client.callTool()` no longer require a schema parameter for spec methods
431
440
432
-
For **spec** methods, the public `Protocol.request()`, `BaseContext.mcpReq.send()`, and `Client.callTool()` methods no longer require a Zod result schema argument. The SDK now resolves the correct result schema internally based on the method name. This means you no longer need to import result schemas
433
-
like `CallToolResultSchema` or `ElicitResultSchema` when making spec-method requests.
441
+
For **spec** methods, the public `Protocol.request()`, `BaseContext.mcpReq.send()`, and `Client.callTool()` methods no longer require a Zod result schema argument. The SDK now resolves the correct result schema internally based on the method name. This means you no longer need to
442
+
import result schemas like `CallToolResultSchema` or `ElicitResultSchema` when making spec-method requests.
434
443
435
444
**`client.request()` — Before (v1):**
436
445
@@ -510,7 +519,8 @@ import { specTypeSchemas } from '@modelcontextprotocol/client';
510
519
const result =awaitspecTypeSchemas.CallToolResult['~standard'].validate(value);
511
520
```
512
521
513
-
`isSpecType` and `specTypeSchemas` are keyed by `SpecTypeName` — a literal union of every named type in the MCP spec — so you get autocomplete and a compile error on typos. `specTypeSchemas.X` is a `StandardSchemaV1<In, Out>`, which composes with any Standard-Schema-aware library. The pre-existing `isCallToolResult(value)` guard still works.
522
+
`isSpecType` and `specTypeSchemas` are keyed by `SpecTypeName` — a literal union of every named type in the MCP spec — so you get autocomplete and a compile error on typos. `specTypeSchemas.X` is a `StandardSchemaV1<In, Out>`, which composes with any Standard-Schema-aware
523
+
library. The pre-existing `isCallToolResult(value)` guard still works.
514
524
515
525
### Client list methods return empty results for missing capabilities
516
526
@@ -706,22 +716,22 @@ try {
706
716
707
717
The new `SdkErrorCode` enum contains string-valued codes for local SDK errors:
|`SdkErrorCode.NotConnected`| Transport is not connected |
722
+
|`SdkErrorCode.AlreadyConnected`| Transport is already connected |
723
+
|`SdkErrorCode.NotInitialized`| Protocol is not initialized |
724
+
|`SdkErrorCode.CapabilityNotSupported`| Required capability is not supported |
725
+
|`SdkErrorCode.RequestTimeout`| Request timed out waiting for response |
726
+
|`SdkErrorCode.ConnectionClosed`| Connection was closed |
727
+
|`SdkErrorCode.SendFailed`| Failed to send message |
718
728
|`SdkErrorCode.InvalidResult`| Response result failed local schema validation |
719
-
|`SdkErrorCode.ClientHttpNotImplemented`| HTTP POST request failed |
720
-
|`SdkErrorCode.ClientHttpAuthentication`| Server returned 401 after re-authentication |
721
-
|`SdkErrorCode.ClientHttpForbidden`| Server returned 403 after trying upscoping |
722
-
|`SdkErrorCode.ClientHttpUnexpectedContent`| Unexpected content type in HTTP response |
723
-
|`SdkErrorCode.ClientHttpFailedToOpenStream`| Failed to open SSE stream |
724
-
|`SdkErrorCode.ClientHttpFailedToTerminateSession`| Failed to terminate session |
729
+
|`SdkErrorCode.ClientHttpNotImplemented`| HTTP POST request failed |
730
+
|`SdkErrorCode.ClientHttpAuthentication`| Server returned 401 after re-authentication |
731
+
|`SdkErrorCode.ClientHttpForbidden`| Server returned 403 after trying upscoping |
732
+
|`SdkErrorCode.ClientHttpUnexpectedContent`| Unexpected content type in HTTP response |
733
+
|`SdkErrorCode.ClientHttpFailedToOpenStream`| Failed to open SSE stream |
734
+
|`SdkErrorCode.ClientHttpFailedToTerminateSession`| Failed to terminate session |
725
735
726
736
#### `StreamableHTTPError` removed
727
737
@@ -932,15 +942,18 @@ const server = new McpServer(
932
942
);
933
943
```
934
944
935
-
You can still explicitly override the validator if needed:
945
+
You do not need to install or import validator packages for the default behavior. The client and server packages bundle the validator backend selected by the runtime shim.
936
946
937
-
```typescript
938
-
// Runtime-aware default (auto-selects AjvJsonSchemaValidator or CfWorkerJsonSchemaValidator)
0 commit comments