You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Type annotation gaps and unhandled FileNotFoundError in src/mcp/cli/cli.py #3673
While running static analysis (ruff check --select ANN and pyright) on src/mcp/cli/cli.py during local development, I noticed a few missing type annotations and an uncaught exception edge case on Windows.
Description
Unhandled FileNotFoundError in _get_npx_command:
In src/mcp/cli/cli.py, _get_npx_command() attempts to probe for npx executables on Windows inside a try...except subprocess.CalledProcessError: block. If npx.cmd or npx.exe is missing from the system entirely, subprocess.run raises FileNotFoundError before CalledProcessError can be raised, causing an unexpected crash instead of returning None.
Missing Return Type Annotations (ANN202):
_get_npx_command() lacks a return type annotation (returns str | None).
_import_server() lacks a return type annotation.
_check_server_object() lacks a return type annotation (-> bool).
Any Type Usage (ANN401):
_check_server_object() uses server_object: Any, which can be tightened to object since it performs runtime isinstance checks.
Proposed Fix
Update _get_npx_command() to catch (subprocess.CalledProcessError, FileNotFoundError) and return str | None.
Add explicit return type annotations to _import_server and _check_server_object.
Replace server_object: Any with server_object: object.
I would be happy to submit a PR for this if a maintainer is willing to assign the issue to me!
I know that the contributing guidelines for this project forbid direct PRs about formatting and such without assigning, so just putting this out there.
(Note: Disclosing per guidelines that AI tools were used to assist in local testing and analysis; I am ready to own, test, and answer questions on the proposed changes).
I hit this exact FileNotFoundError path while building a Windows Streamable HTTP MCP server for the Amazon Build/Ship/Shape hackathon. I already opened (and the bot closed) PR #3687 with the fix + unit test. Could a maintainer assign #3673 to me (@Sak3th2004) so I can reopen that PR under the linked-issue policy?
Since I authored this issue, did the local analysis, and already have the tested changes staged and pushed on my branch, I’m actively waiting on maintainer triage to get assigned and open the PR per the repo's contributing guidelines.
Activity
Sak3th2004 commentedon Oct 12, 2026
Opened PR #3687 with the Windows
FileNotFoundErrorhandling + annotations from this issue.Sak3th2004 commentedon Oct 12, 2026
Opened #3687 with the Windows FileNotFoundError handling + annotations requested here.
Sak3th2004 commentedon Oct 12, 2026
I hit this exact FileNotFoundError path while building a Windows Streamable HTTP MCP server for the Amazon Build/Ship/Shape hackathon. I already opened (and the bot closed) PR #3687 with the fix + unit test. Could a maintainer assign #3673 to me (@Sak3th2004) so I can reopen that PR under the linked-issue policy?
avk-dwvd commentedon Oct 12, 2026
Hi @Sak3th2004, thanks for sharing your use case!
Since I authored this issue, did the local analysis, and already have the tested changes staged and pushed on my branch, I’m actively waiting on maintainer triage to get assigned and open the PR per the repo's contributing guidelines.