Skip to content

Feature Request: Allow custom or dynamic port selection when default port (6277) is in use #531

Open
@gulbaki

Description

@gulbaki

Is your feature request related to a problem? Please describe.
When running @modelcontextprotocol/inspector via:
npx @modelcontextprotocol/inspector node ./build/index.js
I receive this error if port 6277 is already in use:
❌ Proxy Server PORT IS IN USE at port 6277 ❌
This makes it impossible to run the inspector if another process is occupying that port. Currently, there’s no way to override the port or recover automatically.

Describe the solution you'd like
I would like two improvements:
Custom port option: Allow passing a --port argument to manually set the port:
npx @modelcontextprotocol/inspector node ./build/index.js --port 6280
Dynamic fallback option: If the default port (6277) is in use, automatically try the next available port (e.g., 6278, 6279...) and inform the user like:

Port 6277 is in use. Falling back to port 6278 ✅
This combination would ensure better DX (developer experience), especially in environments with unpredictable port usage (e.g., during testing or in CI environments).

Describe alternatives you've considered
Manually killing the process using 6277 each time (slow and not reliable)


I’m willing to contribute
If this feature request is accepted, I’d be happy to work on a PR to implement it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions