Skip to content

Commit cdd1478

Browse files
Merge branch 'main' into fweinberger/v2-bc-express-rs-glue
2 parents 4221a15 + 434b2f1 commit cdd1478

29 files changed

Lines changed: 223 additions & 70 deletions
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@modelcontextprotocol/server': patch
3+
'@modelcontextprotocol/client': patch
4+
---
5+
6+
Stop bundling `@cfworker/json-schema` into the main package barrel. Previously `CfWorkerJsonSchemaValidator` was re-exported from the core internal barrel, so tsdown inlined the `@cfworker/json-schema` dev dependency into every consumer's bundle even when it was never used. The validator is now reachable only via the `_shims` conditional (workerd/browser) and the explicit `@modelcontextprotocol/{server,client}/validators/cf-worker` subpath, so consumers that don't opt into it no longer ship that code. No public API change.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@modelcontextprotocol/server': patch
3+
'@modelcontextprotocol/client': patch
4+
---
5+
6+
Export `InMemoryTransport` for in-process testing.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@modelcontextprotocol/core': patch
3+
---
4+
5+
Fix `requestStream` to call `tasks/result` for failed tasks instead of yielding a hardcoded `ProtocolError`. When a task reaches the `failed` terminal status, the stream now retrieves and yields the actual stored result (matching the behavior for `completed` tasks), as required by the spec.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@modelcontextprotocol/core': patch
3+
'@modelcontextprotocol/server': patch
4+
'@modelcontextprotocol/client': patch
5+
---
6+
7+
Fix runtime crash on `tools/list` when a tool's `inputSchema` comes from zod 4.0–4.1. The SDK requires `~standard.jsonSchema` (StandardJSONSchemaV1, added in zod 4.2.0); previously a missing `jsonSchema` crashed at `undefined[io]`. `standardSchemaToJsonSchema` now detects zod 4 schemas lacking `jsonSchema` and falls back to the SDK-bundled `z.toJSONSchema()`, emitting a one-time console warning. zod 3 schemas (which the bundled zod 4 converter cannot introspect) and non-zod schema libraries without `jsonSchema` get a clear error pointing to `fromJsonSchema()`. The workspace zod catalog is also bumped to `^4.2.0`.

