CoderGamester/mcp-unity
Model Context Protocol (MCP) plugin to connect with Unity Editor — designed for Cursor, Claude Code, Codex, Windsurf and other IDEs
1,855 ★234 forksC#Updated 2d ago
What you need to know
MCP Unity bridges AI assistants with the Unity Editor via a WebSocket server inside Unity and a Node.js MCP server, letting agents like Cursor, Windsurf, Claude Code, and Codex CLI communicate with Unity to create/modify GameObjects, run tests, manage scenes and assets through natural language.
Install
Install Node.js 18+ Unity Package Manager → Window > Package Manager → + → "Add package from git URL..." → https://github.com/CoderGamester/mcp-unity.git Configure AI client from Tools > MCP Unity > Server Window (Configure button) or manually in the client's mcp.json
Usage
- •Open Unity Editor → Tools > MCP Unity > Server Window → click "Start Server" (WebSocket, default port 8090)
- •Client config: { "mcpServers": { "mcp-unity": { "command": "node", "args": ["ABSOLUTE/PATH/TO/mcp-unity/Server~/build/index.js"] } } }
- •Ask prompts like "Add a Rigidbody component to the Player object and set its mass to 5" or "Run all the EditMode tests in my project"
- •Optional: change WebSocket port/timeout in the Server Window (persisted to ProjectSettings/McpUnitySettings.json), enable "Allow Remote Connections" for non-localhost
Key features
- ✓30+ MCP tools: execute_menu_item, select/update/delete/duplicate/reparent/move/rotate/scale gameobjects, update_component, add_package, run_tests, create/load/save/delete scenes, material tools, batch_execute (atomic with rollback)
- ✓Play mode control (set_play_mode_status: play/pause/stop/step) and get_play_mode_status
- ✓MCP resources: unity://menu-items, unity://scenes-hierarchy, unity://gameobject/{id}, unity://logs, unity://packages, unity://assets, unity://tests/{testMode}
- ✓Unity dashboard MCP App for VS Code (requires VS Code 1.109+); IDE integration auto-adds Unity Library/PackedCache for VSCode-like IDEs
- ✓Extensible: define custom C# tools (McpToolBase) registered in McpUnityServer.cs plus matching TypeScript handlers
Best for
AI-assisted Unity Editor automation — scene building, component editing, test running, and asset management via natural language prompts.
Caveats
- ⚠Requires Unity 6 or later, Node.js 18+, npm 9+
- ⚠run_tests fails when domain reloads on Play Mode switch — workaround is disabling Reload Domain in Enter Play Mode Settings
- ⚠WebSocket server binds to localhost by default; WSL2 networking (e.g. ECONNREFUSED) needs mirrored-mode networking or UNITY_HOST env var
- ⚠Project paths with spaces are supported but may cause connection issues (troubleshooting step: move project to a path without spaces)
- ⚠Some clients may fail with KeyError 'position' on transform tools if the client supports local JSON pointer refs poorly
Platforms: Windows · macOS · LinuxClients: Cursor · Windsurf · Claude Desktop · Claude Code · Codex CLI · GitHub Copilot · Google Antigravity · OpenCode · VS Code
Documentation ↗Reviewed 2026-08-07
Topics
claudecodecodex-clicopilotcursorgame-developmentmcpmodel-context-protocolopenaiopenclawunityunity-packageunity3d
- Stars
- 1,855★
- Forks
- 234
- Language
- C#
- License
- MIT
- Created
- 2025-03-13
- Last push
- 2026-08-04