[BUG] Auto-update orphans MCP child processes on Windows, breaking next launch of npx-based MCP servers (EBUSY)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment: Claude Code on Windows 11 (PowerShell), Opus 4.7. Azure MCP server configured via npx -y @azure/mcp@latest.
What happened: Claude Code auto-updated and restarted itself. After restart, the azure MCP server failed to connect. Log showed initialize request sent, then:
npm error code EBUSY
npm error syscall copyfile
npm error path ...\npm-cache\_npx\<hash>\node_modules\@azure\mcp-win32-x64\dist\azmcp.exe
npm error dest ...\npm-cache\_npx\<hash>\node_modules\@azure\.mcp-win32-x64-<id>\dist\azmcp.exe
npm error EBUSY: resource busy or locked, copyfile ...
[azure] Server transport closed unexpectedly
Root cause: Three orphaned azmcp.exe processes from pre-update sessions were still running (confirmed via Get-Process azmcp). npx couldn't hard-link/copy the binary into its new staging dir because Windows held a lock on the in-use exe.
Workaround: Stop-Process -Name azmcp -Force then remove the .mcp-win32-x64-* staging dirs under %LOCALAPPDATA%\npm-cache\_npx\<hash>\node_modules\@azure\, then reconnect the MCP server.
What Should Happen?
On auto-update restart, Claude Code reaps its spawned MCP server child processes (SIGTERM/CloseHandle + wait, then force-kill) before exiting the old instance.
Error Messages/Logs
2026-05-26T07:56:40.587Z [azure] [info] Server started and connected successfully { metadata: undefined }
2026-05-26T07:56:41.267Z [azure] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0} { metadata: undefined }
npm error code EBUSY
npm error syscall copyfile
npm error path C:\Users\xxx\AppData\Local\npm-cache\_npx\541454632b79112e\node_modules\@azure\mcp-win32-x64\dist\azmcp.exe
npm error dest C:\Users\xxx\AppData\Local\npm-cache\_npx\541454632b79112e\node_modules\@azure\.mcp-win32-x64-GFm00aXd\dist\azmcp.exe
npm error errno -4082
npm error EBUSY: resource busy or locked, copyfile 'C:\Users\xxx\AppData\Local\npm-cache\_npx\541454632b79112e\node_modules\@azure\mcp-win32-x64\dist\azmcp.exe' -> 'C:\Users\xxx\AppData\Local\npm-cache\_npx\541454632b79112e\node_modules\@azure\.mcp-win32-x64-GFm00aXd\dist\azmcp.exe'
npm error A complete log of this run can be found in: C:\Users\xxx\AppData\Local\npm-cache\_logs\2026-05-26T07_56_43_665Z-debug-0.log
2026-05-26T07:56:59.845Z [azure] [info] Server transport closed { metadata: undefined }
2026-05-26T07:56:59.846Z [azure] [info] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. `console.error('...')` in JavaScript, `print('...', file=sys.stderr)` in python) and it will appear in this log. { metadata: undefined }
2026-05-26T07:56:59.846Z [azure] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) { metadata: { context: 'connection', stack: undefined } }
2026-05-26T07:56:59.848Z [azure] [info] Client transport closed { metadata: undefined }
2026-05-26T07:56:59.848Z [azure] [info] Client transport closed { metadata: undefined }
Steps to Reproduce
Update Claude Desktop
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
1.8555.1
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