Repository navigation
Description
the python server:
[01/29/26 00:27:10] INFO Starting MCP server 'mcp-for-unity-server' with transport 'http' on server.py:2618
http://localhost:8080/mcp
INFO: Started server process [47480]
INFO: Waiting for application startup.
2026-01-29 00:27:10,235 - docket.worker - INFO - Starting worker 'mylove#47480' with the following tasks:
2026-01-29 00:27:10,235 - docket.worker - INFO - * trace(message: str, ...)
2026-01-29 00:27:10,235 - docket.worker - INFO - * fail(message: str, ...)
2026-01-29 00:27:10,235 - docket.worker - INFO - * sleep(seconds: float, ...)
2026-01-29 00:27:10,236 - mcp.server.streamable_http_manager - INFO - StreamableHTTP session manager started
INFO: Application startup complete.
INFO: Uvicorn running on http://localhost:8080 (Press CTRL+C to quit)
INFO: ('::1', 60557) - "WebSocket /hub/plugin" [accepted]
INFO: connection open
2026-01-29 00:27:20,308 - mcp.server.streamable_http_manager - INFO - Created new transport with session ID: 4cefe6618a6d4f468265163a4df0d52f
INFO: ::1:60562 - "POST /mcp HTTP/1.1" 200 OK
INFO: ::1:60562 - "POST /mcp HTTP/1.1" 202 Accepted
INFO: ::1:60562 - "GET /mcp HTTP/1.1" 200 OK
2026-01-29 00:27:20,319 - asyncio - ERROR - Task exception was never retrieved
future: <Task finished name='Task-38' coro=<IocpProactor.accept..accept_coro() done, defined at C:\Users\18794\AppData\Roaming\uv\python\cpython-3.13.11-windows-x86_64-none\Lib\asyncio\windows_events.py:564> exception=OSError(22, 'The specified network name is no longer available.', None, 64, None)>
Traceback (most recent call last):
File "C:\Users\18794\AppData\Roaming\uv\python\cpython-3.13.11-windows-x86_64-none\Lib\asyncio\windows_events.py", line 567, in accept_coro
await future
File "C:\Users\18794\AppData\Roaming\uv\python\cpython-3.13.11-windows-x86_64-none\Lib\asyncio\windows_events.py", line 804, in _poll
value = callback(transferred, key, ov)
File "C:\Users\18794\AppData\Roaming\uv\python\cpython-3.13.11-windows-x86_64-none\Lib\asyncio\windows_events.py", line 556, in finish_accept
ov.getresult()
~~~~~~~~~~~~^^
OSError: [WinError 64] The specified network name is no longer available.
2026-01-29 00:27:20,321 - asyncio - ERROR - Accept failed on a socket
socket: <asyncio.TransportSocket fd=960, family=2, type=1, proto=0, laddr=('127.0.0.1', 8080)>
Traceback (most recent call last):
File "C:\Users\18794\AppData\Roaming\uv\python\cpython-3.13.11-windows-x86_64-none\Lib\asyncio\proactor_events.py", line 845, in loop
conn, addr = f.result()
~~~~~~~~^^
OSError: [WinError 64] The specified network name is no longer available.
INFO: ::1:60564 - "POST /mcp HTTP/1.1" 200 OK
INFO: ::1:60566 - "POST /mcp HTTP/1.1" 200 OK
the Unity Console:
<color=#2EA3FF>MCP-FOR-UNITY: [WebSocket] Registered with session ID: 61d3bedc-964c-4336-8955-49fadb0a14e8
UnityEngine.Debug:Log (object)
MCPForUnity.Editor.Helpers.McpLog:Info (string,bool) (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Helpers/McpLog.cs:40)
MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient/d__41:MoveNext () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs:422)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start<MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient/d__41> (MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient/d__41&)
MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient:HandleRegisteredAsync (Newtonsoft.Json.Linq.JObject,System.Threading.CancellationToken)
MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient/d__39:MoveNext () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs:382)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start<MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient/d__39> (MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient/d__39&)
MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient:HandleMessageAsync (string,System.Threading.CancellationToken)
MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient/d__37:MoveNext () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs:293)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult (string)
MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient/d__38:MoveNext () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs:359)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()
<color=#2EA3FF>MCP-FOR-UNITY: [WebSocket] Preparing to register 19 tool(s) with the bridge.
UnityEngine.Debug:Log (object)
MCPForUnity.Editor.Helpers.McpLog:Info (string,bool) (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Helpers/McpLog.cs:40)
MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient/d__42:MoveNext () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs:435)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()
<color=#2EA3FF>MCP-FOR-UNITY: [WebSocket] Sent 19 tools registration
UnityEngine.Debug:Log (object)
MCPForUnity.Editor.Helpers.McpLog:Info (string,bool) (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Helpers/McpLog.cs:40)
MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient/d__42:MoveNext () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs:475)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetResult ()
MCPForUnity.Editor.Services.Transport.Transports.WebSocketTransportClient/d__47:MoveNext () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs:619)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()
<color=#6AA84F>MCP-FOR-UNITY: Connection verification successful: Transport 'websocket' connected [ws://localhost:8080/hub/plugin]
UnityEngine.Debug:Log (object)
MCPForUnity.Editor.Helpers.McpLog:Debug (string) (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Helpers/McpLog.cs:34)
MCPForUnity.Editor.Windows.Components.Connection.McpConnectionSection/d__54:MoveNext () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs:780)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<MCPForUnity.Editor.Services.BridgeVerificationResult>:SetResult (MCPForUnity.Editor.Services.BridgeVerificationResult) MCPForUnity.Editor.Services.BridgeControlService/<VerifyAsync>d__15:MoveNext () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Services/BridgeControlService.cs:136) System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:SetResult (bool)
MCPForUnity.Editor.Services.Transport.TransportManager/d__16:MoveNext () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Services/Transport/TransportManager.cs:120)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()
<color=#2EA3FF>MCP-FOR-UNITY: Server no longer running; ending orphaned session.
UnityEngine.Debug:Log (object)
MCPForUnity.Editor.Helpers.McpLog:Info (string,bool) (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Helpers/McpLog.cs:40)
MCPForUnity.Editor.Windows.Components.Connection.McpConnectionSection:UpdateConnectionStatus () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Windows/Components/Connection/McpConnectionSection.cs:299)
MCPForUnity.Editor.Windows.MCPForUnityEditorWindow:OnEditorUpdate () (at D:/GitObjectsOwn/unity-mcp/unity-mcp/MCPForUnity/Editor/Windows/MCPForUnityEditorWindow.cs:373)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
Activity
[-]beta: when Claude Code reconnects, Unity session becomes "no session" even though handshake succeeds. This breaks the workflow completely. Logs attached. But Sometimes it works,and the bug just in beta[/-][+]beta branch: when Claude Code reconnects, Unity session becomes "no session" even though handshake succeeds. This breaks the workflow completely. Logs attached. But Sometimes it works,and the bug just in beta[/+][-]beta branch: when Claude Code reconnects, Unity session becomes "no session" even though handshake succeeds. This breaks the workflow completely. Logs attached. But Sometimes it works,and the bug just in beta[/-][+]beta branch: when Claude Code reconnects, Unity session becomes "no session" even though handshake succeeds. This breaks the workflow completely. Logs attached. But Sometimes it works,and the bug only occurs in beta by using http to connect[/+]dsarno commentedon Jan 29, 2026
I just pushed a new beta -- can you let me know if it works better for this? Claude Code has been working fine for me and I've been using the new branch for several days. You just have to make sure you press the "register/unregister" button for claude, and possibly exit claude to get the new configuration activated.
Should also have the improved parameter robustness you were talking about. Thanks!
whatevertogo commentedon Jan 29, 2026
Thank you for your work. After testing, I found two distinct issues:
When Claude Code reconnects to a healthy/running MCP server, it still triggers the "no session" error in the Unity bridge (stdio works normally).
More specifically: repeatedly restarting the MCP server (which appears to be the necessary trigger condition) combined with multiple Claude Code reconnections causes Unity to freeze. Strangely, it occasionally works fine, which is confusing.
This issue only exists in the beta version, not in the stable release.
I'm currently busy with Global Game Jam, but I'll investigate further and provide you with more details once the jam is finished.
Also, I noticed the tool calls are significantly faster. This refactoring was really effective!
Fix ping/pong heartbeat, reduce timeout to 20s, fix test flakiness
Fix WebSocket connection reliability and domain reload recovery (#656)
dsarno commentedon Jan 31, 2026
Should be fixed in #656, which is now in beta -- part of upcoming release to main project.
dsarno commentedon Jan 31, 2026
Thanks for flagging this @whatevertogo !
dsarno commentedon Jan 31, 2026
@whatevertogo also, if you're interested, here's the bug investigation "report / plan" I used with claude code to track this down. It has the "history" and "hypotheses" we started with. It took a while and a lot of experimenting. But it was useful to have the document to keep me and claude going in the right direction.
Investigation: Issue #654 #643 - Dispatcher Becomes Unreachable After Test Failures
🔴 CURRENT STATUS (2026-01-30)
The Problem
After running a full test suite (564 tests), the dispatcher becomes unreachable ("No Unity Editor instances found"), but telemetry falsely reports success.
Root Cause: Unity Domain Reload + Short Reconnection Timeout
Proposed Fix (IMPLEMENTED BUT NOT TESTED)
Increased reconnection timeouts from 2s to 30s in:
Server/src/transport/plugin_hub.py:427-UNITY_MCP_SESSION_RESOLVE_MAX_WAIT_SServer/src/transport/legacy/unity_connection.py:771-UNITY_MCP_RELOAD_MAX_WAIT_SServer/src/transport/legacy/unity_connection.py:421- Backoff cap when reloadingNext Steps
Open Questions
Background: How We Got Here
Initial Hypothesis (WRONG)
"PropertyConversion exceptions are crashing the dispatcher"
Investigation Findings (CORRECT)
The Real Issue (CONFIRMED)
Evidence
Test Results When Full Suite Runs
Failures recorded in test run:
Dispatcher Status After Full Suite
When Same Tests Run Individually
Clear Pattern
Architectural Understanding
How Test Results Flow (Normal Operation)
How Test Results Flow (When Test Failures Occur)
TestJobManager.FailuresSoFarTestJobStatus.FailedWhat We Know About Dispatcher Crash
The Mystery: What Actually Breaks?
Three Possibilities
Instance Registry Corruption
WebSocket/Stdio Connection Loss
Dispatcher Command Queue Corruption
Known Code Paths
Test Failure Reporting (C#)
MCPForUnity/Editor/Services/TestJobManager.csFinalizeCurrentJobFromRunFinished()(lines 357-378)OnLeafTestFinished()(lines 425-454)ToSerializable()(lines 519-557)Test Result Polling (Python)
Server/src/services/tools/run_tests.pyget_test_job()(lines 218-317)Instance Registry (Python)
Server/src/transport/plugin_registry.pyServer/src/transport/plugin_hub.py(on_disconnect hook at lines 107-137)Telemetry False Positive (Python)
Server/src/services/tools/manage_editor.py(lines 39-44)Questions to Answer
Immediate
When test failures are reported, what happens to the instance registry?
Does the test failure message/payload corrupt something?
Why do individual tests not trigger this?
Secondary
Is the issue in the test framework → dispatcher communication?
Could this be a timing/race condition?
Test Files for Reproduction
Created Test Files
Assets/Tests/EditMode/Tools/PropertyConversion_IntegerForObjectRef_Test.cs- Safe aloneAssets/Tests/EditMode/Tools/PropertyConversion_ArrayForFloat_Test.cs- Safe aloneAssets/Tests/EditMode/Tools/PropertyConversion_DirectAPI_Test.cs- Safe aloneAssets/Tests/EditMode/Tools/PropertyConversionErrorHandlingTests.cs- Safe alone (8 tests)Reproduction Steps
Investigation Plan (Data-Driven Approach)
Phase 1: Strategic Instrumentation
Goal: Add logging to determine which mechanism is breaking
Step 1.1: Instance Registry State Tracking
Server/src/transport/plugin_registry.pyandServer/src/transport/plugin_hub.pyon_disconnect()with timestamps and reasonsStep 1.2: Connection State Tracking
MCPForUnity/Editor/Services/Transport/WebSocketTransportClient.csStep 1.3: Dispatcher Command Queue Tracking
MCPForUnity/Editor/Services/Transport/TransportCommandDispatcher.csPhase 2: Test Run and Data Collection
Goal: Trigger the bug and capture logs from all three instrumentation points
Phase 3: Root Cause Analysis
Goal: Use collected data to definitively identify which mechanism broke
Expected outcomes (one will be true):
on_disconnect()called unexpectedly, instance count drops to 0Phase 4: Fix Implementation
Once we know what breaks: Fix it appropriately for that mechanism
Progress Log
2026-01-30 - Investigation Started
Decision Made: Use data-driven approach
Findings: ROOT CAUSE IDENTIFIED ✅
The Real Issue: Unity Domain Reload After Tests
This is NOT about test failures crashing the dispatcher. It's about Unity domain reload after test completion.
What Actually Happens:
Evidence from Logs:
Why Our Debug Logging Didn't Fire:
[Issue #654 DEBUG]entries appeared in Python logsunity_connection.py) is in useplugin_hub.py(WebSocket), not the legacy transportThe Bug:
Reconnection Logic Analysis
Current State: Two Different Systems
1. WebSocket/PluginHub (Python side) -
plugin_hub.py:412_resolve_session_id()waits only 2 seconds for Unity to reconnectUNITY_MCP_SESSION_RESOLVE_MAX_WAIT_S(default 2.0, max 30)2. WebSocket (C# side) -
WebSocketTransportClient.cs:27ReconnectSchedule: 0s, 1s, 3s, 5s, 10s, 30s (6 attempts, ~49s total)3. Legacy Stdio (Python → Unity) -
unity_connection.py:236Problems Identified
plugin_hub.py:426stdio_port_registry.pyunity_connection.py:253unity_connection.py:371Recommendations
Option A: Increase timeouts (quick fix)
UNITY_MCP_SESSION_RESOLVE_MAX_WAIT_Sdefault from 2s to 30sOption B: Unify reconnection logic (better long-term)
ReconnectionStrategyclassOption C: Preserve connection across domain reload
Fix Implemented (Option 1)
Changes made:
plugin_hub.py:425- Increased default wait from 2s to 30sUNITY_MCP_SESSION_RESOLVE_MAX_WAIT_Sdefault: 2.0 → 30.0unity_connection.py:421- Increased backoff cap when reloadingstatus.get('reloading'): 0.8s → 5.0sunity_connection.py:771- Increased reload wait from 2s to 30sUNITY_MCP_RELOAD_MAX_WAIT_Sdefault: 2.0 → 30.0Debug logging still in place (remove after verification):
plugin_hub.py- disconnect loggingunity_connection.py- (none added here)WebSocketTransportClient.cs- HandleSocketClosureAsync stack traceWebSocketTransportClient.cs- SendJsonAsync payload sizeGetTestJob.cs- job status loggingTo test: Restart MCP server, run full test suite, verify dispatcher stays reachable after tests complete.
Follow-up TODO: Unify reconnection logic across WebSocket and Stdio transports (Option 2)
Fix Reverted - Back to Data-Driven Investigation
Premature fix was reverted. The diagnosis was based on code inspection without evidence. We need to actually observe what's happening before fixing.
Logging Added for Investigation
C# Side:
WebSocketTransportClient.cs-HandleSocketClosureAsync()(line 638):WebSocketTransportClient.cs-SendJsonAsync()(line 611):GetTestJob.cs-HandleCommand():Python Side:
plugin_hub.py-on_disconnect()(line 107):plugin_hub.py-_handle_command_result()(line 362):What to Watch For During Test
In Unity Console:
[Issue #654 DEBUG] GetTestJob:- Shows test progress and failure counts[Issue #654 DEBUG] SendJsonAsync:- Shows payload sizes being sentHandleSocketClosureAsync called- Shows stack trace when disconnect happensIn Python Logs:
[Issue #654 DEBUG] Received command_result:- Shows what's being received[Issue #654 DEBUG] Large result payload:- Flags if payload is >10KB[Issue #654 DEBUG] on_disconnect called- Shows close code and meaning[Issue #654 DEBUG] Cancelling X pending commands- Shows in-flight work[Issue #654 DEBUG] Unregistering session- Confirms instance removalHow to Reproduce
run_teststhenget_test_jobwithwait_timeout=300Findings: Code Path Analysis
Test Failure Flow (C# → Python):
TestJobManager.FinalizeCurrentJobFromRunFinished()(line 357) - marks job as FailedPersistToSessionState(force: true)(line 377) - saves to EditorPrefs (local only)get_test_job()(run_tests.py:218) - polls Unity with "get_test_job" commandKey Discovery - Instance Unregistration Mechanism:
Server/src/transport/plugin_hub.py(lines 107-136)on_disconnect()is called_registry.unregister(session_id)(line 134)Critical Finding - Deserialization Vulnerability:
Server/src/transport/plugin_hub.py(lines 93-105)CommandResultMessage(**data)fails, the exception is logged but the future is never resolvedget_test_job()callsGetTestJobResponse(**response)at line 268ValidationError→ Could propagate up and crash handlerHypothesis: Large/complex test failure payloads with deeply nested data cause deserialization to fail, which either:
Test Result Serialization (C#):
job.Resultis set to TestRunResult (line 373)progress.failures_so_farwhich are simple objects with string fieldsNext Actions (Priority Order):
Add logging to identify when WebSocket disconnects
plugin_hub.pyline 87-105 (on_receive) and line 107-136 (on_disconnect)Reproduce with minimal full test suite
Check for implicit disconnection
Hypothesis Tracker
Summary for Next Investigator
Start here: The dispatcher becomes unreachable specifically when test suites report failures related to unhandled error logs.
The key is to trace: What happens to the instance registry, WebSocket connection, or dispatcher command queue when test failures are reported?
Don't fix: The tests themselves (don't suppress the error logs). Instead, fix why test failure reporting breaks the dispatcher.
Remember: Telemetry false positive is a symptom, not the root cause. The real bug is that test failure reporting somehow corrupts dispatcher state.
Investigation Started: 2026-01-30
Last Updated: 2026-01-30
Status: ✅ ROOT CAUSE FOUND AND FIXED (with additional hardening)
✅ FINAL FIX (2026-01-30)
Two Issues Found and Fixed
Issue 1: Dispatcher Dies After Test Suite (Original Issue #654)
Root Cause: Unity domain reload after tests complete drops the MCP connection. The reconnection timeout (2s) was too short for domain reloads (10-30s).
Fix: Increased timeouts to handle domain reloads:
unity_connection.py:421unity_connection.py:771UNITY_MCP_RELOAD_MAX_WAIT_S: 2.0s → 30.0splugin_hub.py:427UNITY_MCP_SESSION_RESOLVE_MAX_WAIT_S: 2.0s → 30.0sIssue 2: All Commands Slow (Regression from Issue 1 Fix)
Root Cause: The middleware (
unity_instance_middleware.py) calledPluginHub._resolve_session_id()on EVERY command regardless of transport mode. For stdio transport, PluginHub would wait the full timeout (now 30s) for a WebSocket session that would never exist, then fall back to stdio.Evidence from logs:
Fix: Skip PluginHub for stdio transport:
unity_instance_middleware.py:191_is_http_transport()checkValidation Status
Files Changed
Server/src/transport/legacy/unity_connection.pyUNITY_MCP_RELOAD_MAX_WAIT_Sdefault 2.0s → 30.0sServer/src/transport/plugin_hub.pyUNITY_MCP_SESSION_RESOLVE_MAX_WAIT_Sdefault 2.0s → 30.0sServer/src/transport/unity_instance_middleware.py_is_http_transport()check before calling PluginHubServer/src/transport/unity_transport.pyMCPForUnity/Editor/Services/Transport/TransportCommandDispatcher.csMCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.csAdditional Hardening: Server-Side Ping Loop (2026-01-30)
Problem Discovered
During testing, we observed that WebSocket connections could die silently on Windows (OSError 64: "The specified network name is no longer available"). When this happens:
Root Cause
The existing keep-alive mechanism was one-directional:
Solution: Server-Initiated Ping Loop
Added active connection health monitoring from the Python server side:
New Constants in
plugin_hub.py:PING_INTERVAL = 10- Send ping every 10 secondsPING_TIMEOUT = 20- Consider connection dead if no pong within 20 secondsNew Mechanism:
{"type": "ping"}message to Unity{"type": "pong", "session_id": "..."}(was missing session_id before)Files Changed:
Server/src/transport/models.py- AddedPingMessageclassServer/src/transport/plugin_hub.py:PING_INTERVAL,PING_TIMEOUTconstants_last_pong,_ping_tasksclass variables_ping_loop()coroutine_handle_register()to start ping loop_handle_pong()to record last pong timeon_disconnect()to stop ping task and cleanupMCPForUnity/Editor/Services/Transport/Transports/WebSocketTransportClient.cs:SendPongAsync()to includesession_idin pong messagesBenefits
Testing Status
dsarno commentedon Jan 31, 2026
@whatevertogo can you let me know if this is fixed for you on latest main branch? Version 9.3.0?
whatevertogo commentedon Feb 2, 2026
Sorry for the late.Yes, this issue has been successfully resolved in version 9.3.0.
dsarno commentedon Feb 2, 2026
Excellent!
whatevertogo commentedon Feb 2, 2026
@dsarno it seems my previous messages misled you,i found the bug still exist and i finally find the bug where it is,why only a few person has the bug.
This is why
The Real Root Cause: Not Unity Reconnect, But Python Asyncio Design Flaw
Executive Summary
The problem is NOT Unity reconnecting. Unity's WebSocket connection stays stable.
The real problem is Claude Code reconnecting, which triggers a Python asyncio ProactorEventLoop bug on Windows.
What Actually Happens
Unity Behavior (Stable ✅)
Unity does NOT reconnect. Unity stays connected the whole time.
Claude Code Behavior (Unstable⚠️ )
Claude Code DOES reconnect. Every time you run
/mcpor interact with Claude Code.The Real Problem: Python Asyncio Architecture
Architecture Issue
The Bug: IOCP State Management
ProactorEventLoop has a single event loop managing:
When Claude Code reconnects:
Why Unity Appears to "Disconnect"
Unity's Detection Logic (Faulty Assumption)
The Misunderstanding
The Real Root Cause
It's Not: Connection Stability
❌ NOT Unity's WebSocket implementation
❌ NOT Network instability
❌ NOT Firewall or network configuration
❌ NOT Unity's reconnect logic
It Is: Python Asyncio Design Flaw
✅ IS ProactorEventLoop's IOCP state management
✅ IS Lack of synchronization between connection types
✅ IS Missing error recovery in accept() path
✅ IS Windows-specific async I/O model limitation
Technical Deep Dive
Why Claude Code Triggers the Bug
The 19ms Race Condition
Why the Fix Works
Switching to SelectorEventLoop
Why It Fixes the Claude Code Issue
Summary: The Real Problem
The Problem is NOT
The Problem IS
The Real Fix
What We Fixed
What This Does
Conclusion
The problem is NOT Unity reconnecting.
The problem is:
The fix:
Key Insight: Unity is the victim, not the culprit. The real problem is in the Python asyncio layer handling mixed connection types with a buggy Windows-specific implementation.
23 remaining items
fix: CheckStatus speed-up (PR CoplayDev#682) + TcpListener leak preve…
fix: prevent TcpListener leak on Windows Domain Reload
xwork1 commentedon Feb 6, 2026
Unfortunately, 127.0.0.1 didn't work; I had already tried it before you mentioned it :). I started it through Stdio, added the mcp for the Claude Code, and that's how it worked.
whatevertogo commentedon Feb 6, 2026
I see.can you take some pictures for us about it,that will be great for us to konw how to fix it.
fix: prevent TcpListener leak on Windows Domain Reload
fix: prevent TcpListener leak on Windows Domain Reload
fix: prevent TcpListener leak on Windows Domain Reload
parantail commentedon Feb 7, 2026
I'm having the same issue and this workaround (from @whatevertogo) works for me. I had to clone this repo and run mcp server from the source though.
TheSmallKiwi commentedon Feb 8, 2026
9.4.0 seems to have fixed the issue where using /mcp reconnect in claude code caused a server error and plugin session loss 👍👍👍
dsarno commentedon Feb 11, 2026
Please download and try latest version 9.4.4. And make sure you don't have "use beta" selected in advanced settings of Unity mcp window. Let me know if that solve this.
xwork1 commentedon Feb 11, 2026
I just converted it to “Stdio” and added it to the claude code using the mcp add command.
whatevertogo commentedon Feb 11, 2026
@xwork1 Please update unity-mcp to the latest version and verify whether this issue has been resolved. The new release includes many detailed improvements by @dsarno .
dsarno commentedon Feb 11, 2026
@whatevertogo thanks. are you still seeing the issue on your system?
whatevertogo commentedon Feb 11, 2026
I resolved this issue via IPv4 a long time ago, though I'm not sure why some people can't fix it with IPv4.