Agent mcp list UV_HANDLE_CLOSING assertion on Windows exit

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

After agent mcp list reports MCP status successfully (e.g. local_sentry: ready), the CLI process crashes on exit with a libuv assertion:

Assertion failed: !(handle->flags & UV_HANDLE_CLOSING), file src\win\async.c, line 76

The MCP status is printed before the crash, so authentication/enable state appear correct; the failure is during process teardown on Windows.

Steps to Reproduce

  1. Windows 10/11, PowerShell
  2. Project with .cursor/mcp.json defining a remote MCP (e.g. GlitchTip at http://localhost:8000/mcp)
  3. agent mcp login local_sentry (OAuth completes successfully)
  4. agent mcp enable local_sentry → “already enabled and approved”
  5. agent mcp list
  6. Observe: local_sentry: ready then assertion / abnormal exit

Expected Behavior

agent mcp list exits with code 0 and no assertion after printing server status.

Operating System

Windows 10/11

Version Information

2026.06.03-0bbb28e

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the detailed report with the stack trace and steps, it really helps.

This is a known bug. The root cause is how the CLI shuts down MCP processes on exit. agent mcp list starts shutting down MCP clients, but the process exits before libuv has time to close the child pipe handles. On Windows, this race shows up as the UV_HANDLE_CLOSING assertion. On macOS and Linux, the same race shows up as a hang for about 20 seconds before returning to the shell.

We’re tracking the issue, and we’re working on the exit logic for this exact race. I can’t share an ETA for the fix yet, but once there’s an update I’ll post it in the thread.

Good news: MCP status is printed correctly (local_sentry: ready), so auth and enable state aren’t affected. Only the teardown is crashing. When a build with the fix is out, please update the CLI and let me know if the assertion is gone.