File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
MCPForUnity/UnityMcpServer~/src Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -56,16 +56,16 @@ def list_candidate_files() -> List[Path]:
5656 @staticmethod
5757 def _try_probe_unity_mcp (port : int ) -> bool :
5858 """Quickly check if a MCP for Unity listener is on this port.
59- Tries a short TCP connect, sends 'ping', expects a JSON 'pong' .
59+ Tries a short TCP connect, sends 'ping', expects Unity bridge welcome message .
6060 """
6161 try :
6262 with socket .create_connection (("127.0.0.1" , port ), PortDiscovery .CONNECT_TIMEOUT ) as s :
6363 s .settimeout (PortDiscovery .CONNECT_TIMEOUT )
6464 try :
6565 s .sendall (b"ping" )
6666 data = s .recv (512 )
67- # Minimal validation: look for a success pong response
68- if data and b '"message":"pong"' in data :
67+ # Check for Unity bridge welcome message format
68+ if data and ( b"WELCOME UNITY-MCP" in data or b '"message":"pong"' in data ) :
6969 return True
7070 except Exception :
7171 return False
You can’t perform that action at this time.
0 commit comments