Skip to content

Missing zod dependency in generated MCP server template

Issue Description

The generated MCP server template is missing the zod dependency, even though it's required for the schema validation patterns used in the project.

Current State

The generated package.json includes:

{
  "dependencies": {
    "@modelcontextprotocol/sdk": "1.0.1",
    "dotenv": "^17.2.1", 
    "zod-to-json-schema": "^3.23.5"
  }
}

Problem

The template includes zod-to-json-schema but not zod itself, which is required because:

  1. The generated code uses Zod schemas for validation (e.g., in src/schemas.ts)
  2. zod-to-json-schema depends on zod but it's a peer dependency
  3. This causes runtime errors when trying to use Zod validation

Expected State

The package.json should include:

{
  "dependencies": {
    "@modelcontextprotocol/sdk": "1.0.1",
    "dotenv": "^17.2.1",
    "zod": "^3.23.8",
    "zod-to-json-schema": "^3.23.5"
  }
}

Impact

  • Generated projects fail to build/run without manual dependency addition
  • New developers encounter immediate setup issues
  • Template doesn't work out of the box as intended

Reproduction Steps

  1. Use the create-mcp-server template to generate a new project
  2. Try to build or run the project
  3. Observe Zod-related import/runtime errors

Suggested Fix

Add "zod": "^3.23.8" to the dependencies in the template's package.json.

Environment