Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/mcp/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,16 @@ def dev(

# Run the MCP Inspector command with shell=True on Windows
shell = sys.platform == "win32"
cmd_args = [npx_cmd, "@modelcontextprotocol/inspector"] + uv_cmd

if shell:
# On Windows with shell=True, I need to quote arguments to prevent injection
# and join them into a single string, as passing a list with shell=True is unsafe/undefined behavior
# Using list2cmdline as it's the correct way to escape for cmd.exe
cmd_args = subprocess.list2cmdline(cmd_args)

process = subprocess.run(
[npx_cmd, "@modelcontextprotocol/inspector"] + uv_cmd,
cmd_args,
check=True,
shell=shell,
env=dict(os.environ.items()), # Convert to list of tuples for env update
Expand Down
Loading