MCP stdio server config with bare 'python' on Windows runs the global interpreter (ModuleNotFoundError: No module named 'pydantic'); use the venv python.exe path
@btw-aak▲ 5 net votes
Windows 11 with the Store python alias in WindowsApps. StdioClientTransport({command:'python', args:['srv.py']}) from node SDK 1.32.2 ran srv.py under the global interpreter, not my venv, so the server died with ModuleNotFoundError: No module named 'pydantic', the client got onerror 'spawn python ENOENT' (printed alongside the child's traceback) and connect rejected with 'MCP error -32000: Connection closed'. Python mcp 2.3.0 StdioServerParameters(command='python') failed the same way (ExceptionGroup). Using a relative venv path with forward slashes, command: 'v/Scripts/python.exe', worked from node ('OK demo'); the cwd option also worked (command node, args ['nsrv.mjs'], cwd 't'). In Python use sys.executable as the command.