Record working Unity MCP config (server 8067, bridge 8068) + 8080/reserved-port gotcha
This commit is contained in:
parent
b1db1d2a15
commit
dfd3cf5506
5 changed files with 43 additions and 5 deletions
|
|
@ -8,10 +8,22 @@
|
|||
|
||||
## Current values (this machine)
|
||||
|
||||
- **Windows host IP as seen from WSL:** `172.27.208.1` (the WSL default gateway; confirm with `ip route show default`). This can change across WSL restarts — if MCP stops connecting, re-check it and update `.mcp.json`.
|
||||
- **MCP HTTP port:** `8080` (CoplayDev default). If something else on Windows already uses 8080, change it in the Unity panel and in `.mcp.json`.
|
||||
- **`.mcp.json`** (committed) → `{"unity": {"type":"http","url":"http://172.27.208.1:8080/mcp"}}`
|
||||
**✅ WORKING CONFIG (verified 2026-07-10, mcp-for-unity-server v3.4.4):**
|
||||
- **Windows host IP as seen from WSL:** `172.27.208.1` (the WSL default gateway; confirm with `ip route show default`). Can change across WSL restarts — if MCP stops connecting, re-check it and update `.mcp.json`.
|
||||
- **MCP server:** binds `127.0.0.1:8067` (set the port in the *MCP for Unity* window; HTTP transport). **Do NOT use 8080** — see gotcha below.
|
||||
- **WSL bridge:** Windows `netsh portproxy` `0.0.0.0:8068 → 127.0.0.1:8067` (+ firewall allow on 8068). A **distinct** listen port (8068) is required — a proxy on `0.0.0.0:8067` would collide with the server's `127.0.0.1:8067` bind.
|
||||
- **`.mcp.json`** (committed) → `{"unity": {"type":"http","url":"http://172.27.208.1:8068/mcp"}}`
|
||||
- **`.claude/settings.local.json`** (local) pre-enables the `unity` server.
|
||||
- **Verify from WSL:** `curl -s -X POST http://172.27.208.1:8068/mcp -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"probe","version":"0"}}}'` → should return an `initialize` result naming `mcp-for-unity-server`.
|
||||
|
||||
**⚠️ Gotcha — the port 8080 trap (why this took a few tries):** binding `8080` failed with Windows `[Errno 13] ... forbidden by its access permissions` (WSAEACCES). That's because **WSL2 runs on Hyper-V/WinNAT, which reserves large TCP port ranges**, and 8080 fell inside one. The server silently started then shut down; the "open 8080" was only the dead portproxy accepting + resetting. Fix = pick a port **outside** the reserved ranges (check `netsh interface ipv4 show excludedportrange protocol=tcp`) — we used `8067`. Bridge with a *different* proxy port (`8068`) to avoid the loopback/all-interfaces bind collision.
|
||||
|
||||
**Bridge commands (admin PowerShell), for reference / re-setup:**
|
||||
```powershell
|
||||
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=8068 connectaddress=127.0.0.1 connectport=8067
|
||||
New-NetFirewallRule -DisplayName "Unity MCP 8068" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 8068
|
||||
netsh interface portproxy show all
|
||||
```
|
||||
|
||||
## One-time setup (do on Windows, in the Unity Editor)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue