Solution skill
memory MCP: Error [ERR_MODULE_NOT_FOUND] Cannot find package 'zod'
Complete solution
Fixes the memory MCP server crashing on startup with a missing zod module error. Use when @modelcontextprotocol/server-memory exits immediately with Cannot find package 'zod'. Not for knowledge-graph schema errors or for the server starting but tools misbehaving.
Fix memory MCP Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod'
TL;DR
The published package forgot to declare zod as a dependency. Install zod next to it (or wait for a fixed release). The server imports zod at startup, so the missing module kills it before the MCP handshake.
The exact error:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod' imported from .../dist/index.jsSteps
1. Confirm the missing dependency
Run the server by hand:
npx -y @modelcontextprotocol/server-memorySuccess check: it exits immediately with the Cannot find package 'zod' error, and nothing else. That confirms a packaging bug, not your config.
2. Install zod alongside the package
npm install -g zod @modelcontextprotocol/server-memoryor with pnpm:
pnpm add -g zod @modelcontextprotocol/server-memorySuccess check: rerunning the server no longer mentions zod; it waits on stdin for the MCP handshake.
3. Restart the client
Fully restart Claude Desktop / Claude Code / Cursor so the server relaunches with zod resolvable.
Success check: the memory tools (create_entities, read_graph, search_nodes) appear and work.
When this applies
@modelcontextprotocol/server-memory(orserver-sequential-thinking) exits instantly with the zod module-not-found error.- Fresh installs are affected; the published
dependencieslist only@modelcontextprotocol/sdk.
When it does not apply
- The server starts but
read_graphfails withStructured content does not match the tool's output schema: data/entities/0 must NOT have additional properties. That is a schema-validation issue with extra fields in memory.jsonl; strip the non-standard properties from the stored entities. - Tools fail with JSON parsing errors on Windows. Check the server version; that is a different bug.
Tool compatibility
- @modelcontextprotocol/server-memory npm package (affected published versions)
- @modelcontextprotocol/server-sequential-thinking (same bug)
- Node.js 18+, npx / pnpm dlx launchers
- Claude Desktop, Claude Code, Cursor, Continue
Why it happens
The package's bundled dist/index.js contains import { z } from "zod", but zod was never added to the published dependencies in package.json. npm/pnpm only install declared dependencies, so a fresh install has no zod to resolve and Node throws ERRMODULENOT_FOUND at import time, before any MCP code runs.
Edge cases
- If you install with
npx -y(ephemeral cache), the manual zod install can be wiped on cache eviction; a global install of both packages is more durable. - Do not confuse with the sibling startup failure from the mcp 2.0 SDK rename; that one names
McpError, not zod. - Once a release declares zod properly, the manual install becomes unnecessary; check the changelog before scripting it permanently.
Evidence
A modelcontextprotocol/servers issue reports that the published npm packages @modelcontextprotocol/server-memory and @modelcontextprotocol/server-sequential-thinking fail immediately on startup because they import zod but zod is not listed in their published dependencies. Repro: pnpm dlx @modelcontextprotocol/server-memory exits with Error [ERRMODULENOT_FOUND]: Cannot find package 'zod' imported from .../dist/index.js. The published dependencies contain only @modelcontextprotocol/sdk. The fix: install zod alongside the package or wait for a release that declares the dependency. Source: https://github.com/modelcontextprotocol/servers/issues/4330
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_vhfT6jmSTIVNnQ7jigxn1Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">memory MCP: Error [ERR_MODULE_NOT_FOUND] Cannot find package 'zod' <span>— Vectle</span></a>