
MCP Unity
Connect AI assistants to the Unity Editor to manipulate scenes, GameObjects, assets, and run tests via MCP.
Add to your client
Copy the config for your MCP client and paste it into its config file.
Paste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"mcp-unity": {
"command": "node",
"args": [
"ABSOLUTE/PATH/TO/mcp-unity/Server~/build/index.js"
]
}
}
}Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- Unity 6 or later (to install the server package)
- Node.js 18 or later (to run the server)
- npm 9 or later (to build/debug the server)
- Install the Unity package via Package Manager git URL: https://github.com/CoderGamester/mcp-unity.git
- Start the WebSocket server from Unity (Tools > MCP Unity > Server Window > Start Server)
About MCP Unity
MCP Unity bridges the Unity Editor and MCP-compatible AI clients. A Unity package (installed via UPM git URL) runs a WebSocket server inside the Editor; a companion Node.js server implements the Model Context Protocol and relays MCP tool/resource calls to Unity over that WebSocket. This exposes Editor functionality — scene and GameObject manipulation, component and material editing, package management, menu-item execution, console logs, and the Test Runner — as MCP tools and resources, so AI assistants can drive Unity through natural-language prompts. Configuration can be written automatically from the Unity Server Window (Tools > MCP Unity > Server Window) for each client, or added manually to the client's MCP config.
Tools & capabilities (30)
execute_menu_itemExecutes Unity menu items (functions tagged with the MenuItem attribute).
select_gameobjectSelects game objects in the Unity hierarchy by path or instance ID.
update_gameobjectUpdates a GameObject's core properties (name, tag, layer, active/static state), or creates the GameObject if it does not exist.
update_componentUpdates component fields on a GameObject, or adds the component if the GameObject does not contain it.
add_packageInstalls new packages in the Unity Package Manager.
run_testsRuns tests using the Unity Test Runner.
send_console_logSends a console log to Unity.
add_asset_to_sceneAdds an asset from the AssetDatabase to the Unity scene.
create_prefabCreates a prefab with optional MonoBehaviour script and serialized field values.
create_sceneCreates a new scene and saves it to the specified path.
load_sceneLoads a scene by path or name, with optional additive loading.
delete_sceneDeletes a scene by path or name and removes it from Build Settings.
get_gameobjectGets detailed information about a specific GameObject including all components.
get_console_logsRetrieves logs from the Unity console with pagination support.
recompile_scriptsRecompiles all scripts in the Unity project.
save_sceneSaves the current active scene, with optional Save As to a new path.
get_scene_infoGets information about the active scene including name, path, dirty state, and all loaded scenes.
unload_sceneUnloads a scene from the hierarchy (does not delete the scene asset).
duplicate_gameobjectDuplicates a GameObject in the scene with optional renaming and reparenting.
delete_gameobjectDeletes a GameObject from the scene.
reparent_gameobjectChanges the parent of a GameObject in the hierarchy.
move_gameobjectMoves a GameObject to a new position (local or world space).
rotate_gameobjectRotates a GameObject to a new rotation (local or world space, Euler angles or quaternion).
scale_gameobjectScales a GameObject to a new local scale.
set_transformSets position, rotation, and scale of a GameObject in a single operation.
create_materialCreates a new material with specified shader and saves it to the project.
assign_materialAssigns a material to a GameObject's Renderer component.
modify_materialModifies properties of an existing material (colors, floats, textures).
get_material_infoGets detailed information about a material including shader and all properties.
batch_executeExecutes multiple tool operations in a single batch request, reducing round-trips and enabling atomic operations with optional rollback on failure.
When to use it
- Scaffold scenes and GameObjects from natural-language prompts (e.g. create a Player object, add a Rigidbody, set its mass).
- Batch-create or batch-modify many GameObjects in one atomic operation with optional rollback.
- Run Unity Test Runner EditMode/PlayMode tests and inspect console logs/errors via the AI assistant.
- Automate asset and material workflows — create/assign/modify materials, add assets and prefabs to scenes.
- Execute custom Editor menu items and recompile scripts to drive project-specific automation.
Security notes
The Node.js MCP server connects to a WebSocket server that Unity runs locally (default localhost:8090, port UNITY_PORT). By default the WebSocket binds to localhost; enabling 'Allow Remote Connections' binds it to 0.0.0.0 (all interfaces), exposing Editor control over the network — only do this on trusted networks and behind a firewall. The Node server is launched via an absolute or project-relative path to a locally built build/index.js; rebuild it after package updates since the UPM package-cache hash in the path changes.
MCP Unity FAQ
What is MCP Unity?
A bridge that connects the Unity Editor to AI assistants using the Model Context Protocol. It exposes Editor functionality (creating objects, modifying components, running tests, etc.) as MCP tools and resources by running a WebSocket server inside Unity plus a Node.js MCP server that acts as a WebSocket client to Unity.
Which MCP hosts and IDEs support MCP Unity?
Any client that can act as an MCP client. Known compatible platforms include Cursor, Windsurf, Claude Desktop, Claude Code, Codex CLI, GitHub Copilot, Google Antigravity, and OpenCode.
Can I extend MCP Unity with custom tools?
Yes. In Unity (C#) you create classes inheriting from McpToolBase and register them in McpUnityServer.cs; in the Node.js server (TypeScript) you add a matching tool handler with a Zod schema in Server/src/tools/ and register it in Server/src/index.ts.
Why do I get a connection failed error when running Play Mode tests?
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'.
Is MCP Unity free to use?
Yes, it is open-source under the MIT License — free to use, modify, and distribute per the license terms.
Alternatives to MCP Unity
Compare all alternatives →Microsoft's official browser-automation MCP using Playwright's accessibility tree (no vision model).
Up-to-date, version-specific library documentation injected into your coding agent.
Code intelligence engine that indexes repos into a persistent knowledge graph for AI coding agents.
Compare MCP Unity with: