Skip to content

MCPB bundle crashes on startup due to missing dependencies #201

@polaz

Description

@polaz

Problem

MCPB bundles built with scripts/build-mcpb.sh crash immediately on startup with module resolution errors.

Root Causes

  1. Deleted yaml/dist/doc/ directory - The cleanup script removes all doc directories, but yaml package has actual code in dist/doc/directives.js (not documentation). This causes:

    Error: Cannot find module '../doc/directives.js'
    
  2. Missing zod peer dependency - The --omit=peer flag skips installing zod, which is a required peer dependency of @modelcontextprotocol/sdk. This causes:

    Error: Cannot find module 'zod/v4'
    

Symptoms

  • Server starts, receives MCP initialize request, then crashes
  • Error appears as "Server transport closed unexpectedly"
  • Works fine in local development, only affects MCPB bundles

Fix

Update build-mcpb.sh:

  1. Exclude yaml/dist/doc from cleanup
  2. Replace --omit=peer with --omit=dev to install required peer dependencies
  3. Manually remove optional large packages (prisma CLI, typescript) after install

Testing

  • Verified fix works with Node 20 and Node 24
  • MCPB bundle now starts and responds to MCP requests correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions