unity-local-mcp
Provides tools for controlling the Unity Editor: inspecting editor state, scene hierarchy, objects, and properties; creating, updating, deleting, coloring, and reparenting GameObjects; adding/removing components; setting serialized properties; creating prefabs; writing C# scripts and reading compile errors; accessing console logs; toggling play mode; and saving scenes.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@unity-local-mcp Create a red cube named Player at 0,1,0 and add a Rigidbody to it."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Connect the AI models running on your own computer to the Unity Editor. No cloud model, no API key, no per-token bill.
Quick start · Tools · Modest PCs · Security · Troubleshooting
✨ Features
Feature | What you get | |
🧠 | Built for local models | 18 tools with flat schemas, short replies, forgiving arguments and errors that say what to do next |
🔌 | Ollama and LM Studio | LM Studio connects over MCP. For Ollama, a built-in terminal chat does the MCP part |
🎮 | Real editor control | Create, move, color and inspect objects, components, properties and prefabs |
📝 | Scripts with feedback | The model writes C#, waits for the compile and reads the errors |
↩️ | Easy undo | Each scene edit is a single Ctrl+Z |
✋ | You stay in charge | The chat asks before every change. Read-only mode is one checkbox in Unity |
🔒 | Stays on your machine | The editor listens only on |
This is an early release (0.1). The whole chain has been tested on Windows with Unity 6000.6.8f1 and Ollama. CI runs the Python tests on Windows, macOS and Linux, but LM Studio and the Unity package on macOS or Linux have not been tested yet, soreports are welcome.
Related MCP server: MCP Unity Editor
🧩 How it works
flowchart LR
M["🧠 Your model<br/>Ollama or LM Studio"] <--> H["MCP host<br/>LM Studio, or the built-in chat"]
H <-- "MCP" --> S["unity-local-mcp<br/>Python server"]
S <-- "127.0.0.1" --> U["🎮 Unity Editor<br/>bridge package"]The repository holds both halves: the Unity package in unity-package/ and the Python server in src/.
🚀 Quick start
What you need
Unity 6
uv and Git (uv fetches Python for you)
A model that supports tool calling
1. Add the package to Unity
In Unity, open Window → Package Manager → + → Install package from git URL and paste:
https://github.com/isaiahagi/unity-local-mcp.git?path=/unity-packageThen open Window → Unity Local MCP. It should say Running on 127.0.0.1:8737 (the port moves up if that one is taken).
2. Connect your model
Ollama runs models but does not connect to MCP servers by itself, so this project includes a chat that does.
ollama pull qwen3:4b-instruct
uvx --from git+https://github.com/isaiahagi/unity-local-mcp unity-local-mcp chat --model qwen3:4b-instructA session looks like this:
you> Create a red cube named Player at position 0,1,0 and then add a Rigidbody to it.
.. waiting for the model
.. replied in 24s
-> create_object name=Player shape=cube position=0,1,0 color=red
Allow create_object? [y]es / [N]o / [a]lways for this tool: y
ok: {"created":"Player","position":"0,1,0", ...}
.. waiting for the model
.. replied in 6s
-> add_component target=Player component=Rigidbody
Allow add_component? [y]es / [N]o / [a]lways for this tool: y
ok: {"added":"Rigidbody","to":"Player"}Leave out --model to pick from your installed models that can call tools. Type /reset to clear the conversation and /exit to quit.
In LM Studio, open the Program tab in the right sidebar, then Install → Edit mcp.json.
Add the
unityserver (the Unity window has a button that copies this):
{
"mcpServers": {
"unity": {
"command": "uvx",
"args": ["--from", "git+https://github.com/isaiahagi/unity-local-mcp", "unity-local-mcp"]
}
}
}Load a tool-capable model, enable the
unityserver and ask it to change your scene.
If you prefer the terminal, start LM Studio's local server and use the built-in chat instead:
uvx --from git+https://github.com/isaiahagi/unity-local-mcp unity-local-mcp chat --provider lmstudio3. Check the connection
uvx --from git+https://github.com/isaiahagi/unity-local-mcp unity-local-mcp doctorIt reports whether Unity, Ollama and LM Studio can be reached.
🧰 Tools
Toolset | Tool | What it does |
|
| Unity version, scene, play mode, compile status, selection |
| Tree of GameObjects with their components | |
| Search by name, component or tag | |
| Transform, components and property values | |
|
| Empty, primitive, camera, light or prefab, with transform and color |
| Rename, move, rotate, scale, reparent, enable or tag | |
| Delete an object and its children | |
| Add a built-in component or your own script | |
| Remove a component | |
| Set a serialized property, including object and asset references | |
| Color an object, sprite or light | |
| Save a scene object as a prefab and link it | |
|
| Search project files |
| Read a text file | |
| Create or replace a C# file under | |
|
| Console messages and compile errors |
| Play, stop, pause | |
| Save the scene |
Objects are addressed by path, such as Enemies/Orc[1], which small models handle better than numeric IDs.
🐢 Running on a modest PC
You don't need a GPU, but you do need some patience. These are single measurements from an 8-core desktop CPU with 16 GB of RAM and no dedicated graphics card, with Unity open, running qwen3:4b-instruct (about 3 GB in memory) at --num-ctx 4096:
Request | Time |
First reply with every tool enabled (17 at the time), including loading the model | 55 s (40 s of it reading the prompt, mostly tool definitions) |
"Create a red cube named Player and add a Rigidbody", model already loaded | 38 s |
"Which objects are in the scene?" with read-only tools, including loading the model | 22 s |
To make it faster:
Use a small instruct model. Thinking models write a lot of text before they act. Choose an instruct variant, or try
--no-think.Offer fewer tools.
--toolsets inspect,editshrinks the first prompt from about 1,860 to 1,370 tokens.Use a smaller context with
--num-ctx 4096. The chat trims old results to fit.Keep the model loaded. Ollama unloads idle models. Set the
OLLAMA_KEEP_ALIVEenvironment variable (for example30m) before starting Ollama.Ask for one thing at a time, naming the objects you mean.
Watch it work. Replies appear as they are generated.
Allow more time with
--timeout 1200if the first words take longer than ten minutes.
⚙️ Options
Option | Applies to | Meaning |
|
| Expose only these groups |
|
| Expose only tools that change nothing |
|
| Choose an editor when several are open |
|
| Model server (default |
|
| Model to use |
|
| Model server on another address |
|
| LM Studio API token, or set |
|
| Context length (default 8192). For LM Studio, match the app's setting |
|
| Ollama thinking mode |
|
| Model steps allowed per request (default 12) |
|
| Longest silence from the model server (default 600) |
|
| Wait for whole replies instead of showing text as it arrives |
|
| Run one request and exit |
|
| Approve every change without asking |
The server also reads UNITY_MCP_TOOLSETS, UNITY_MCP_READ_ONLY and UNITY_MCP_PROJECT. In LM Studio, add options to args, for example "--toolsets", "inspect,edit".
🔒 Security
A script that a model writes runs with your user account's permissions once Unity compiles it. Read it before you approve it, and keep your project under version control.
The editor accepts connections from
127.0.0.1only. Every request needs a random token, stored in~/.unity-local-mcp/instances/while Unity is open. Programs running as your user can read it.Models can write only
.csscripts and.prefabfiles, underAssets/. A replaced file is first copied toLibrary/UnityLocalMcp/Backups/. Reading is limited to text files underAssets/andPackages/.Window → Unity Local MCP has switches for Read-only and Allow writing scripts. Unity enforces them whatever the client asks.
The built-in chat asks before each change unless you pass
--yesor answer always. In LM Studio, tool permissions are controlled by LM Studio.Undo covers scene edits. It does not cover files or prefab links: new scripts, prefabs and the color materials in
Assets/UnityLocalMcp/Materials/stay in your project.
🩺 Troubleshooting
Problem | Try this |
| Open the project and check Window → Unity Local MCP says Running. Then run |
| Close any open Unity dialog, and wait for imports or compiling to finish |
The Unity window is missing | Fix compile errors in the Console, and check the package appears in Package Manager |
| Start the Ollama app or run |
| Pick another model. |
The model describes steps but changes nothing | Name the objects you mean, or try a larger model |
The model forgets what you asked | Raise |
LM Studio cannot start the server | Replace |
Changes made while Unity is in Play mode are lost when it stops, as with manual edits.
🧪 Development
git clone https://github.com/isaiahagi/unity-local-mcp.git
cd unity-local-mcp
uv sync
uv run pytestThe tests use stand-ins for Unity and the model servers, so neither needs to be running.
To work on the Unity package, use Package Manager → + → Install package from disk and pick unity-package/package.json. To point LM Studio at your clone, use "command": "uv" with "args": ["--directory", "/path/to/unity-local-mcp", "run", "unity-local-mcp"].
🗺️ Roadmap
Test LM Studio, and the Unity package on macOS and Linux
Scene screenshots for vision models
Edit materials
Publish to PyPI
🤝 Contributing
Issues and pull requests are welcome. For a bug, include your Unity version, model, and the output of doctor.
⭐ Star history
If this saves you time, a star helps other people find it.
📄 License
Not affiliated with or endorsed by Unity Technologies, Ollama or LM Studio. Product names belong to their owners.
Available Tools
18 toolsadd_componentC
Add a component, e.g. Rigidbody, AudioSource or your own script class name.
Inputs: target (required), component (required).
create_objectB
Create a GameObject. position, rotation and scale are relative to the parent.
Inputs: name (required), color, scale, shape, +4 more.
create_prefabCDestructive
Save a scene object as a prefab file and link the object to it.
Inputs: path (required), target (required), overwrite.
delete_objectBDestructive
Delete an object and its children (undo with Ctrl+Z in Unity).
Inputs: target (required).
find_objectsBRead-only
Search scene objects by part of a name, component type and/or tag.
Inputs: tag, name, limit, component.
get_console_logsBRead-only
Recent Console messages and compile errors. Waits for compiling to finish.
Inputs: level, limit.
get_editor_stateARead-only
Unity version, open scene, play mode, compile status and selected objects.
Inputs: no named parameters.
get_hierarchyBRead-only
Tree of GameObjects in the open scene. Set parent to see only its children.
Inputs: depth, limit, parent.
get_objectBRead-only
One object's transform and components. Set component to list its property names and values.
Inputs: target (required), component.
list_assetsCRead-only
Search project files by name and type.
Inputs: type, limit, query, folder.
read_scriptCRead-only
Read a text file such as Assets/Scripts/Player.cs.
Inputs: path (required), max_lines, start_line.
remove_componentCDestructive
Remove a component from an object.
Inputs: target (required), component (required).
save_sceneC
Save the open scene.
Inputs: path.
set_colorC
Change the color of an object, sprite or light.
Inputs: color (required), target (required).
set_play_modeC
Start, stop or pause Play mode.
Inputs: action (required).
set_propertyC
Set one component property, e.g. component=Rigidbody property=mass value=5.
Inputs: value (required), target (required), property (required), component (required).
update_objectA
Rename, move, rotate, scale, reparent, enable/disable or tag an object. Only set what changes.
Inputs: target (required), tag, scale, active, +4 more.
write_scriptADestructive
Create a C# file under Assets/. Send the whole file. Set overwrite=true to replace one.
Inputs: path (required), contents (required), overwrite.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Most tools target a clearly distinct resource+action: hierarchy inspection (get_hierarchy, find_objects, get_object), mutation (create_object, update_object, delete_object), components (add_component, remove_component, set_property), and editor control (get_editor_state, set_play_mode, save_scene). The only soft overlaps are set_color versus set_property (color is a special case of a property) and update_object versus set_property for transform-like changes, but the descriptions steer an agent reasonably well.
Every tool follows a strict snake_case verb_noun pattern (delete_object, list_assets, get_editor_state, add_component, set_property, write_script, set_play_mode, save_scene). Verb choice is also semantically consistent (get_ for single-item reads, list_/find_ for searches, set_ for single-value mutations).
18 tools is at the upper end but each maps to a real Unity editor capability across scene hierarchy, components, properties, prefabs, scripts, console, and play mode. A few could theoretically be folded together (set_color into set_property), but nothing feels like filler.
Core lifecycle is well covered: inspect state/hierarchy, create/update/delete objects, add/remove components, edit properties, author scripts, read logs, drive play mode, and save the scene. Gaps are the prefab lifecycle (create_prefab exists but no instantiate/apply/revert) and asset management beyond listing (no create folder, delete, move, or import), which agents can partially work around but not fully.
Maintenance
Related MCP Connectors
Connect your AI assistant to Blender for 3D modeling, Geometry Nodes, materials, lighting, animation, rendering and export. Inspect real scenes and viewport images, refine the result and restore checkpoints. OAuth connects your chat to Blender Bridge Desktop on an online Windows 10/11 x64 computer running Blender 4.2+. The chat can run on another device. Requires an active Blender Bridge account; 7-day trial available. AI model access is separate.
Connect ChatGPT, Claude, Cursor or VS Code to your Windows PC: files, terminal, browser, apps.
Connect AI assistants to your approved computer for files, commands, browser and desktop tasks.
Connect your AI to your own devices, 3D printers, factory tools and a shared agent task pool.
Related MCP Servers
- AlicenseCqualityBmaintenanceIntegrates AI assistants with the Unity Editor for scene manipulation, asset management, and testing, plus Unity documentation search via RAG.8442 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Unity Editor, managing scenes, game objects, animations, materials, scripts, and more via natural language commands.2MIT
- AlicenseNot gradedqualityBmaintenanceEnables supported AI clients to connect to and automate the Unity Editor, covering scene and GameObject manipulation, asset and material operations, script creation and validation, testing, builds, screenshots, and editor-state inspection. It supports HTTP and stdio transports and ships client configuration helpers for Unity 2021.3+ on Windows, Linux, and macOS.MIT
- AlicenseNot gradedqualityBmaintenanceEnables an AI agent to compile code and read errors, build and modify scenes, inspect objects, take screenshots, and run tests directly inside the Unity Editor through a single C# package with no separate Python or Node process.1MIT