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/re-export them from client/server.
8
+
9
+
`@modelcontextprotocol/core` now exposes runtime validator providers via explicit internal subpaths, `@modelcontextprotocol/core/validators/ajv` and `@modelcontextprotocol/core/validators/cfWorker`, with both AJV and `@cfworker/json-schema` treated as optional peer dependencies.
10
+
The root core barrel no longer re-exports runtime validator providers, so importing core does not force either backend.
11
+
12
+
`@modelcontextprotocol/client` and `@modelcontextprotocol/server` still 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 just to use the default runtime behavior.
14
+
15
+
For explicit custom validator configuration, client/server now re-export bundled validators from `@modelcontextprotocol/client/validators/ajv`, `@modelcontextprotocol/client/validators/cf-worker`, `@modelcontextprotocol/server/validators/ajv`, and
|`@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
+33-23Lines changed: 33 additions & 23 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:
0 commit comments