Zod version mismatch type errors with @modelcontextprotocol/typescript-sdk
While building MCP tools with @modelcontextprotocol/typescript-sdk, my own zod dependency (3.23.8) collides with the SDK's internal zod (3.25.76). Passing a z.string() input schema to server.registerTool fails with 'Type ZodString is missing properties "~standard", "~validate"'. Is there an official way to resolve this version compatibility problem?
Originally asked on GitHub: https://github.com/modelcontextprotocol/typescript-sdk/issues/802
5 answers
Status: the issue is closed as completed and the maintainers shipped beta 1.23.0-beta.0 (2025-11-21) adding backwards compatible zod v4 support; the thread does not confirm that this beta removes the specific v3 version-mismatch error below, so try it and verify your schemas still type-check.
The reported problem: the SDK bundles its own zod (3.25.76 in the report), so a consumer's separate zod install (3.23.8) is a different nominal type. Passing z.string() to server.registerTool then fails with: Type 'ZodString' is missing properties '~standard', '~validate'.
The issue body proposed two options, and commenters agreed, but neither is shown as implemented in the thread:
- Re-export zod from the SDK index ('export { z } from 'zod''), letting consumers write 'import { z } from '@modelcontextprotocol/sdk'' so everyone shares the SDK's exact zod instance.
- Move zod to peerDependencies so consumers install one compatible version.
One user said they tried zod 4 and found it incompatible before the beta; another asked for the peerDependency handling because the internal dependency was confusing. The maintainers' concrete action was the beta release with zod v4 support plus a request for feedback.
General advice (not stated in the thread): on the stable SDK line, pin your zod to the exact version the SDK bundles or add a package-manager override so only one zod copy is installed. If you want the beta path, install 1.23.0-beta.0 and confirm your input schemas type-check.
Did this work for you?What @felixweinberger tried on GitHub (Outcome unclear)
A maintainer shipped 1.23.0-beta.0 with backwards compatible zod v4 support and asked users to try it and give feedback. The thread does not confirm whether it resolves the v3 version-mismatch error.
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Imported zod 3.23.8 in the consumer project while the SDK used zod 3.25.76 and passed z.string() as the input schema to server.registerTool, producing the 'Type ZodString is missing properties ~standard, ~validate' type error.
Source: https://github.com/modelcontextprotocol/typescript-sdk/issues/802 (opens external site)
Did this work for you?What @fa-lesley tried on GitHub (Didn't work)
Tried using zod 4 in the project. At the time it was not compatible with the SDK's zod dependency.
Did this work for you?What @MikePresman tried on GitHub (Outcome unclear)
Requested that the SDK handle zod as a peer dependency because the internal zod dependency was confusing. No implementation of this was shown in the thread.
Did this work for you?
Related questions
- MCP TypeScript SDK StreamableHttp without sticky sessions in multi-replica deployments?
- MCP stdio server: SyntaxError Unexpected token in deserializeMessage when using console.log
- MCP typescript-sdk: tool inputSchema/outputSchema reject JSON Schema type 'array'?
- Use Zod union/intersection as MCP tool paramsSchema in typescript-sdk?
- MCP Inspector: "Invalid transport type: undefined" when connecting to an SSE server