66 lines
1.3 KiB
Markdown
66 lines
1.3 KiB
Markdown
# Unity MCP Bridge
|
|
|
|
The project now has a local Unity Editor bridge plus a Node MCP server.
|
|
|
|
## Flow
|
|
|
|
```text
|
|
Codex MCP tool
|
|
-> tools/unity-mcp-server/index.mjs
|
|
-> http://127.0.0.1:19744
|
|
-> Assets/Editor/UnityCodexBridgeServer.cs
|
|
-> Unity Editor scene, logs, and camera capture
|
|
```
|
|
|
|
The Unity bridge binds only to `127.0.0.1`.
|
|
|
|
## Unity menu
|
|
|
|
```text
|
|
Tools > Codex Bridge > Start Server
|
|
Tools > Codex Bridge > Stop Server
|
|
Tools > Codex Bridge > Auto Start
|
|
Tools > Codex Bridge > Capture Game View
|
|
```
|
|
|
|
Auto Start is enabled by default.
|
|
|
|
## MCP setup
|
|
|
|
Install Node dependencies:
|
|
|
|
```powershell
|
|
cd tools\unity-mcp-server
|
|
npm install
|
|
```
|
|
|
|
Add this to Codex MCP config and restart Codex/VS Code:
|
|
|
|
```toml
|
|
[mcp_servers.vrbeats_unity]
|
|
command = "node"
|
|
args = ["C:\\Users\\User-40\\Desktop\\unity\\work\\BeatSabar\\VRBeatSaber\\tools\\unity-mcp-server\\index.mjs"]
|
|
startup_timeout_sec = 30
|
|
|
|
[mcp_servers.vrbeats_unity.env]
|
|
UNITY_BRIDGE_URL = "http://127.0.0.1:19744"
|
|
```
|
|
|
|
## Useful bridge URLs
|
|
|
|
These can be tested in a browser or with PowerShell while Unity is open:
|
|
|
|
```text
|
|
http://127.0.0.1:19744/health
|
|
http://127.0.0.1:19744/logs?count=50
|
|
http://127.0.0.1:19744/scene/roots
|
|
http://127.0.0.1:19744/scene/objects?query=Canvas&limit=50
|
|
http://127.0.0.1:19744/capture?width=1280&height=720
|
|
```
|
|
|
|
Screenshots are saved to:
|
|
|
|
```text
|
|
Captures/latest.png
|
|
```
|