fix(deps): declare direct zod dependency in filesystem, memory, and sequential-thinking - #4687
Open
Parker-Fawcett wants to merge 1 commit into
Conversation
…equential-thinking
filesystem, memory, and sequentialthinking import { z } from 'zod' at runtime but do not declare zod anywhere in their package.json. Under strict module resolution (e.g. pnpm enable-global-virtual-store as reported in modelcontextprotocol#4288, yarn PnP-class isolation) this fails with ERR_MODULE_NOT_FOUND; current hoisting defaults mask it, which is why the failure keeps resurfacing after the original dual dependencies/peerDependencies declaration was removed from server-everything in af15c68.
Declare zod ^4.0.0 (matching server-everything's existing declaration and the SDK peer range ^3.25 || ^4.0) and sync package-lock.json.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Author
|
Transparency note while this sits in review: two earlier PRs targeting the same fix exist and are still open — #4289 and #4291 (both from early June). I missed them when opening this one because my survey of open PRs was capped below their numbers; flagging them here rather than leaving three competing diffs for maintainers to triage silently. How this PR differs, for whoever reviews:
Happy to withdraw this in favor of either earlier PR if a maintainer prefers first-in-queue — just say so and I'll close immediately. Otherwise happy to rebase whichever of the three you pick. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
@modelcontextprotocol/server-filesystem,@modelcontextprotocol/server-memory, and@modelcontextprotocol/server-sequential-thinkingall import zod directly at runtime (import { z } from "zod"in their entrypoints) but do not declarezodanywhere in theirpackage.json. This PR adds"zod": "^4.0.0"to each package'sdependenciesand syncs the root lockfile.No runtime code is changed — this is packaging metadata only.
Server Details
Motivation and Context
Fixes #4288.
Issue #4288 reported
ERR_MODULE_NOT_FOUND: Cannot find package 'zod'under pnpm strict resolution, originally attributed to a dualdependencies/peerDependenciesdeclaration. That dual declaration has since been removed fromserver-everything(af15c68), but the underlying failure mode persists on currentmainin its inverse form: three servers consume zod as an undeclared direct dependency.Evidence on current
main:src/filesystem/index.ts:13,src/memory/index.ts:6,src/sequentialthinking/index.ts:5each doimport { z } from "zod", yet none of the three packages listzodindependenciesorpeerDependencies.server-memoryas a consumer dependency and tracing resolution showsimport.meta.resolve('zod')landing in a hoisted store slot rather than any edge declared by the server package. The server only starts because modern pnpm/npm defaults hoist or auto-install peer-resolved packages; under the reporter's configuration (pnpm withenableGlobalVirtualStore) and other strict linkers, resolution fails exactly as traced in zod declared in both dependencies and peerDependencies causes ERR_MODULE_NOT_FOUND with pnpm strict isolation #4288.The fix matches the existing convention established for
server-everything("zod": "^4.0.0"), which satisfies the SDK's peer range (^3.25 || ^4.0).How Has This Been Tested?
npm run build --workspaces: all four TS packages compile clean.server-memorypost-fix, installed it into a clean consumer project under pnpm 11.22, and drove it over stdio JSON-RPC:initializehandshake completes normally ("Knowledge Graph MCP Server running on stdio"), and the published artifact'spackage.jsonnow declares{"@modelcontextprotocol/sdk":"^1.30.0","zod":"^4.0.0"}.Breaking Changes
None. Consumers' resolved versions are unchanged today (the hoisted zod 4.x already satisfies
^4.0.0); the declaration only makes the existing runtime requirement explicit so strict resolvers can satisfy it.Types of changes
Checklist
Additional context
Why one commit across three packages + lockfile: the lockfile entries are the mechanical consequence of the declarations; splitting them out would create intermediate commits with drifted lockfiles. This follows the repo precedent of landing cross-server dependency changes as a single commit (e.g. "bump packages to 1.29.0 SDK").
Suggested follow-up (happy to do it in a separate PR if useful): a small CI guard that fails when a workspace imports a bare package specifier absent from that package's
dependencies, which would catch this class of regression at PR time.