HTTP bridge for driving the Unity editor from an external AI agent or script.
It talks to the CoplayDev/unity-mcp server (PyPI package mcpforunityserver) over its REST API and exposes a set of small HTTP services on 127.0.0.1. The server process is spawned automatically via uvx and restarted if it exits.
Calling MCP tools through a chat interface is slow and fragile. This daemon turns Unity automation into plain HTTP calls you can issue from any language or agent framework:
# Run C# in the editor (method body, return value comes back in "result")
$b = @{ code = 'return UnityEngine.Application.version;' } | ConvertTo-Json
Invoke-RestMethod http://127.0.0.1:44903/execute -Method Post -Body $b -ContentType 'application/json'
# Start / stop Play Mode
Invoke-RestMethod http://127.0.0.1:44902/start -Method Post -Body '{}' -ContentType 'application/json'
Invoke-RestMethod http://127.0.0.1:44902/stop -Method Post -Body '{}' -ContentType 'application/json'
# Read a script from the project
Invoke-RestMethod http://127.0.0.1:44901/read -Method Post -Body '{"path":"Assets/Scripts/Player.cs"}' -ContentType 'application/json'- Unity Editor with the unity-mcp plugin installed into the project.
- uv installed (
irm https://astral.sh/uv/install.ps1 | iex) so the daemon can spawn the server, OR an already-running server started another way (e.g. from the Unity plugin's "Start server" menu). - Go 1.20+ to build (or use a pre-built release).
-
Open the project in Unity Editor (Unity 6 or 6000.x recommended; the plugin supports recent Unity versions).
-
Install the unity-mcp plugin — open
Window → Package Manager, click the+button in the top-left, choose "Add package from git URL…" and paste:https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#mainWait for the package to finish importing (you'll see a new menu entry
Window → MCP for Unity).Alternative: clone the repo locally and reference the
MCPForUnitysubfolder by local path instead of the git URL — useful when git-URL resolution is slow or blocked. -
Open the plugin window —
Window → MCP for Unity. In the Server Status section, click Start Server (or run Auto-Setup). This launches the MCP HTTP server (defaulthttp://127.0.0.1:8080). -
Start the Unity Bridge — in the same window, under Unity Bridge, click Start Bridge. The daemon will then see your editor as a connected instance.
- Optional: enable Auto-Start on Editor Load in the plugin's Advanced Settings so the bridge starts automatically every time the editor opens.
-
Verify — with the daemon running, check that it lists the instance:
Invoke-RestMethod http://127.0.0.1:44900/instances
You should see your Unity instance in
result, and then all ports 44900–44904 are live for the commands shown above.
Flags (run with -h to see all):
| Flag | Default | Purpose |
|---|---|---|
-url |
http://127.0.0.1:8080 |
Base URL of the Unity MCP server (HTTP transport). |
-uvx |
auto | Path to uvx (or uv); auto-detected if empty. |
-no-spawn |
false |
Do not auto-spawn the server; only proxy to a running one. |
uvx is resolved in this order:
-uvx <path>flagUNITY_MCP_UVXenvironment variableuvxonPATHuvonPATH(used asuv tool run --from mcpforunityserver ...)- Common install locations (
%LOCALAPPDATA%\Programs\uv\uvx.exe,%USERPROFILE%\.local\bin\uvx.exe,%LOCALAPPDATA%\Microsoft\WinGet\Links\uvx.exe,%ProgramFiles%\uv\uvx.exe)
If the server is already reachable at -url (e.g. launched by the Unity plugin), the daemon proxies to it and never spawns a second one.
go build -o unity_mcp_daemon.exe .
.\unity_mcp_daemon.exeOrder of operations:
- Start Unity with the plugin installed and the server + bridge started (see the Unity steps above).
- Start the daemon — it detects the already-running server and proxies to it (no second server is spawned).
- Call the endpoints on ports 44900–44904 from any script or AI agent.
Point a browser at http://127.0.0.1:44900/ for the full endpoint reference.
| Port | Service | Purpose |
|---|---|---|
| 44900 | rpc | Generic proxy to any server command (/call), plus /instances and /health |
| 44901 | scripts | Read / create / edit / delete C# scripts (/read, /create, /edit, /delete) |
| 44902 | play | Play / pause / stop mode and other editor actions (/start, /pause, /stop, /call) |
| 44903 | code | Execute C# in the editor (/execute, /history, /replay, /clear) |
| 44904 | console | Read / grep / clear the Unity console (/tail, /grep, /clear) |
Every port serves GET / and GET /help with the same documentation.
core.go— daemon core: REST client for the server's/api/command, auto-spawn/restart of theuvxprocess, connectivity keepalive.goroutines.go— the five HTTP service goroutines (ports 44900–44904) plus path/URI helpers.main.go— entry point, flags,uvxauto-detection.
Each HTTP endpoint maps to one or two Unity MCP commands and answers with a compact JSON body: {"result": {...}, "error": ""}. The error field is filled on transport failures or when the server reports success: false.
This is an independent project and is not affiliated with, endorsed by, or in any way officially connected with Unity Technologies. See the full disclaimer of liability and trademark notice in DISCLAIMER.md.
Apache License 2.0 — see LICENSE.