
Patina Unity MCP
io.github.taygunsavas由 GitHub 账号 taygunsavas 发布v1.2.2更新于 Oct 24, 2026
Control the Unity Editor from MCP hosts through a local Rust server and C# Unity bridge.
概览
将 AI 助手连接到 Unity 编辑器,使其能查看场景、创建和编辑 GameObject、预制体、资源与脚本,并读取控制台。
- 可以做什么
- 查看与管理场景:读取层级和场景信息,打开、保存和新建场景,按标签、组件、层、路径或组合条件查找 GameObject,并获取场景统计和校验缺失脚本、失效引用。创建、删除、复制、改父级和变换 GameObject,添加、移除组件并设置其属性,支持对多个对象批量操作。处理预制体:创建、实例化、查看、解包、应用或还原覆盖,编辑预制体资源,打开或关闭预制体编辑阶段。管理资源与材质:搜索资源数据库,新建文件夹,移动、重命名、删除、设置标签和刷新资源,创建和编辑材质及着色器属性。编写与编译脚本:按模板创建 C# 脚本,读取脚本内容,触发重编译并获取编译错误,列出程序集类型,读写 ScriptableObject 字段。控制编辑器与构建:读取编辑器状态和项目设置,进入或退出播放模式,执行菜单项,管理撤销与重做,读写构建设置和播放器设置,运行测试并读取结果,查看动画信息。
- 适用场景
- 适合让助手搭建或检查 Unity 场景与预制体、配置组件和材质、编写并编译 C# 脚本、运行测试,或读取编译器和控制台输出,而无需手动切换到编辑器操作。
- 运行要求
- 在用户机器上以本地进程运行,仅支持桌面端。需要 Unity 6(6000.3 LTS 或更高版本)并安装 Patina UPM 包、受支持的 MCP 主机,并在 Unity 窗口中执行一键设置。包内附带预编译的 Rust 二进制文件;仅贡献者需要 Rust 1.75+。通过本地回环 TCP 桥接通信。
安装
在 SourceWeft 中
- 打开 控制台中的 Patina Unity MCP,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Patina
[npm version] [MCP Registry] [Glama MCP server] [Indexed on TensorBlock MCP Index] [License: MIT]
Control the Unity Editor from any MCP host. One package install, one click, and your AI assistant can see your scene, create objects, and talk to the console.
Patina is a Rust MCP server paired with a C# Unity bridge. It connects your favorite AI coding tool directly to the Unity Editor over a local TCP channel, with zero manual config.
Why Patina?
- One-click setup. Install the UPM package, click a button, and every supported host is configured automatically.
- No Rust required. Release packages ship pre-built binaries for Windows, Linux, and macOS. Just install and go.
- Built for speed. The Rust sidecar keeps the MCP layer fast and lightweight while Unity stays on the main thread.
- Multi-host. Works with Claude Code, Cursor, VS Code, Gemini CLI, JetBrains Rider, Codex CLI, and more.
How It Works
The host launches the Rust binary over stdio MCP. The Rust server forwards tool calls into Unity through a local loopback TCP bridge. Unity executes them on the main thread and returns the result.
Quick Start
1. Install the Unity package
In Unity, open Project Settings > Package Manager, add a scoped registry, then install the package by name.
Scoped registry:
Then open the Package Manager (Window > Package Manager), click the + icon in the top left, select Add package by name..., and enter:
Registry releases are signed during the release workflow for Unity Package Manager verification.
Alternatively, open the Package Manager, click the + icon, select Add package from git URL..., and enter:
Patina is distributed as a complete Unity package artifact with the editor code, native Rust runtime binaries under Plugins/<platform>/, and the Unity metadata needed for import. End users do not need the Rust toolchain or a Git checkout of this repository.
2. Run One-Click Setup
Open Window > Patina Unity MCP and click One-Click Setup.
The setup flow verifies the binary, starts the Unity bridge, auto-configures every detected host, replaces stale entries, and shows restart guidance where needed.
Patina writes host configs to a stable user-level runtime path instead of a per-project Unity package cache path. When the package is updated, the Unity editor package refreshes that managed runtime automatically, so supported MCP hosts do not need to be reconfigured just because the package cache path changed.
3. Start building
Open your MCP host and try:
- "Log hello to Unity console"
- "Show me the scene hierarchy"
- "Create a cube at position 0, 2, 0"
Available Capabilities
Patina keeps the advertised MCP surface compact so hosts do not need to load every Unity command schema into context. Agents should use:
The 87 commands below are available through patina_capabilities and patina_call.
Scene
GameObjects
Components & Properties
Batch Operations
Prefabs
After saving and reimporting, edit_prefab_asset runs OnValidate by reflection on the saved asset for every component of each type touched by add_component or set_field on the touched GameObject, then saves again, so state computed there (such as Netcode NetworkObject hashes) is persisted. If an OnValidate throws, the command still succeeds and the result gains a warnings string array listing components whose OnValidate was skipped or threw, including when the saved prefab cannot be loaded or a tracked path or component cannot be resolved.
Example: Set GameObject-level values.
set_field targets the GameObject itself when component_type is omitted, "GameObject" or "UnityEngine.GameObject". Supported field_name values are layer (index 0-31 or layer name), tag, isStatic, name and activeSelf (the prefab root name follows the asset file name, so name on the root is rejected). add_child also accepts optional layer, tag and is_static:
Example: Set a component reference within a prefab.
To point a serialized field at another component inside the same prefab, pass an edit_prefab_asset action with set_field and an object reference value. The transform_path inside value is resolved against the prefab root, not against the action's own transform_path:
Assets
Materials
Scripts
Scriptable Objects
Validation & Health
Search & Query
Console
Editor State & Control
Undo
Build & Player Settings
Test Runner
Animation
Supported Hosts
The setup window also detects stale entries, missing hosts, and provides a clean Remove Patina From Hosts action.
Troubleshooting
If a Patina call reports EDITOR_BLOCKED, or mentions that Unity may be waiting on a modal dialog, check the Unity Editor for a save-changes prompt or other blocking popup. Patina cannot safely run queued editor commands while Unity is waiting for user input. Resolve the Unity prompt, then retry the MCP command or run patina_health with {"include_unity_state": true}.
Prefab Stage Save Dialogs
Patina addresses dirty prefab stages by responding to the save question programmatically rather than blocking on a modal. When you call close_prefab_stage, the save_changes parameter directly determines the outcome: true saves, false (default) discards changes. This applies only to that command call and does not alter Editor behavior when a human is working manually.
Once a modal dialog appears, Unity's main thread is blocked and remains blocked until a human closes it. Every queued command processes through the same blocked thread, so prevention is the only real solution. For agent-written editor scripts, the safe pattern is to write prefabs using PrefabUtility.LoadPrefabContents, apply changes to a SerializedObject, save with PrefabUtility.SaveAsPrefabAsset, then PrefabUtility.UnloadPrefabContents. This approach never opens a prefab stage. If a stage must be opened, close it with close_prefab_stage. Leaving a dirty stage and manually calling StageUtility.GoToMainStage() will lock the Editor.
Unity offers a startup flag, -automated, which disables dialogs process-wide. While this may be suitable for an Editor driven entirely by agents, it creates problems in hybrid workflows where a human and agent share the same Editor: unsaved changes trigger no prompts, and some operations silently cancel. Patina does not require -automated. Per-command dialog answering works reliably without it and behaves correctly even in an Editor opened with -automated.
To check the current Editor state and dialog automation status, call patina_health and examine broker.sessions[].automated in the default output, or isAutomatedMode and dialogAutomationAvailable when passing {"include_unity_state": true}.
Roadmap
Local Development
Contributor source checkout
Use this when you are editing unity-package/ or rust-server/ directly from the repository:
- Point Unity at the local package checkout.
file:<your-clone-path>/unity-package
- Build the Rust server.
- Publish the current binary into the local development runtime path.
- In Unity, open Window > Patina Unity MCP, enable Use Local Runtime (Contributor), and click One-Click Setup.
This writes host configs against the local dev runtime instead of the managed packaged runtime. Re-run One-Click Setup after every new cargo build --release + publish-dev-runtime pass, and use Remove Patina From Hosts before switching back to the packaged flow.
Stage a local UPM test package
Use this when you want to test the package as it will be published, not the raw source checkout:
Then add the staged package from disk in Unity:
dist/local-upm/com.taygunsavas.patina-unity-mcp/package.json
Prefer the staged local package when you are validating package layout, import behavior, or release packaging. Prefer the source checkout path when you are actively editing source and want the fastest edit-build-run loop.
See CONTRIBUTING.md for the full contributor workflow.
Community and Contributing
- Start with CONTRIBUTING.md for the local development loop, validation expectations, and pull request guidance.
- Use GitHub issue forms for reproducible bugs, feature proposals, and usage questions so maintainers get the context they need.
- Read .github/SUPPORT.md before opening a help request.
- Read .github/SECURITY.md for private vulnerability reporting.
- Read .github/CODE_OF_CONDUCT.md before participating in issues and pull requests.
- Pull requests targeting
mainare expected to pass CI and go through CODEOWNERS + Copilot review once repository rules are enabled.
Requirements
- Unity 6 (6000.3 LTS+)
- A supported MCP host
- Rust 1.75+ (contributors only)
License
来源:README.md,提交 b98b9ee
工具
0版本历史
2- v1.2.2最新Oct 12, 2026
- v1.2.1Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分