Fix Windows subprocess NotImplementedError (STDIO clients) #596
+84
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix subprocess creation errors on Windows for STDIO client connections.
This updates
create_windows_process
to properly handle the case where asyncio cannot create subprocess transports on Windows by falling back to using thesubprocess
module manually.Additionally, minor import sorting and style issues have been fixed according to
ruff
linter checks.Motivation and Context
On Windows systems, MCP clients that connect via STDIO were failing with a
NotImplementedError
duringanyio.open_process()
. This is becauseasyncio
on Windows does not implement full support for subprocess transports.This change provides a clean workaround:
subprocess.Popen
withasyncio
wrapping.This allows MCP STDIO clients (e.g., streamlit_client_ui.py) to work successfully on Windows without changing user workflows.
How Has This Been Tested?
streamlit_client_ui.py
to launch the MCP client.ruff
orpyright
issues for the updated file.Breaking Changes
No breaking changes.
Types of changes
Checklist
Additional context
This fix is especially important for making MCP tools and agents accessible on all platforms, including Windows, thereby helping broader adoption.