README.md

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- [Overview](#overview)
1515
- [Packages](#packages)
1616
- [Installation](#installation)
17-
- [Quick Start (runnable examples)](#quick-start-runnable-examples)
17+
- [Getting Started](#getting-started)
1818
- [Documentation](#documentation)
1919
- [Contributing](#contributing)
2020
- [License](#license)
@@ -90,59 +90,53 @@ npm install @modelcontextprotocol/express express
9090
npm install @modelcontextprotocol/hono hono
9191
```
9292

93-
## Quick Start (runnable examples)
93+
## Getting Started
9494

95-
The runnable examples live under `examples/` and are kept in sync with the docs.
95+
Here is what an MCP server looks like. This minimal example exposes a single `greet` tool over stdio:
9696

97-
1. **Install dependencies** (from repo root):
97+
```typescript
98+
import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server';
99+
import * as z from 'zod/v4';
98100

99-
```bash
100-
pnpm install
101-
```
102-
103-
2. **Run a Streamable HTTP example server**:
104-
105-
```bash
106-
pnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleStreamableHttp.ts
107-
```
101+
const server = new McpServer({ name: 'greeting-server', version: '1.0.0' });
108102

109-
Alternatively, from within the example package:
103+
server.registerTool(
104+
'greet',
105+
{
106+
description: 'Greet someone by name',
107+
inputSchema: z.object({ name: z.string() }),
108+
},
109+
async ({ name }) => ({
110+
content: [{ type: 'text', text: `Hello, ${name}!` }],
111+
}),
112+
);
110113

111-
```bash
112-
cd examples/server
113-
pnpm tsx src/simpleStreamableHttp.ts
114-
```
115-
116-
3. **Run the interactive client in another terminal**:
114+
async function main() {
115+
const transport = new StdioServerTransport();
116+
await server.connect(transport);
117+
}
117118

118-
```bash
119-
pnpm --filter @modelcontextprotocol/examples-client exec tsx src/simpleStreamableHttp.ts
119+
main();
120120
```
121121

122-
Alternatively, from within the example package:
122+
Ready to build something real? Follow the step-by-step quickstart tutorials:
123123

124-
```bash
125-
cd examples/client
126-
pnpm tsx src/simpleStreamableHttp.ts
127-
```
124+
- [Build a weather server](docs/server-quickstart.md) — server quickstart
125+
- [Build an LLM-powered chatbot](docs/client-quickstart.md) — client quickstart
128126

129-
Next steps:
127+
The complete code for each tutorial is in [`examples/server-quickstart/`](https://github.com/modelcontextprotocol/typescript-sdk/tree/main/examples/server-quickstart/) and [`examples/client-quickstart/`](https://github.com/modelcontextprotocol/typescript-sdk/tree/main/examples/client-quickstart/). For more advanced runnable examples, see:
130128

131-
- Server examples index: [`examples/server/README.md`](examples/server/README.md)
132-
- Client examples index: [`examples/client/README.md`](examples/client/README.md)
133-
- Guided walkthroughs: [`docs/server.md`](docs/server.md) and [`docs/client.md`](docs/client.md)
129+
- [`examples/server/README.md`](examples/server/README.md) — server examples index
130+
- [`examples/client/README.md`](examples/client/README.md) — client examples index
134131

135132
## Documentation
136133

137-
- Local SDK docs:
138-
- [docs/server.md](docs/server.md) – building MCP servers: transports, tools, resources, prompts, server-initiated requests, and deployment
139-
- [docs/client.md](docs/client.md) – building MCP clients: connecting, tools, resources, prompts, server-initiated requests, and error handling
140-
- [docs/faq.md](docs/faq.md) – frequently asked questions and troubleshooting
141-
- External references:
142-
- [SDK API documentation](https://ts.sdk.modelcontextprotocol.io/)
143-
- [Model Context Protocol documentation](https://modelcontextprotocol.io)
144-
- [MCP Specification](https://spec.modelcontextprotocol.io)
145-
- [Example Servers](https://github.com/modelcontextprotocol/servers)
134+
- [Server Guide](docs/server.md) — building MCP servers: transports, tools, resources, prompts, server-initiated requests, and deployment
135+
- [Client Guide](docs/client.md) — building MCP clients: connecting, tools, resources, prompts, server-initiated requests, and error handling
136+
- [FAQ](docs/faq.md) — frequently asked questions and troubleshooting
137+
- [API docs](https://modelcontextprotocol.github.io/typescript-sdk/)
138+
- [MCP documentation](https://modelcontextprotocol.io/docs)
139+
- [MCP specification](https://modelcontextprotocol.io/specification/latest)
146140

147141
### Building docs locally
148142

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ For production use, you can either:
6767

6868
### Where can I find runnable server examples?
6969

70-
The SDK ships several runnable server examples under `examples/server/src`. Start from the server examples index in [`examples/server/README.md`](../examples/server/README.md) and the entry-point quick start in the root [`README.md`](../README.md).
70+
The [server quickstart](./server-quickstart.md) walks you through building a weather server from scratch. Its complete source lives in [`examples/server-quickstart/`](https://github.com/modelcontextprotocol/typescript-sdk/tree/main/examples/server-quickstart/). For more advanced examples (OAuth, streaming, sessions, etc.), see the server examples index in [`examples/server/README.md`](../examples/server/README.md).
7171

7272
### Where are the server auth helpers?
7373

docs/migration.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -469,22 +469,20 @@ const client = new Client(
469469
);
470470
```
471471

472-
### `InMemoryTransport` removed from public API
472+
### `InMemoryTransport` moved
473473

474-
`InMemoryTransport` has been removed from the public API surface. It was previously used for in-process client-server connections and testing.
475-
476-
For **testing**, import it directly from the internal core package:
474+
`InMemoryTransport` is now exported from `@modelcontextprotocol/client` and `@modelcontextprotocol/server` (both re-export it). It is still intended for in-process client-server connections and testing.
477475

478476
```typescript
479477
// v1
480478
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
481479

482-
// v2 (testing only — @modelcontextprotocol/core is internal, not for production use)
483-
import { InMemoryTransport } from '@modelcontextprotocol/core';
480+
// v2
481+
import { InMemoryTransport } from '@modelcontextprotocol/server';
482+
// or
483+
import { InMemoryTransport } from '@modelcontextprotocol/client';
484484
```
485485

486-
For **production in-process connections**, use `StreamableHTTPClientTransport` with a local server URL, or connect client and server via paired streams.
487-
488486
### Removed type aliases and deprecated exports
489487

490488
The following deprecated type aliases have been removed from `@modelcontextprotocol/core`:

packages/client/src/shimsBrowser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* This file is selected via package.json export conditions when running in a browser.
55
*/
6-
export { CfWorkerJsonSchemaValidator as DefaultJsonSchemaValidator } from '@modelcontextprotocol/core';
6+
export { CfWorkerJsonSchemaValidator as DefaultJsonSchemaValidator } from '@modelcontextprotocol/core/validators/cfWorker';
77

88
/**
99
* Whether `fetch()` may throw `TypeError` due to CORS. Only true in browser contexts

packages/client/src/shimsWorkerd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* This file is selected via package.json export conditions when running in workerd.
55
*/
6-
export { CfWorkerJsonSchemaValidator as DefaultJsonSchemaValidator } from '@modelcontextprotocol/core';
6+
export { CfWorkerJsonSchemaValidator as DefaultJsonSchemaValidator } from '@modelcontextprotocol/core/validators/cfWorker';
77

88
/**
99
* Whether `fetch()` may throw `TypeError` due to CORS. CORS is a browser-only concept —

packages/client/src/validators/cfWorker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
* import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/client/validators/cf-worker';
77
* ```
88
*/
9-
export { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/core';
10-
export type { CfWorkerSchemaDraft } from '@modelcontextprotocol/core';
9+
export type { CfWorkerSchemaDraft } from '@modelcontextprotocol/core/validators/cfWorker';
10+
export { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/core/validators/cfWorker';

0 commit comments

Comments
 (0)