From 842671bf9a9b9d629b365b08bc7ddb54bb5c8512 Mon Sep 17 00:00:00 2001 From: dtheurer-control4 <69261181+dtheurer-control4@users.noreply.github.com> Date: Fri, 13 Nov 2026 08:54:44 -0800 Subject: [PATCH] Import zod/v3 and allow zod 4 The package imports the bare "zod" root, whose API changes between majors, and declares zod ^3.25.67 as a hard dependency, so a consumer on zod 4 (for example the MCP TypeScript SDK) installs a second, nested zod 3 copy of this package's dependency. Import from "zod/v3" (available since zod 3.25.0 and shipped by zod 4) and widen the range to ^3.25.67 || ^4.0.0, as the Zod library-author guide recommends. zod-to-json-schema keeps receiving v3 schemas. yarn.lock updated (resolves 4.6.7 now that the range allows it). --- package.json | 2 +- src/node/sign.ts | 2 +- src/schemas/0.1.ts | 2 +- src/schemas/0.2.ts | 2 +- src/schemas/0.3.ts | 2 +- src/schemas/0.4.ts | 2 +- src/schemas/any.ts | 2 +- src/schemas_loose/0.1.ts | 2 +- src/schemas_loose/0.2.ts | 2 +- src/schemas_loose/0.3.ts | 2 +- src/schemas_loose/0.4.ts | 2 +- src/shared/common.ts | 2 +- src/shared/config.ts | 2 +- src/types.ts | 2 +- yarn.lock | 10 +++++----- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 09a33eed..8e51b9f7 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "ignore": "^7.0.5", "node-forge": "^1.3.2", "pretty-bytes": "^5.6.0", - "zod": "^3.25.67", + "zod": "^3.25.67 || ^4.0.0", "zod-to-json-schema": "^3.24.6" }, "resolutions": { diff --git a/src/node/sign.ts b/src/node/sign.ts index bd4c8c4e..85df570f 100644 --- a/src/node/sign.ts +++ b/src/node/sign.ts @@ -5,7 +5,7 @@ import forge from "node-forge"; import { tmpdir } from "os"; import { join } from "path"; import { promisify } from "util"; -import type { z } from "zod"; +import type { z } from "zod/v3"; import type { McpbSignatureInfoSchema } from "../shared/common.js"; diff --git a/src/schemas/0.1.ts b/src/schemas/0.1.ts index 99221952..fd18cb7e 100644 --- a/src/schemas/0.1.ts +++ b/src/schemas/0.1.ts @@ -1,4 +1,4 @@ -import * as z from "zod"; +import * as z from "zod/v3"; export const MANIFEST_VERSION = "0.1"; diff --git a/src/schemas/0.2.ts b/src/schemas/0.2.ts index bb1de166..5b94ad8f 100644 --- a/src/schemas/0.2.ts +++ b/src/schemas/0.2.ts @@ -1,4 +1,4 @@ -import * as z from "zod"; +import * as z from "zod/v3"; export const MANIFEST_VERSION = "0.2"; diff --git a/src/schemas/0.3.ts b/src/schemas/0.3.ts index 2ca0206b..b6e7d3f8 100644 --- a/src/schemas/0.3.ts +++ b/src/schemas/0.3.ts @@ -1,5 +1,5 @@ // WIP: This schema is under development and not yet finalized -import * as z from "zod"; +import * as z from "zod/v3"; export const MANIFEST_VERSION = "0.3"; diff --git a/src/schemas/0.4.ts b/src/schemas/0.4.ts index ae97d170..a0177c9e 100644 --- a/src/schemas/0.4.ts +++ b/src/schemas/0.4.ts @@ -1,5 +1,5 @@ // v0.4: Adds UV runtime support for Python extensions -import * as z from "zod"; +import * as z from "zod/v3"; export const MANIFEST_VERSION = "0.4"; diff --git a/src/schemas/any.ts b/src/schemas/any.ts index 1b374c70..a247f8f0 100644 --- a/src/schemas/any.ts +++ b/src/schemas/any.ts @@ -1,4 +1,4 @@ -import * as z from "zod"; +import * as z from "zod/v3"; import * as v0_1 from "./0.1.js"; import * as v0_2 from "./0.2.js"; diff --git a/src/schemas_loose/0.1.ts b/src/schemas_loose/0.1.ts index ab7f69cd..1b852988 100644 --- a/src/schemas_loose/0.1.ts +++ b/src/schemas_loose/0.1.ts @@ -1,4 +1,4 @@ -import * as z from "zod"; +import * as z from "zod/v3"; export const MANIFEST_VERSION = "0.1"; diff --git a/src/schemas_loose/0.2.ts b/src/schemas_loose/0.2.ts index bc177d2a..1f31f69a 100644 --- a/src/schemas_loose/0.2.ts +++ b/src/schemas_loose/0.2.ts @@ -1,4 +1,4 @@ -import * as z from "zod"; +import * as z from "zod/v3"; export const MANIFEST_VERSION = "0.2"; diff --git a/src/schemas_loose/0.3.ts b/src/schemas_loose/0.3.ts index a96894b2..14975e41 100644 --- a/src/schemas_loose/0.3.ts +++ b/src/schemas_loose/0.3.ts @@ -1,4 +1,4 @@ -import * as z from "zod"; +import * as z from "zod/v3"; export const MANIFEST_VERSION = "0.3"; diff --git a/src/schemas_loose/0.4.ts b/src/schemas_loose/0.4.ts index 395fd609..6b4e0cd9 100644 --- a/src/schemas_loose/0.4.ts +++ b/src/schemas_loose/0.4.ts @@ -1,5 +1,5 @@ // v0.4: Adds UV runtime support for Python extensions -import * as z from "zod"; +import * as z from "zod/v3"; export const MANIFEST_VERSION = "0.4"; diff --git a/src/shared/common.ts b/src/shared/common.ts index 9a8aeb3e..007cfda0 100644 --- a/src/shared/common.ts +++ b/src/shared/common.ts @@ -1,4 +1,4 @@ -import { z } from "zod"; +import { z } from "zod/v3"; export const McpbUserConfigValuesSchema = z.record( z.string(), diff --git a/src/shared/config.ts b/src/shared/config.ts index 7073f583..26b0caee 100644 --- a/src/shared/config.ts +++ b/src/shared/config.ts @@ -1,4 +1,4 @@ -import type { z } from "zod"; +import type { z } from "zod/v3"; import type { Logger, McpbManifestAny } from "../types.js"; import type { McpbUserConfigValuesSchema } from "./common.js"; diff --git a/src/types.ts b/src/types.ts index 655bffa2..7aa56e49 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,4 @@ -import type * as z from "zod"; +import type * as z from "zod/v3"; import type { McpbManifestSchema as McpbManifestSchemaAny } from "./schemas/any.js"; diff --git a/yarn.lock b/yarn.lock index 538dc22d..d4919cc6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -41,7 +41,7 @@ __metadata: pretty-bytes: "npm:^5.6.0" ts-jest: "npm:^29.3.2" typescript: "npm:^5.6.3" - zod: "npm:^3.25.67" + zod: "npm:^3.25.67 || ^4.0.0" zod-to-json-schema: "npm:^3.24.6" bin: mcpb: dist/cli/cli.js @@ -6397,9 +6397,9 @@ __metadata: languageName: node linkType: hard -"zod@npm:^3.25.67": - version: 3.25.67 - resolution: "zod@npm:3.25.67" - checksum: 10c0/80a0cab3033272c4ab9312198081f0c4ea88e9673c059aa36dc32024906363729db54bdb78f3dc9d5529bd1601f74974d5a56c0a23e40c6f04a9270c9ff22336 +"zod@npm:^3.25.67 || ^4.0.0": + version: 4.6.7 + resolution: "zod@npm:4.6.7" + checksum: 10c0/4ce2eb14034317b7254e347ca37b5ad591cf8333147030cf05b9b5d31692d45073f7f2747aa50cf8c6b29012194d2b22978cecc89969cf34a0d18e89d0ee7d7b languageName: node linkType: hard