Skip to content

fix(memory,sequentialthinking,filesystem): declare zod as an explicit dependency#4377

Open
aqilaziz wants to merge 2 commits into
modelcontextprotocol:mainfrom
aqilaziz:fix/missing-zod-dependency
Open

fix(memory,sequentialthinking,filesystem): declare zod as an explicit dependency#4377
aqilaziz wants to merge 2 commits into
modelcontextprotocol:mainfrom
aqilaziz:fix/missing-zod-dependency

Conversation

@aqilaziz

@aqilaziz aqilaziz commented Jun 14, 2026

Copy link
Copy Markdown

Summary

@modelcontextprotocol/server-memory, @modelcontextprotocol/server-sequential-thinking, and @modelcontextprotocol/server-filesystem all import zod at module load (import { z } from "zod") but never declared it in their package.json dependencies.

Under pnpm's strict, non-flat node_modules layout a package can only import the dependencies it declares itself (not transitive ones). So even though @modelcontextprotocol/sdk pulls zod in, these servers crash on startup when run standalone:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package "zod" imported from .../dist/index.js

Reproduces with pnpm dlx @modelcontextprotocol/server-memory / server-sequential-thinking / server-filesystem (issue #4330 reported the first two; server-filesystem has the identical undeclared-zod import and is fixed here too).

Fix

Declare zod explicitly in all three packages using the same range @modelcontextprotocol/sdk itself uses (^3.25 || ^4.0). This keeps zod deduped to the single instance the SDK already resolves (3.25.x in the current lockfile), avoiding a dual-zod-instance hazard when passing schemas to the SDK. package-lock.json is updated to match.

server-everything in this repo already declares zod this way, so the combination is known-good.

Testing

  • Confirmed each of the three source files imports zod while none declared it.
  • Verified the chosen range matches the SDK declaration (^3.25 || ^4.0) and the existing hoisted resolution (zod 3.25.76).

Fixes #4330

aqilaziz added 2 commits June 15, 2026 05:31
Both server-memory and server-sequential-thinking import `zod` at runtime
but never declared it in their package.json. The published npm packages
therefore fail at startup with ERR_MODULE_NOT_FOUND for `zod` when zod is
not otherwise hoisted into node_modules.

Add `zod: ^3.25 || ^4.0` (matching @modelcontextprotocol/sdk peer range) to
both packages and update package-lock.json accordingly.

Fixes modelcontextprotocol#4330
server-filesystem also imports zod at module load (index.ts) without
declaring it. Under pnpm's strict non-flat node_modules a package can
only import its own declared dependencies, so `pnpm dlx
@modelcontextprotocol/server-filesystem` crashes with the same
ERR_MODULE_NOT_FOUND for zod. Declare it with the same range as the
other packages and update the lockfile.
@aqilaziz aqilaziz changed the title fix(memory,sequentialthinking): declare zod as an explicit dependency fix(memory,sequentialthinking,filesystem): declare zod as an explicit dependency Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

server-memory and server-sequential-thinking fail at startup due to missing zod dependency

1 participant