Skip to content

Phantom dependencies in @modelcontextprotocol/inspector #873

Closed as not planned

Description

@nick-pape

Inspector Version

  • 0.17.1

Describe the bug
When using a stricter package installer, such as pnpm, all dependencies that are directly imported by a package must be in their package.json. Packages which are not listed, but are imported are called "phantom dependencies". These work with npm because it hoists everything to the top level of node_modules, but with strict package managers like pnpm, we only get symlinks for things that are actually declared.

There's probably a couple of these, but right off the bat, I get an error:

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

Fix:

Option 1)

Add commander (and all dependencies used by repo) to top-level package.json

"commander": "^13.1.0"

Option 2)

Alternately, consider publishing @modelcontextprotocol/mcp-inspector from a different package, that takes dependencies on cli, server, etc. Rather than publishing copies of their code in this package (and also taking dependencies on them).

Option 3)

I think the actual root of the issue is the bin:

"bin": {
  "mcp-inspector": "cli/build/cli.js"
},

This reaches into the cli folder, when it probably should instead utilize the bin that gets installed as part of the cli. e.g. something like:

"bin": {
  "mcp-inspector": "node_modules/bin/mcp-inspector-cli"
},

To Reproduce
Steps to reproduce the behavior:

  1. pnpm install @modelcontextprotocol/mcp-inspector
  2. mcp-inspector

Expected behavior
mcp-inspector should resolve all dependencies.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]

Additional context
Add any other context about the problem here.

Activity

  1. added
    bug
    dependencies
    on Oct 26, 2025
  2. herakles-dev commented on Mar 13, 2026

    @herakles-dev

    I'd like to take this. The root package.json is missing 5 runtime dependencies that are directly imported by bundled workspace files (cli/build, server/build, client/bin): commander, cors, express, express-rate-limit, and serve-handler. Will have a PR up shortly.

  3. added a commit that references this issue on Mar 13, 2026
    f6434fd
  4. shane-js commented on May 28, 2026

    @shane-js

    Hi team - just wanted to add this also causes issues in hoisted monorepos with other older commander dependencies that are incompatible.

  5. antony commented on Jun 3, 2026

    @antony

    This breaks if you upgrade from pnpm@10 to pnpm@11 as I believe that things have been made stricter..

  6. HunterLarco commented on Jul 13, 2026

    @HunterLarco

    +1 I'd like to make the case that this should be prioritized higher than P2 as it fundamentally breaks the inspector for all pnpm projects which as of 2024 accounted for 35% of usage (see survey). Is there a timeline for V1 release or to include a fix for this as a patch in V0?

  7. betsy commented on Jul 13, 2026

    @betsy

    +1 would be great if this can be looked at soon

  8. added a commit that references this issue on Jul 18, 2026
    1681a0d
  9. added
    closed-v1-deprecated
    on Aug 1, 2026
  10. cliffhall commented on Aug 1, 2026

    @cliffhall
    Member

    Closing: v1 is deprecated.

    Thank you for reporting this, and apologies for the long wait for a response.

    v1 will receive security fixes only — this issue describes a functionality, compatibility, or usability problem rather than a vulnerability, so it is being closed against v1. This is not a judgment on whether the problem is real — it's a consequence of the v1 line being frozen. This is happening as part of #1872.

    If this still happens in v2, we'd genuinely like to know. v2 is a complete rewrite — three clients over a shared core — so many v1 behaviours no longer exist in the same form. Please open a fresh issue against v2 with steps to reproduce, and we'll look at it. Note that we accept external contributions as issues rather than pull requests; maintainers handle design and implementation through a prompt-driven workflow. See CONTRIBUTING.md.

    Thanks for taking the time to report it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugclosed-v1-deprecateddependenciesv1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions