MCP Directory

MCP Unity

Connect AI assistants to the Unity Editor to manipulate scenes, GameObjects, assets, and run tests via MCP.

Unverified
stdio (local)
No auth
C#

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_item

Executes Unity menu items (functions tagged with the MenuItem attribute).

select_gameobject

Selects game objects in the Unity hierarchy by path or instance ID.

update_gameobject

Updates a GameObject's core properties (name, tag, layer, active/static state), or creates the GameObject if it does not exist.

update_component

Updates component fields on a GameObject, or adds the component if the GameObject does not contain it.

add_package

Installs new packages in the Unity Package Manager.

run_tests

Runs tests using the Unity Test Runner.

send_console_log

Sends a console log to Unity.

add_asset_to_scene

Adds an asset from the AssetDatabase to the Unity scene.

create_prefab

Creates a prefab with optional MonoBehaviour script and serialized field values.

create_scene

Creates a new scene and saves it to the specified path.

load_scene

Loads a scene by path or name, with optional additive loading.

delete_scene

Deletes a scene by path or name and removes it from Build Settings.

get_gameobject

Gets detailed information about a specific GameObject including all components.

get_console_logs

Retrieves logs from the Unity console with pagination support.

recompile_scripts

Recompiles all scripts in the Unity project.

save_scene

Saves the current active scene, with optional Save As to a new path.

get_scene_info

Gets information about the active scene including name, path, dirty state, and all loaded scenes.

unload_scene

Unloads a scene from the hierarchy (does not delete the scene asset).

duplicate_gameobject

Duplicates a GameObject in the scene with optional renaming and reparenting.

delete_gameobject

Deletes a GameObject from the scene.

reparent_gameobject

Changes the parent of a GameObject in the hierarchy.

move_gameobject

Moves a GameObject to a new position (local or world space).

rotate_gameobject

Rotates a GameObject to a new rotation (local or world space, Euler angles or quaternion).

scale_gameobject

Scales a GameObject to a new local scale.

set_transform

Sets position, rotation, and scale of a GameObject in a single operation.

create_material

Creates a new material with specified shader and saves it to the project.

assign_material

Assigns a material to a GameObject's Renderer component.

modify_material

Modifies properties of an existing material (colors, floats, textures).

get_material_info

Gets detailed information about a material including shader and all properties.

batch_execute

Executes 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).

Featured
Verified
stdio (local)
No auth
TypeScript
12 tools
Updated 21 days agoRepo

Up-to-date, version-specific library documentation injected into your coding agent.

Verified
stdio (local)
API key
TypeScript
2 tools
Updated 25 days agoRepo

Code intelligence engine that indexes repos into a persistent knowledge graph for AI coding agents.

Unverified
stdio (local)
No auth
C
14 tools
Updated 11 hours agoRepo