Commit bfd10ca
committed
fix: make pywin32 imports soft to support server-only Windows installs
Wrap pywin32 imports in try/except ImportError so that server-only
Windows users are not forced to install pywin32. The package is only
needed for Job Object support in mcp.client.stdio, but the eager
import in mcp/__init__.py pulls it in for all users.
All downstream functions (_create_job_object, _maybe_assign_process_to_job,
terminate_windows_process_tree) already null-check these modules before
use, so graceful degradation is fully covered.
Fixes server-only deployments that fail with pywin32 installation errors
when antivirus software locks extracted DLLs during uv cache cleanup.
Github-Issue: #2233
Reported-by: Nikhil Suresh1 parent 7ba41dc commit bfd10ca
1 file changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
24 | 32 | | |
25 | 33 | | |
26 | 34 | | |
| |||
0 commit comments