Unity
In MifBridge 1.4.0 and later.
Unity support is in MifBridge 1.4.0 and stays in 1.5: a Unity editor package and the same MCP server that drives Unreal and Blender, so Claude or any MCP app can work in the Unity editor through typed calls that are checked before they run and read back after they write.
How it connects
your assistant ── MCP (stdio) ──► MCP server ── HTTP 127.0.0.1:8701-8716 ──► MifBridge package (Unity editor)
- The package is an editor-only package,
com.mifbridge.editor, compiled inside your project. It serves a local API on the first free port from 8701 to 8716, so two Unity projects can be open at once. It listens on127.0.0.1only, and refuses any request a web page could send. - The MCP server offers each operation as a
uy_*tool, in aunitypack of its own that no Unreal or Blender session loads. The package carries the server, so you need nothing else from MifBridge to use Unity. - A script reload does not lose a call. A call in flight during a domain reload gets a clean retry, and a write is never silently repeated or lost.
Requirements
- Unity 2022.3.62f3 or newer, Unity 6 included. Tested in batch mode on 2022.3.62f3, 6000.0.23f1, 6000.0.31f1, 6000.3.6f1 and 6000.5.0f1, on the Built-in pipeline, URP and HDRP. See the engine matrix.
- Windows. macOS and Linux are untested.
- Python 3.10 or newer, not the Microsoft Store one, because the MCP server is Python. Unity has no Python of its own.
- An MCP client: Claude Code, Cursor, Claude Desktop, Codex, or anything that speaks MCP over stdio.
Install
- Add the package. From Fab,
MifBridge_Unity.unitypackage: add it to your project from Fab, or use Assets ▸ Import Package ▸ Custom Package and pick the file. Bought on this site, the same file is inMifBridge-<version>-Unity.zipon your downloads page (and in Download all): unzip it, then import it the same way. From the tarball,com.mifbridge.editor.tgz: Window ▸ Package Manager ▸ + ▸ Install package from tarball, and keep the file where it is, since the project's manifest points at it. - Open the panel with Window ▸ MifBridge. It shows the port, the write mode and every call.
- Connect your client. On the panel's SETUP tab, press Set up on your client: Claude Code, Cursor, Claude Desktop or Codex. The first press downloads the server's Python packages, which can take a few minutes, and the card shows each step. It writes one entry named
mif-unity, keeps a backup of the config, and leaves every other entry alone. Nothing is written until the server has been started the way your client will start it and has reached this editor. - Restart the client.
For any other client, press Copy config and paste the entry into its config. The panel also has a Remove button per client.
First prompt
Call uy_status, then make a cube named Crate one meter above the origin.
The assistant will call uy_status() and uy_create_gameobject(name="Crate", primitive="Cube", position=[0, 1, 0]). In the default scratch mode this works in an untitled scene or one saved under Assets/_Mif. With one of your own scenes open, it is refused until you raise the mode; see the write modes below.
With more than one Unity project open, the assistant lists them with uy_instances() and picks one with uy_use(project=...). MIF_UNITY_PROJECT in the server's environment pins one at launch.
The assistant does not need every tool listed. A default session loads three tools, and find_tools("backend:unity material") searches the Unity tools alone. To load them all at start, set MIF_TOOL_PACKS to unity. See MCP Server.
What it covers
More than 400 tools, grouped by area:
- Daily editor work. GameObjects, components, prefabs and prefab variants, the asset database, importers, scenes, the console and the selection:
uy_get_object,uy_set_property,uy_add_component,uy_create_prefab,uy_edit_prefab, anduy_batchfor several calls in one. - Materials, lighting and rendering. Materials by render pipeline, which is read, never assumed: a shader for another pipeline, which would render magenta with no message, is refused. Lights, light probes, lightmap bakes, reflection probes, LOD groups, occlusion, URP and HDRP settings and Volumes (
uy_material_create,uy_light_create,uy_bake_lighting). - World. Terrain heights, trees, details, holes and layers, navigation meshes and agents (
uy_terrain_sample,uy_navmesh_bake), physics colliders, bodies, joints and queries, and Splines and ProBuilder shapes. - Animation. Animator controllers with layers, sub-state machines and blend trees in one description (
uy_anim_controller_build), clips, rigs, avatar masks, override controllers and constraints. Timelines, Cinemachine cameras and Recorder settings. - Effects, UI and media. Particle Systems, VFX Graph and Shader Graph, UI Toolkit and uGUI with TextMeshPro, audio, video, sprites and tilemaps.
- Project and builds. Tags, layers and the collision matrix, PlayerSettings and defines, build profiles, AssetBundles,
uy_build_player, the test runner (uy_test_run), Play mode (uy_play), profiling, presets and Unity Search.
A capture of a camera, uy_capture_camera, lets the assistant look at what it built. uy_describe_endpoint says what a tool accepts before the call, and uy_call_log reads the call journal.
From Blender. mif_send_to_unity exports Blender objects and their textures into Assets/_Mif/<name>/ of the project, refreshes the editor and reads the import back: rotation 0, scale 1 and the mesh's height against Blender's. Blender and Unity must share a disk. See MifBlender.
Write modes
Each program MifBridge drives has the same three modes, and Unity starts in scratch.
| Mode | The assistant can |
|---|---|
| read | Read anything. Change nothing. |
| scratch | Read anything. Write only under Assets/_Mif, and edit only an untitled scene or a scene saved there. |
| full | Write anywhere in the project. |
You change the mode in the MifBridge panel. The assistant can lower it but never raise it, and no tool sets it. A refusal names the rule that stopped it and how to unlock it. More in Safety and Write Modes.
Other guards:
- A write saves the files it changed and no other, so an unsaved edit of yours elsewhere in the project stays unsaved.
- Scratch makes no code. Outside full mode, nothing creates, moves or imports a file Unity compiles or loads, such as a
.cs,.asmdefor.dll. - Code and packages are off.
uy_run_csharp, which runs C# in the editor, needsMIF_BRIDGE_ALLOW_RUN_CSHARP=1at editor launch and full mode. Adding and removing packages needsMIF_BRIDGE_ALLOW_PACKAGES=1and full mode. There is no menu-item tool and no script-writing tool. - Writes during Play mode are refused, because they would vanish on exit.
Limits
- Every test suite runs in batch mode on Windows, on empty projects plus one populated URP and HDRP project. macOS and Linux have never run one.
- An agent with its own file-editing tools can still write a script and refresh the editor. That is outside the bridge, and
uy_self_auditsays so plainly. - While your project has a compile error, Unity does not load the package. The client says so at once, with the file and line, and the bridge comes up by itself once the error is fixed.
- Player builds are tested with Mono. No test machine has the Windows IL2CPP module.
Related
- Installation for the Unreal plugin and Blender add-on.
- MCP Server for packs and client settings.
- Engine matrix for every supported version.