# Unity MCP — Control Unity Editor from Agents > Unity MCP bridges MCP clients to your Unity Editor so assistants can manage scenes, assets, scripts, and builds via tools instead of manual clicking. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use 1. In Unity Package Manager: “Add package from git URL…” - `https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#beta` 2. Open: `Window > MCP for Unity` and run the setup. 3. Add the HTTP config (default): ```json { "mcpServers": { "unityMCP": { "url": "http://localhost:8080/mcp" } } } ``` 4. Ask your client to list `unity_instances` and try one tool call. ## Intro Unity MCP bridges MCP clients to your Unity Editor so assistants can manage scenes, assets, scripts, and builds via tools instead of manual clicking. - **Best for:** Unity teams who want LLMs to automate editor workflows (scene edits, package management, build pipelines) - **Works with:** Unity 2021.3+ editor, Python 3.10+, MCP clients (Claude Desktop/Code, Cursor, VS Code, etc.) - **Setup time:** 20 minutes ## Practical Notes - Release notes in README show versioned tool growth (for example v9.6.1 adds build tooling and multi-scene ops) - Performance tip: README claims `batch_execute` can be 10–100× faster than individual calls ## Treat Unity as an API, Not a GUI The win is not “an LLM can click buttons” — it’s that your editor workflow becomes a **repeatable tool contract**: - Use `batch_execute` for multi-step operations so you get one atomic-ish plan and fewer round-trips. - Route requests to the correct Unity instance when you have multiple editors open. - Keep transports local-first (loopback) unless you truly need LAN binding. Once connected, you can standardize tasks: - “Create a new scene from template, add a prefab, set lighting defaults” - “Scan packages, add a scoped registry, then validate compile” - “Build a player with a known profile and export artifacts” That makes AI-assisted Unity work auditable: every change is a tool call you can reproduce. ### FAQ **Q: Do I need Python?** A: Yes. The README lists Python 3.10+ and uv as requirements for the bridge/server pieces. **Q: Which transport should I start with?** A: HTTP localhost is the default and works with many clients; stdio is also available. **Q: How do I speed up multi-step edits?** A: Use `batch_execute` (README claims 10–100× faster). ## Source & Thanks > Source: https://github.com/CoplayDev/unity-mcp > License: MIT > GitHub stars: 9,486 · forks: 1,074 --- ## 快速使用 1. Unity Package Manager:Add package from git URL… - `https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#beta` 2. 打开:`Window > MCP for Unity` 并完成一键 setup。 3. 默认 HTTP 配置: ```json { "mcpServers": { "unityMCP": { "url": "http://localhost:8080/mcp" } } } ``` 4. 让客户端读取 `unity_instances`,然后尝试调用一个 tool。 ## 简介 Unity MCP 把 Unity Editor 变成 MCP 工具端:让助手通过 tools 管理场景/资源/脚本/构建,把重复点点点变成可复用指令,并把每次编辑沉淀为可追溯的工具调用记录。 - **适合谁:** 希望用 LLM 自动化 Unity 编辑器流程(改场景、管包、跑构建)的团队 - **可搭配:** Unity 2021.3+、Python 3.10+、MCP 客户端(Claude Desktop/Code、Cursor、VS Code 等) - **准备时间:** 20 分钟 ## 实战建议 - README 的版本记录显示工具集持续扩展(例如 v9.6.1 增加 build 工具与多场景编辑) - 性能建议:README 提到 `batch_execute` 比逐个调用快 10–100× ## 把 Unity 当 API,而不是 GUI 真正的收益不是“LLM 会点按钮”,而是把编辑器流程变成**可重复的工具契约**: - 多步骤操作尽量用 `batch_execute` 聚合,减少来回与状态漂移。 - 多 Unity 实例时明确路由到正确实例(避免改错工程)。 - 传输优先本机回环(loopback),除非必要不要开放到 LAN。 连通后你可以把任务标准化: - “按模板建新场景 → 放 prefab → 设置光照默认值” - “扫描包 → 加 scoped registry → 校验编译” - “用固定 profile 构建 player 并导出产物” 这样 AI 辅助 Unity 才可审计:每次改动都是可复现的 tool call。 ### FAQ **必须装 Python 吗?** 答:需要,README 要求 Python 3.10+(并建议使用 uv)。 **优先用哪种传输?** 答:默认是本机 HTTP(兼容性好);也支持 stdio。 **多步骤操作怎么更快?** 答:用 `batch_execute`(README 提到可提升 10–100×)。 ## 来源与感谢 > Source: https://github.com/CoplayDev/unity-mcp > License: MIT > GitHub stars: 9,486 · forks: 1,074 --- Source: https://tokrepo.com/en/workflows/unity-mcp-control-unity-editor-from-agents Author: MCP Hub