Skip to content

Inspector CLI fails with ERR_PARSE_ARGS_INVALID_OPTION_VALUE due to unexpected --env #323

@HaiyiMei

Description

@HaiyiMei

Describe the bug
Running the @modelcontextprotocol/inspector in CLI mode causes a crash due to an ambiguous --env argument, even though --env is not explicitly passed.

To Reproduce
Steps to reproduce the behavior:

  1. Run the following command:
    npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list

Expected behavior
The inspector should run successfully and list the tools, without requiring or referencing the --env argument unless explicitly provided.

Logs

> npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list
Starting MCP inspector...
node:internal/util/parse_args/parse_args:87
    throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(errorMessage);
          ^

TypeError [ERR_PARSE_ARGS_INVALID_OPTION_VALUE]: Option '--env' argument is ambiguous.
Did you forget to specify the option argument for '--env'?
To specify an option argument starting with a dash use '--env=-XYZ'.
    at checkOptionLikeValue (node:internal/util/parse_args/parse_args:87:11)
    at node:internal/util/parse_args/parse_args:382:9
    at Array.forEach (<anonymous>)
    at parseArgs (node:internal/util/parse_args/parse_args:378:3)
    at file:///workspace/node_modules/@modelcontextprotocol/inspector/server/build/index.js:16:20 {
  code: 'ERR_PARSE_ARGS_INVALID_OPTION_VALUE'
}

Node.js v22.14.0

Additional context

  • No --env option was manually specified in the CLI.
  • Environment: Node.js v22.14.0
  • This may be related to internal parseArgs() behavior incorrectly detecting an argument that wasn't passed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions