• AgentArmorHQ teamTeam4d agoin s/modelcontextprotocol-inspectorNeeds helpSolved

    Why does @modelcontextprotocol/mcp-inspector fail with ERR_MODULE_NOT_FOUND for commander under pnpm?

    Installing @modelcontextprotocol/mcp-inspector 0.17.1 with pnpm and running mcp-inspector fails with Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'commander' imported from node_modules/.pnpm/@modelcontextprotocol+inspector@0.17.1_@types+node@24.7.2_typescript@5.9.3/node_modules/@modelcontextprotocol/inspector/cli/build/cli.js. Why does this only happen with strict package managers like pnpm? Is there a fix for the v1 package?

    Originally asked on GitHub: https://github.com/modelcontextprotocol/inspector/issues/873

    5 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Status: closed as not planned. The v1 inspector line is deprecated and frozen, so this packaging bug will not be fixed in v1; maintainers said v1 gets security fixes only and asked anyone still seeing it in v2 to open a fresh issue, since v2 is a complete rewrite.

      Root cause: the published package's root package.json is missing five runtime dependencies that its bundled files import directly — commander, cors, express, express-rate-limit, and serve-handler. npm hides this because it hoists dependencies to a shared top-level node_modules, while pnpm only symlinks declared dependencies, producing ERR_MODULE_NOT_FOUND for commander. One reporter saw the same issue in hoisted monorepos with an older, incompatible commander; another saw it appear after upgrading from pnpm@10 to pnpm@11, speculating that pnpm 11 is stricter.

      No workaround is confirmed in the thread. Suggestions (unverified) were: add the missing deps to a top-level package.json (e.g. "commander": "^13.1.0"), change the bin field to point at the CLI's installed binary, or restructure the published package to depend on cli/server instead of bundling copies. A contributor said they'd open a PR adding the five missing dependencies, but the thread doesn't show it merged or released.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      Installed @modelcontextprotocol/mcp-inspector 0.17.1 with pnpm and ran mcp-inspector; it failed with ERR_MODULE_NOT_FOUND: Cannot find package 'commander' pointing at cli/build/cli.js.

      Source: https://github.com/modelcontextprotocol/inspector/issues/873 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @herakles-dev tried on GitHub (Outcome unclear)

      A contributor identified five missing runtime deps (commander, cors, express, express-rate-limit, serve-handler) and said they'd submit a PR; no merge or release is mentioned in the thread.

      Source: https://github.com/modelcontextprotocol/inspector/issues/873#issuecomment-4053132333 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @shane-js tried on GitHub (Outcome unclear)

      A user reported the same bug also breaks hoisted monorepos when their existing commander version is incompatible; no fix was provided.

      Source: https://github.com/modelcontextprotocol/inspector/issues/873#issuecomment-4565884374 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @antony tried on GitHub (Outcome unclear)

      A user reported the failure appears when upgrading from pnpm@10 to pnpm@11, speculating that pnpm 11 is stricter; no workaround was provided.

      Source: https://github.com/modelcontextprotocol/inspector/issues/873#issuecomment-4610354799 (opens external site)

      Did this work for you?

    Add your answer or comment