You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-3Lines changed: 47 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -438,11 +438,55 @@ Error:
438
438
Connection failed: Unknown error
439
439
```
440
440
441
-
This error occurs because the bridge connection is lost when the domain reloads upon switching to Play Mode.
442
-
The workaround is to turn off **Reload Domain** in **Edit > Project Settings > Editor > "Enter Play Mode Settings"**.
441
+
This error occurs because the bridge connection is lost when the domain reloads upon switching to Play Mode. The workaround is to turn off **Reload Domain** in **Edit > Project Settings > Editor > "Enter Play Mode Settings"**.
443
442
444
443
</details>
445
444
445
+
## Troubleshooting: WSL2 (Windows 11) networking
446
+
447
+
When running the MCP (Node.js) server inside WSL2 while Unity runs on Windows 11, connecting to `ws://localhost:8090/McpUnity` may fail with `ECONNREFUSED`.
448
+
449
+
Cause: WSL2 and Windows have separate network namespaces — `localhost` inside WSL2 does not point to the Windows host. By default, Unity listens on `localhost:8090`.
With this, `Server~/src/unity/mcpUnity.ts` will connect to `ws://$UNITY_HOST:8090/McpUnity` instead of `localhost` (it reads `UNITY_HOST`, and may also honor a `Host` in `ProjectSettings/McpUnitySettings.json` if present).
471
+
472
+
### Solution 3 — Allow remote connections from Unity
473
+
- Unity: Tools → MCP Unity → Server Window → enable “Allow Remote Connections” (Unity binds to `0.0.0.0`).
474
+
- Ensure Windows Firewall allows inbound TCP on your configured port (default 8090).
475
+
- From WSL2, connect to the Windows host IP (see Solution 2) or to `localhost` if mirrored mode is enabled.
476
+
477
+
> [!NOTE]
478
+
> Default port is `8090`. You can change it in the Unity Server Window (Tools → MCP Unity → Server Window). The value maps to `McpUnitySettings` and is persisted in `ProjectSettings/McpUnitySettings.json`.
479
+
480
+
#### Validate connectivity
481
+
482
+
```bash
483
+
npm i -g wscat
484
+
# After enabling mirrored networking
485
+
wscat -c ws://localhost:8090/McpUnity
486
+
# Or using the Windows host IP
487
+
wscat -c ws://$UNITY_HOST:8090/McpUnity
488
+
```
489
+
446
490
## Support & Feedback
447
491
448
492
If you have any questions or need support, please open an [issue](https://github.com/CoderGamester/mcp-unity/issues) on this repository or alternative you can reach out on:
@@ -458,7 +502,7 @@ Contributions are welcome! Please feel free to submit a Pull Request or open an
0 commit comments