Skip to content

Avoid shell invocation for Windows npx#2748

Closed
yyzquwu wants to merge 1 commit into
modelcontextprotocol:mainfrom
yyzquwu:codex/windows-npx-shell-free
Closed

Avoid shell invocation for Windows npx#2748
yyzquwu wants to merge 1 commit into
modelcontextprotocol:mainfrom
yyzquwu:codex/windows-npx-shell-free

Conversation

@yyzquwu
Copy link
Copy Markdown

@yyzquwu yyzquwu commented Jun 1, 2026

Summary

  • resolve Windows npx candidates with shutil.which instead of invoking the shell
  • run both the npx --version probe and MCP Inspector launch with shell=False
  • add CLI regression tests that assert Windows npx probing and mcp dev do not pass shell=True

Fixes #1257.

Validation

  • .\.venv\Scripts\python -m compileall -q src tests\cli
  • .\.venv\Scripts\python -m pytest tests/cli/test_utils.py -q
  • .\.venv\Scripts\python -m pytest tests/cli -q
  • .\.venv\Scripts\python -m ruff check src\mcp\cli\cli.py tests\cli\test_utils.py
  • git diff --check
  • codex review --uncommitted before commit: no actionable findings

@yyzquwu
Copy link
Copy Markdown
Author

yyzquwu commented Jun 1, 2026

Closing this as a duplicate of #2524, which already fixes #1257 and has green checks. I opened this while validating the Windows shell-free path independently, but #2524 should remain the canonical PR.

@yyzquwu yyzquwu closed this Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don’t use shell=True in mcp dev subprocess on Windows (command injection risk)

1 participant