From c368d4088a15117759700c69c5bcd9534c5b3d18 Mon Sep 17 00:00:00 2001 From: newblacc Date: Mon, 30 Mar 2026 22:42:46 +0200 Subject: [PATCH] fix: upgrade zod to v4 to fix global install crash @modelcontextprotocol/sdk@1.26.0 uses zod/v4 APIs (specifically z.literal().value getter). When installed globally, npm shared the project's zod@3.25.5 instead of the SDK's nested zod@4.3.6; the 3.25.5 v4 compat shim lacks the .value getter, throwing 'Schema method literal must be a string' on startup. Also updates z.record(z.any()) to z.record(z.string(), z.any()) for zod v4 strict record key typing. 446/446 tests passing. Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 6 ++++++ package.json | 4 ++-- src/index.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b58d719..5f2fbdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ Format: [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] +## [1.0.3] - 2026-03-30 + +### Fixed +- Global install crash (`Schema method literal must be a string`) — upgraded `zod` from `3.25.5` to `^4.3.6` so the package uses real zod v4 rather than falling back to zod 3.x's v4 compatibility shim, which lacks the `.value` getter required by `@modelcontextprotocol/sdk@1.26.0` +- `z.record(z.any())` call updated to `z.record(z.string(), z.any())` to satisfy zod v4's stricter record key-type requirement + ## [1.0.2] - 2026-03-30 ### Added diff --git a/package.json b/package.json index 2e86d1d..03dbe03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "excalidraw-mcp-sentinel", - "version": "1.0.2", + "version": "1.0.3", "description": "Hardened, self-hosted Excalidraw MCP server with SQLite persistence, multi-tenancy, auto-sync, security middleware, and 369 tests", "main": "dist/index.js", "type": "module", @@ -47,7 +47,7 @@ "react-dom": "^18.3.1", "winston": "^3.11.0", "ws": "8.20.0", - "zod": "3.25.5", + "zod": "^4.3.6", "zod-to-json-schema": "^3.22.3" }, "devDependencies": { diff --git a/src/index.ts b/src/index.ts index 33b1022..be3e649 100644 --- a/src/index.ts +++ b/src/index.ts @@ -378,7 +378,7 @@ const DistributeElementsSchema = z.object({ const QuerySchema = z.object({ type: z.enum(Object.values(EXCALIDRAW_ELEMENT_TYPES) as [ExcalidrawElementType, ...ExcalidrawElementType[]]).optional(), - filter: z.record(z.any()).optional() + filter: z.record(z.string(), z.any()).optional() }); const ResourceSchema = z.object({