Skip to content
Closed
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
9 changes: 5 additions & 4 deletions src/mcp/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _get_npx_command():
# Try both npx.cmd and npx.exe on Windows
for cmd in ["npx.cmd", "npx.exe", "npx"]:
try:
subprocess.run([cmd, "--version"], check=True, capture_output=True, shell=True)
subprocess.run([cmd, "--version"], check=True, capture_output=True)
return cmd
except subprocess.CalledProcessError:
continue
Expand Down Expand Up @@ -271,12 +271,13 @@ def dev(
)
sys.exit(1)

# Run the MCP Inspector command with shell=True on Windows
shell = sys.platform == "win32"
# Pass an argv list directly to the process. Using cmd.exe on Windows
# makes every argument part of a shell command and can reinterpret
# repository/file-controlled values.
process = subprocess.run(
[npx_cmd, "@modelcontextprotocol/inspector"] + uv_cmd,
check=True,
shell=shell,
shell=False,
env=dict(os.environ.items()), # Copy the environment for subprocess launch
)
sys.exit(process.returncode)
Expand Down
Loading