Open-Source mcp-unity Lets AI Agents Directly Control the Unity Editor
mcp-unity gives AI coding assistants like Cursor and Claude Code direct, live control over the Unity Editor — no more copy-pasting code and clicking manually
Takeaways
- What it is: mcp-unity is a free, MIT-licensed Unity package that gives AI coding assistants direct live control over the Unity Editor via MCP.
- How it works: A WebSocket server runs inside Unity; a Node.js MCP bridge connects it to IDEs like Cursor, Claude Code, Copilot, Codex CLI, and Windsurf.
- 30+ tools: Covers scene management, GameObject transforms, components, materials, package installation, test running, prefab creation, and batch operations with rollback.
- Easy setup: Install via Unity Package Manager with a git URL, then click a configure button in the Editor to auto-generate the JSON config for your IDE.
- Broader trend: Unreal Engine 5.8 and Godot now have similar MCP integrations; MCP editor control is becoming standard infrastructure across game engines.
- Limitations: Play Mode tests require disabling Domain Reload; WSL2 needs extra networking config; package cache path changes on update require reconfiguring.
mcp-unity is an open-source Unity package that turns your AI coding assistant into a hands-on Unity Editor operator. Instead of generating C# code you then paste and wire up yourself, tools like Cursor, Claude Code, GitHub Copilot, and Codex CLI can now directly create GameObjects, modify components, manage scenes, run tests, and install packages , all from a natural language prompt.
The problem it actually solves
AI code generation for Unity has always had a gap. The old approach , generate code and hope the rest works out , breaks down the moment your intent touches the actual fabric of the project: assets, scenes, settings, importers, build targets, physics layers, input bindings, render pipelines. You still had to be the hands: drag things into the hierarchy, nudge serialized fields, hit Play, read the console, patch the error, repeat.
When you put Unity behind MCP, the agent no longer needs to hallucinate the project , it can query it. That is the difference between AI-assisted coding and AI-native game development. The AI goes from passive code suggester to active development partner that can take the controls.
How it works under the hood
mcp-unity runs a WebSocket server inside Unity and a Node.js server (acting as a WebSocket client to Unity) that implements the MCP protocol. This allows AI assistants to send commands to Unity and receive information back. The architecture has three layers:
- The Unity C# side , a WebSocket server embedded in the Editor that exposes editor operations as callable tools
- The Node.js MCP server , a TypeScript bridge that translates MCP protocol messages from your IDE into WebSocket calls to Unity
- Your AI IDE , Cursor, Claude Code, Copilot, etc., which discover the tools and call them based on your prompts
MCP (Model Context Protocol) is the glue. MCP changes the relationship between AI and editor: it turns the Unity Editor into an addressable tool surface, where actions are explicit, inputs are structured, and outputs are inspectable. An agent can discover what exists, mutate it through supported operations, and verify what happened by reading real signals from the environment.