UnityMCP
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| UNITY_MCP_CLIENT_ID | No | Stable, unique client identity (e.g. mygame-editor-agent) for one logical client; do not reuse the same identity across multiple clients. If unset, falls back to session variable or PID, which may not restore the original binding after restart. | |
| UNITY_MCP_BRIDGE_HOST | No | Bridge host. Only literal loopback IPs are accepted (defaults to 127.0.0.1); DNS hostnames and public addresses are rejected. | |
| UNITY_MCP_BRIDGE_PORT | No | Bridge port. Bridge prefers 127.0.0.1:17873 and can fall back to 17874..17883; Python scans 17873..17882 by default (17883 must be specified explicitly). | |
| UNITY_MCP_PROJECT_PATH | Yes | Path to the Unity project (<PROJECT_ROOT>). Placeholder must be replaced with the actual local path. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| auto_loginD | – |
| ensure_readyD | – |
| escalate_via_clickA | escalate_via_click tool. Write op. Command-line fallback to real input. When lua_eval command-line operations (e.g. PROJECT_RUNTIME.global.ui:open(uid)) don't carry real data — surfaced by repeated verify_assertions failures under the same goal (verdict.escalation.should_escalate) — the agent should NOT keep forcing the lua path. This tool atomically:
If the undo fails, the click is NOT attempted (never stack a click on an un-restored dirty state) and the gate is left intact. If the click misses, the gate is left intact so the agent can retry with a different locator / mode. PlayMode-only (lua VM + simulate both require Play Mode). USE WHEN: verify_assertions returned escalation.should_escalate=true — your lua command-line operations are not reaching the real environment. Pass undo_lua to restore your prior lua op and the real entry button's panel_uid + ref_key/path; this tool restores then clicks for real, so the next screenshot/assertion faces the true environment. DO NOT ask the user before the real click. The fallback (undo -> real click ->
reverify) is deterministic and runs entirely inside this tool. Pass
Omitting |
| assert_no_compile_errorsD | – |
| query_sceneD | – |
| capture_screenshotA | capture_screenshot tool. Read-only. No token. PERF 2026-05-25:
Wall-clock cost is dominated by Unity-side CaptureScreenshot (~300ms,
two-tick delay + PNG encode); FINAL-VERIFICATION ROLE: the final verification of any user-facing change MUST include a screenshot from this tool showing the expected result — read-state probes (lua_eval / logs / assertions) do not by themselves prove the change works. If the change spans multiple screens, capture one per meaningful step. When unsure the game is on the relevant screen, ask the user before capturing. |
| observe_evidenceD | – |
| list_pending_writesD | – |
| enter_playmodeD | – |
| exit_playmodeD | – |
| open_sceneD | – |
| run_methodD | – |
| human_collab_gateD | – |
| lua_reload_moduleD | – |
| csharp_reload_scriptsD | – |
| get_console_logsD | – |
| clear_consoleD | – |
| record_startD | – |
| record_stopD | – |
| list_sessionsD | – |
| replayD | – |
| lua_evalD | – |
| verify_assertionsD | – |
| start_verification_sessionD | – |
| end_verification_sessionD | – |
| list_ui_nodesD | – |
| resolve_localizationD | – |
| open_panelD | – |
| simulate_clickA | simulate_click tool. Write op. Clicks a UI node via PROJECT_UI's own simulate API. Main path (no real input device, no screen coordinate): resolves the node by panel uid + refKey (panel PROJECT_NODE_REFERENCE key) OR path (transform path under the panel root), then calls:
PlayMode-only. Device-pixel clicking (screenXY via InputSystem.QueueStateEvent) is deferred to a later phase. FINAL-VERIFICATION ROLE: when the user described repro steps, drive the same clicks here during final verification instead of calling internal handlers that bypass the input path; then capture_screenshot to evidence the result. |
| simulate_keyA | simulate_key tool. Write op. Triggers an input ACTION by its action path. Calls PROJECT_RUNTIME.global.PROJECT_INPUT_SERVICE:PROJECT_TRIGGER_ACTION(actionPath, 'Performed') then 'Canceled' — this routes through the game's InnerHandleInputInfo funnel exactly like real input, but bypasses the focus / inputEnabled gate, so it works even when the Editor Game view isn't focused. Use for "press the key bound to feature X" (e.g. "Hud/OpenMap", "Player/Jump"). IMPORTANT — only REAL InputActionAsset actions can be triggered this way. Virtual PROJECT_HOTKEY_SYSTEM bindings (isVirtual=true, driven by PROJECT_HOTKEY_CALLBACK — most panel hotkeys like "Common/ClosePanelCommon") are NOT in playerInput.actions, so this returns triggered=false with a note. For those, use simulate_click on the bound button, or lua_eval the panel method. Device-level raw keystrokes (InputSystem.QueueStateEvent on Keyboard) are deferred to a later phase. PlayMode-only. FINAL-VERIFICATION ROLE: when the user gave repro steps involving key/gamepad presses, replay them here during final verification, then capture_screenshot to evidence the outcome. (Reaches only real InputActionAsset actions — for virtual PROJECT_HOTKEY_SYSTEM hotkeys use simulate_click on the bound button.) |
| set_input_textA | set_input_text tool. Write op. Sets an PROJECT_UI input field's text and commits it. Resolves the input node (panel uid + refKey OR path), sets its settable PlayMode-only. FINAL-VERIFICATION ROLE: when the user's repro steps involve typing into a field, set it here during final verification, then capture_screenshot to evidence the result. |
| observe_cameraD | – |
| list_entitiesD | – |
| observe_entityD | – |
| list_effectsD | – |
| observe_effectD | – |
| observe_windowD | – |
| operate_cameraD | – |
| select_bridgeB | 选择和绑定到特定的 Unity bridge 实例。 当有多个 Unity 编辑器实例运行时使用此工具。每个实例应该配置不同的端口。 Args: port: 要连接的 Unity bridge 端口号。如果不指定,显示当前连接状态。 scan: 设为 True 时扫描并列出所有可用的 bridge 实例(端口 17873-17882)。 Returns: 操作结果,包含连接状态或扫描到的实例列表。 Examples: # 扫描所有可用的 bridge 实例 select_bridge(scan=True) |
| bind_bridgeA | 将 Unity bridge 绑定到当前 MCP 会话。 这个工具会记住当前会话的绑定关系,重启 MCP server 后可以自动恢复。 适合需要长期固定连接到特定 Unity 实例的场景。 Args: port: 要绑定的端口号。如果不指定,显示当前绑定状态。 auto: 设为 True 时自动检测并绑定。如果只有一个实例则自动绑定, 如果有多个实例则返回列表让用户选择。 unbind: 设为 True 时解除当前会话的绑定。 restore: 设为 True 时从持久化文件恢复之前的绑定。 Returns: 操作结果,包含绑定状态、会话 ID、端口信息等。 Examples: # 自动检测并绑定(如果只有一个实例) bind_bridge(auto=True) |
| bridge_adminB | Pair, inspect, diagnose, clear, or safely repair a Unity bridge. Actions: pair, status, owners, diagnose, clear, repair. Clear also requires side=binding|accepted|listener. Destructive operations retain bridge/client/generation identity checks and never kill a process. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| unity_pair | Bind this MCP client identity to one explicit Unity bridge. |
| unity_status | Show socket owners and Unity's accepted-client state. |
| unity_owners | Query the processes owning both sides of a Unity bridge socket. |
| unity_diagnose | Classify why a Unity bridge endpoint is unavailable or stuck. |
| unity_clear | Clear one binding, accepted client, or Unity listener. |
| unity_repair | Attempt a guarded Unity bridge transport repair. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 41 tools
The tool set has several fuzzy boundaries: select_bridge, bind_bridge, and bridge_admin all manage bridge connection/binding state; observe_evidence, verify_assertions, capture_screenshot, and the observe_* tools overlap in evidence gathering; and escalate_via_click wraps simulate_click. Many tools also have empty descriptions, which makes distinguishing intended use harder for an agent.
Tool names are consistently snake_case, which is a strong baseline. There are minor deviations in verb style and noun-only names (e.g. human_collab_gate, bridge_admin) alongside verb-led names, but the pattern remains readable.
With 41 tools, the server is well above the typical well-scoped range and includes many niche operations for camera/entity/effect/window observation, recording/replay, verification, and bridge management. These could likely be consolidated into fewer, clearer tools without losing capability.
The surface covers a broad Unity automation lifecycle: scene/playmode control, UI inspection and input simulation, screenshots, console logs, Lua/C# execution, assertions, recording/replay, and bridge management. Direct CRUD-style operations for game objects/assets are limited, but lua_eval and run_method provide escape hatches for many missing operations.