README.md
| English | 简体中文 |
|---|
Create your Unity apps with LLMs! MCP for Unity bridges AI assistants (Claude, Claude Code, Cursor, VS Code, etc.) with your Unity Editor via the Model Context Protocol. Give your LLM the tools to manage assets, control scenes, edit scripts, and automate tasks.
<details> <summary><strong>Recent Updates</strong></summary>manage_profiler tool (14 actions): Profiler session control (start/stop/status/set areas), frame timing and counter reads, object memory queries, memory snapshots (take/list/compare via com.unity.memoryprofiler), and Frame Debugger (enable/disable/get events). Group: profiling.manage_physics tool (21 actions): physics settings, layer collision matrix, physics materials, joints (5 3D + 9 2D types), queries (raycast, raycast_all, linecast, shapecast, overlap), force application (AddForce/AddTorque/AddExplosionForce), rigidbody configuration, scene-wide validation, and edit-mode simulation. Full 3D and 2D support.manage_editor gains undo/redo actions. manage_scene gains multi-scene editing (additive load, close, set active, move GO between scenes), scene templates (3d_basic, 2d_basic, etc.), and scene validation with auto-repair. New manage_build tool: trigger player builds, switch platforms, configure player settings, manage build scenes and profiles (Unity 6+), run batch builds across multiple platforms, and async job tracking with polling. New MaxPollSeconds infrastructure for long-running tool operations.unity_reflect and unity_docs tools for API verification: inspect live C# APIs via reflection and fetch official Unity documentation (ScriptReference, Manual, package docs). New manage_packages tool: install, remove, search, and manage Unity packages and scoped registries. Includes input validation, dependency checks on removal, and git URL warnings.manage_graphics tool (33 actions): volume/post-processing, light baking, rendering stats, pipeline settings, URP renderer features. 3 new resources: volumes, rendering_stats, renderer_features.manage_camera tool with Cinemachine support (presets, priority, noise, blending, extensions), cameras resource, priority persistence fix via SerializedProperty.manage_tools, skill sync window, multi-view screenshot, one-click Roslyn installer, Qwen Code & Gemini CLI clients, ProBuilder mesh editing via manage_probuilder.manage_animation tool, Cline client support, stale connection detection, tool state persistence across reloads.batch_execute limits, tool filtering by session state, IPv6/IPv4 loopback fixes.In Unity: Window > Package Manager > + > Add package from git URL...
[!TIP]
texthttps://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#main
Want the latest beta? Use the beta branch:
https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#beta
Unity Asset Store:
Add to My Assets, then import via Window > Package ManagerOpenUPM:
openupm add com.coplaydev.unity-mcp
Window > MCP for Unitylocalhost:8080)That's it! Try a prompt like: "Create a red, blue and yellow cube" or "Build a simple player controller"
apply_text_edits • batch_execute • create_script • debug_request_context • delete_script • execute_custom_tool • execute_menu_item • find_gameobjects • find_in_file • get_sha • get_test_job • manage_animation • manage_asset • manage_build • manage_camera • manage_components • manage_editor • manage_gameobject • manage_graphics • manage_material • manage_packages • manage_physics • manage_prefabs • manage_probuilder • manage_profiler • manage_scene • manage_script • manage_script_capabilities • manage_scriptable_object • manage_shader • manage_texture • manage_tools • manage_ui • manage_vfx • read_console • refresh_unity • run_tests • script_apply_edits • set_active_instance • unity_docs • unity_reflect • validate_script
cameras • custom_tools • renderer_features • rendering_stats • volumes • editor_active_tool • editor_prefab_stage • editor_selection • editor_state • editor_windows • gameobject • gameobject_api • gameobject_component • gameobject_components • get_tests • get_tests_for_mode • menu_items • prefab_api • prefab_hierarchy • prefab_info • project_info • project_layers • project_tags • tool_groups • unity_instances
Performance Tip: Use batch_execute for multiple operations — it's 10-100x faster than individual calls!
If auto-setup doesn't work, add this to your MCP client's config file:
HTTP (default — works with Claude Desktop, Cursor, Windsurf):
{
"mcpServers": {
"unityMCP": {
"url": "http://localhost:8080/mcp"
}
}
}
VS Code:
{
"servers": {
"unityMCP": {
"type": "http",
"url": "http://localhost:8080/mcp"
}
}
}
macOS/Linux:
{
"mcpServers": {
"unityMCP": {
"command": "uvx",
"args": ["--from", "mcpforunityserver", "mcp-for-unity", "--transport", "stdio"]
}
}
}
Windows:
{
"mcpServers": {
"unityMCP": {
"command": "C:/Users/YOUR_USERNAME/AppData/Local/Microsoft/WinGet/Links/uvx.exe",
"args": ["--from", "mcpforunityserver", "mcp-for-unity", "--transport", "stdio"]
}
}
}
MCP for Unity supports multiple Unity Editor instances. To target a specific one:
unity_instances resourceset_active_instance with the Name@hash (e.g., MyProject@abc123)For Strict validation that catches undefined namespaces, types, and methods:
Window > NuGet Package Manager → Install Microsoft.CodeAnalysis v5.0SQLitePCLRaw.core and SQLitePCLRaw.bundle_e_sqlite3 v3.0.2USE_ROSLYN to Player Settings > Scripting Define SymbolsOpen Window > MCP for Unity, scroll to the Runtime Code Execution (Roslyn) section in the Scripts/Validation tab, and click Install Roslyn DLLs. This downloads the required NuGet packages and places the DLLs in Assets/Plugins/Roslyn/ automatically.
You can also run it from the menu: Window > MCP For Unity > Install Roslyn DLLs.
Microsoft.CodeAnalysis.CSharp.dll and dependencies from NuGetAssets/Plugins/Roslyn/ folderUSE_ROSLYN to Scripting Define SymbolsWindow > MCP for Unity status, restart Unityuv --version works, check the terminal for errorsDetailed setup guides:
Still stuck? Open an Issue or Join Discord
</details> <details> <summary><strong>Contributing</strong></summary>See README-DEV.md for development setup. For custom tools, see CUSTOM_TOOLS.md.
feature/your-idea) → Make changes → PRAnonymous, privacy-focused telemetry (no code, no project names, no personal data). Opt out with DISABLE_TELEMETRY=true. See TELEMETRY.md.
Network defaults are intentionally fail-closed:
127.0.0.1, localhost, ::1).0.0.0.0, ::) require explicit opt-in in Advanced Settings via Allow LAN Bind (HTTP Local).https:// by default.http:// for remote endpoints requires explicit opt-in via Allow Insecure Remote HTTP.License: MIT — See LICENSE | Need help? Discord | Issues
@inproceedings{10.1145/3757376.3771417,
author = {Wu, Shutong and Barnett, Justin P.},
title = {MCP-Unity: Protocol-Driven Framework for Interactive 3D Authoring},
year = {2025},
isbn = {9798400721366},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3757376.3771417},
doi = {10.1145/3757376.3771417},
series = {SA Technical Communications '25}
}
Coplay offers 3 AI tools for Unity:
(These tools have different tech stacks. See this blog post comparing Coplay to MCP for Unity.)
This project is a free and open-source tool for the Unity Editor, and is not affiliated with Unity Technologies.