Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ import cors from "cors";
import express from "express";
import fs from "node:fs/promises";
import path from "node:path";
import { z } from "zod";
import * as z from "zod";

const server = new McpServer({
name: "My MCP App Server",
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-host/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@modelcontextprotocol/sdk": "^1.22.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"zod": "^3.25.0"
"zod": "^4.1.13"
},
"devDependencies": {
"@types/express": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-server-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@modelcontextprotocol/sdk": "^1.22.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"zod": "^3.25.0"
"zod": "^4.1.13"
},
"devDependencies": {
"@types/cors": "^2.8.19",
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-server-vanillajs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@modelcontextprotocol/ext-apps": "../..",
"@modelcontextprotocol/sdk": "^1.22.0",
"zod": "^3.25.0"
"zod": "^4.1.13"
},
"devDependencies": {
"@types/cors": "^2.8.19",
Expand Down
2 changes: 1 addition & 1 deletion examples/budget-allocator-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@modelcontextprotocol/ext-apps": "../..",
"@modelcontextprotocol/sdk": "^1.22.0",
"chart.js": "^4.4.0",
"zod": "^3.25.0"
"zod": "^4.1.13"
},
"devDependencies": {
"@types/cors": "^2.8.19",
Expand Down
2 changes: 1 addition & 1 deletion examples/cohort-heatmap-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@modelcontextprotocol/sdk": "^1.22.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"zod": "^3.25.0"
"zod": "^4.1.13"
},
"devDependencies": {
"@types/cors": "^2.8.19",
Expand Down
2 changes: 1 addition & 1 deletion examples/customer-segmentation-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@modelcontextprotocol/ext-apps": "../..",
"@modelcontextprotocol/sdk": "^1.22.0",
"chart.js": "^4.4.0",
"zod": "^3.25.0"
"zod": "^4.1.13"
},
"devDependencies": {
"@types/cors": "^2.8.19",
Expand Down
2 changes: 1 addition & 1 deletion examples/scenario-modeler-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"chart.js": "^4.4.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"zod": "^3.25.0"
"zod": "^4.1.13"
},
"devDependencies": {
"@types/cors": "^2.8.19",
Expand Down
2 changes: 1 addition & 1 deletion examples/system-monitor-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@modelcontextprotocol/sdk": "^1.22.0",
"chart.js": "^4.4.0",
"systeminformation": "^5.27.11",
"zod": "^3.25.0"
"zod": "^4.1.13"
},
"devDependencies": {
"@types/cors": "^2.8.19",
Expand Down
2 changes: 1 addition & 1 deletion examples/threejs-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"react": "^19.2.0",
"react-dom": "^19.2.0",
"three": "^0.181.0",
"zod": "^3.25.0"
"zod": "^4.1.13"
},
"devDependencies": {
"@types/cors": "^2.8.19",
Expand Down
2 changes: 1 addition & 1 deletion examples/wiki-explorer-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@modelcontextprotocol/ext-apps": "../..",
"@modelcontextprotocol/sdk": "^1.22.0",
"cheerio": "^1.0.0",
"zod": "^3.25.0"
"zod": "^4.1.13"
},
"devDependencies": {
"@types/cors": "^2.8.19",
Expand Down
43 changes: 19 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@
"ts-to-zod": "^5.1.0",
"tsx": "^4.21.0",
"typedoc": "^0.28.14",
"typescript": "^5.9.3"
"typescript": "^5.9.3",
"zod": "^4.1.13"
},
"peerDependencies": {
"zod": "^3.25.0 || ^4.0.0"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.24.3",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"zod": "^3.25"
"react-dom": "^19.2.0"
},
"optionalDependencies": {
"@rollup/rollup-darwin-arm64": "^4.53.3",
Expand Down
8 changes: 4 additions & 4 deletions scripts/generate-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ function postProcess(content: string): string {
// 1. Update import to use zod/v4
content = content.replace(
'import { z } from "zod";',
'import { z } from "zod/v4";',
'import * as z from "zod/v4";',
);

// 2. Add MCP SDK schema imports
const mcpImports = EXTERNAL_TYPE_SCHEMAS.join(",\n ");
content = content.replace(
'import { z } from "zod/v4";',
`import { z } from "zod/v4";
'import * as z from "zod/v4";',
`import * as z from "zod/v4";
import {
${mcpImports},
} from "@modelcontextprotocol/sdk/types.js";`,
Expand Down Expand Up @@ -262,7 +262,7 @@ function replaceRecordAndWithLooseObject(content: string): string {
function postProcessTests(content: string): string {
content = content.replace(
'import { z } from "zod";',
'import { z } from "zod/v4";',
'import * as z from "zod/v4";',
);

content = content.replace(
Expand Down
10 changes: 5 additions & 5 deletions src/app-bridge.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { ZodLiteral, ZodObject } from "zod/v4";
import * as z from "zod/v4/core";

import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
import {
Expand Down Expand Up @@ -838,10 +838,10 @@ export class AppBridge extends Protocol<Request, Notification, Result> {
}

private forwardRequest<
Req extends ZodObject<{
method: ZodLiteral<string>;
Req extends z.$ZodObject<{
method: z.$ZodLiteral<string>;
}>,
Res extends ZodObject<{}>,
Res extends z.$ZodObject<{}>,
>(requestSchema: Req, resultSchema: Res) {
this.setRequestHandler(requestSchema, async (request, extra) => {
console.log(`Forwarding request ${request.method} from MCP UI client`);
Expand All @@ -851,7 +851,7 @@ export class AppBridge extends Protocol<Request, Notification, Result> {
});
}
private forwardNotification<
N extends ZodObject<{ method: ZodLiteral<string> }>,
N extends z.$ZodObject<{ method: z.$ZodLiteral<string> }>,
>(notificationSchema: N) {
this.setNotificationHandler(notificationSchema, async (notification) => {
console.log(
Expand Down
Loading
Loading