claude-code - 💡(How to fix) Fix [BUG] Auto-update orphans MCP child processes on Windows, breaking next launch of npx-based MCP servers (EBUSY)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

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>\[email protected]<id>\dist\azmcp.exe npm error EBUSY: resource busy or locked, copyfile ...

Error Messages/Logs

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\[email protected]\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\[email protected]\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.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 { metadata: { context: 'connection', stack: undefined } }

Root Cause

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>\[email protected]<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.

Fix Action

Fix / Workaround

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.

Code Example

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 }
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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>\[email protected]<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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING