Let your local AI build.
Your model, your machine, your Unity Editor.
No cloud service, API key or per-token bill.
Install · Tools · Tested · Safety · Limitations
Unity Local MCP is an MCP server that puts models from Ollama and LM Studio to work inside the Unity Editor. They read the scene, build and change objects, write C# and check what Unity says about it.
A small local model has little room for error. A long tool list eats its context, one malformed argument stalls it, and Ollama cannot host MCP tools by itself.
Unity Local MCP is built around those limits:
- Compact tools. 18 of them, with short schemas, in four groups. Offer only the groups you need.
- Forgiving input.
[0, 1, 0]is accepted where"0,1,0"is expected, and mistakes come back as errors that say what to fix. - A host for Ollama. The built-in terminal chat connects your model to the tools, streams its replies and asks before every change.
- Answers from Unity. After writing a script, the model reads the console, which waits for compiling to finish.
- One undo per edit. Each scene change is a single Ctrl+Z, and one that fails halfway is rolled back.
- Closed to the network. The editor listens only on
127.0.0.1and requires a token.
What it is, honestly: a small model is not a Unity expert. It does best with one concrete step at a time and exact object names. It reads names, components and values, not pixels, so it cannot see your scene. Without a graphics card, expect to wait.
A real run with qwen3:4b-instruct on a PC with no dedicated graphics card:
> Create a red cube named Player at position 0,1,0,
then save it as a prefab at Assets/Prefabs/Player.prefab.
.. waiting for the model
.. replied in 41s
-> create_object name=Player shape=cube position=0,1,0 color=red
ok: {"created":"Player","position":"0,1,0", ...}
.. waiting for the model
.. replied in 6s
-> create_prefab target=Player path=Assets/Prefabs/Player.prefab
ok: {"prefab":"Assets/Prefabs/Player.prefab","linked":"Player"}
.. waiting for the model
A red cube named "Player" has been created at position (0,1,0)
and saved as a prefab at Assets/Prefabs/Player.prefab.
.. replied in 5s
That took 55 seconds, including loading the model. The run used --num-ctx 4096, --prompt and --yes. Without --yes, the chat stops before each change and asks:
Allow create_object? [y]es / [N]o / [a]lways for this tool:
You need Unity 6, uv, Git, and either Ollama or LM Studio 0.3.17 or newer. The model must support tool calling.
In Unity, open Window → Package Manager, select + → Install package from git URL and paste:
https://github.com/isaiahagi/unity-local-mcp.git?path=/unity-package
Then open Window → Unity Local MCP. It should read Running on 127.0.0.1:8737, or the next free port.
Ollama
ollama pull qwen3:4b-instruct
uvx --from git+https://github.com/isaiahagi/unity-local-mcp unity-local-mcp chat --model qwen3:4b-instructLeave out --model to pick from a list. /reset starts a new conversation and /exit quits.
LM Studio
Open the Program tab, select Install → Edit mcp.json and add the unity server. The Unity window has a button that copies this for you.
{
"mcpServers": {
"unity": {
"command": "uvx",
"args": ["--from", "git+https://github.com/isaiahagi/unity-local-mcp", "unity-local-mcp"]
}
}
}Load a model with tool calling and enable the server. To use the terminal chat instead, start LM Studio's local server and run:
uvx --from git+https://github.com/isaiahagi/unity-local-mcp unity-local-mcp chat --provider lmstudiouvx --from git+https://github.com/isaiahagi/unity-local-mcp unity-local-mcp doctordoctor reports whether Unity, Ollama and LM Studio are reachable, and which Ollama models support tools.
Then just ask:
What objects are in the scene?
Create a blue sphere named Ball above the floor and give it a Rigidbody.
Write a script that spins an object, then attach it to Ball.
Keep both pieces on the same version. Add the git URL in Package Manager again, then refresh the server:
uvx --refresh --from git+https://github.com/isaiahagi/unity-local-mcp unity-local-mcp --version| Toolset | Tool | What it does |
|---|---|---|
inspect |
get_editor_state() |
Unity version, scene, play mode, compile status and selection |
get_hierarchy(parent?, depth?) |
Tree of GameObjects and their components | |
find_objects(name?, component?, tag?) |
Searches the scene | |
get_object(target, component?) |
Transform and components, or one component's values | |
edit |
create_object(name, shape?, position?, ...) |
Empty, primitive, camera, light or prefab instance |
update_object(target, ...) |
Renames, moves, rotates, scales, reparents, enables or tags | |
delete_object(target) |
Deletes an object and its children | |
add_component(target, component) |
Adds a built-in component or one of your scripts | |
remove_component(target, component) |
Removes a component | |
set_property(target, component, property, value) |
Sets a serialized value or reference | |
set_color(target, color) |
Colors an object, sprite or light | |
create_prefab(target, path, overwrite?) |
Saves a scene object as a linked prefab | |
scripts |
list_assets(query?, type?, folder?) |
Searches project files |
read_script(path, start_line?, max_lines?) |
Reads a text file | |
write_script(path, contents, overwrite?) |
Creates or replaces a C# file under Assets/ |
|
editor |
get_console_logs(level?, limit?) |
Console messages and compile errors |
set_play_mode(action) |
Plays, stops, pauses and resumes | |
save_scene(path?) |
Saves the scene |
Objects are addressed by hierarchy path, such as Enemies/Orc[1], which small models handle better than numeric IDs.
| Option | Commands | Purpose |
|---|---|---|
--toolsets inspect,edit,scripts,editor |
serve, chat |
Offer only these groups of tools |
--read-only |
serve, chat |
Offer only tools that change nothing |
--project NAME |
serve, chat, doctor |
Choose an editor when several are open |
--provider ollama|lmstudio |
chat |
Model server, ollama by default |
--model NAME |
chat |
Model to use |
--url URL |
chat |
Model server at another address |
--api-key TOKEN |
chat |
LM Studio API token, or set LM_API_TOKEN |
--num-ctx N |
chat |
Context length, 8192 by default. For LM Studio, match the app's setting |
--think / --no-think |
chat |
Turn Ollama's thinking mode on or off |
--max-steps N |
chat |
Model steps allowed per request, 12 by default |
--timeout SECONDS |
chat |
Longest silence allowed from the model server, 600 by default |
--no-stream |
chat |
Show each reply only once it is complete |
--prompt TEXT |
chat |
Run one request and exit |
--yes |
chat |
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".
you type a request
│
host LM Studio, or the built-in chat ◄──► your model (Ollama or LM Studio)
│ MCP
server unity-local-mcp (Python): compact tools, forgiving arguments
│ 127.0.0.1, with a token
Unity Editor bridge package: runs each command on the editor's main thread
Windows 11, Ryzen 7 5700G, 16 GB RAM, no dedicated graphics card (November 2026).
| What | Result |
|---|---|
| Automated tests | 70, run in CI on Windows, macOS and Linux with Python 3.10 and 3.13 |
| Live checks in Unity | 144 of 144 passed, headless Unity 6000.6.8f1 |
| Red cube, saved as a prefab | 55 s, including loading the model |
| Red cube with a Rigidbody | 38 s, model already loaded |
| List the scene's objects, read-only tools | 22 s, including loading the model |
| First prompt | About 1,860 tokens with all tools, 1,370 with --toolsets inspect,edit |
Timings use qwen3:4b-instruct with --num-ctx 4096 and Unity running. Each is a single run, so read them as a smoke test rather than a benchmark. The last two timings were taken before create_prefab was added.
For faster replies:
- Choose a small instruct model. Thinking models write a lot before they act, so you can also try
--no-think. - Offer fewer tools with
--toolsets inspect,edit. - Use
--num-ctx 4096. The chat trims older results to fit. - Set
OLLAMA_KEEP_ALIVE(for example30m) before starting Ollama, so the model stays loaded. - Use
--timeout 1200if the first words take more than ten minutes.
Warning
Once Unity compiles a script written by a model, it runs with your user account's permissions. Review scripts before approving them, and keep your project under version control.
- Your data. With a local model, prompts, scene data and code stay on your machine. If you point
--urlat another server or choose a cloud-hosted model, they go there. This project collects no telemetry. - Local connections only. Every request to the editor needs a random token. It is stored in
~/.unity-local-mcp/instances/while Unity is open, where programs running as your user can read it. - Limited file access. Scripts, prefabs, scenes and color materials are written only inside
Assets/. Reading is limited to text files underAssets/andPackages/. A replaced script or prefab is first copied toLibrary/UnityLocalMcp/Backups/. - Enforced in Unity. Window → Unity Local MCP has Read-only and Allow writing scripts switches that apply to every client.
- Approval first. The built-in chat asks before each change unless you pass
--yesor answer always. LM Studio manages its own tool permissions. - Untrusted text. Object names, files and console messages reach the model as text, so a project you did not write can try to steer it. Keep approvals on.
- LM Studio has not been tested yet, and neither has the Unity package on macOS or Linux.
- Unity 6000.6.8f1 is the only editor version tested.
- The model cannot see the scene. There are no screenshots yet.
- There is no material editing beyond colors.
- Undo covers scene edits. New scripts, prefabs, prefab links and the color materials in
Assets/UnityLocalMcp/Materials/stay in your project. - As with manual edits, changes made in Play mode are lost when it stops.
- Small models sometimes describe steps without carrying them out.
Next up: testing LM Studio, macOS and Linux, scene screenshots for vision models, material editing and a PyPI release.
| Problem | What to try |
|---|---|
No running Unity Editor found |
Open your project, check that Window → Unity Local MCP shows Running, then run doctor |
Unity is busy or not answering |
Close any open Unity dialog and wait for imports or compiling to finish |
Unknown command |
Update the Unity package and the server to the same version |
| The Unity window is missing | Fix compile errors in the Console and check that the package appears in Package Manager |
Cannot reach Ollama |
Start the Ollama app or run ollama serve |
cannot call tools |
Choose another model. doctor lists the Ollama models that support tools |
| The model changes nothing | Name the objects you mean, or try a larger model |
| The model forgets your request | Raise --num-ctx, or use /reset between tasks |
| LM Studio cannot start the server | Replace uvx with its full path (where uvx on Windows, which uvx elsewhere) |
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. CI cannot compile the C# without a Unity license, so check package changes in the editor.
To work on the Unity package, use Package Manager → + → Install package from disk and select unity-package/package.json. To point LM Studio at your clone, set "command": "uv" and "args": ["--directory", "/path/to/unity-local-mcp", "run", "unity-local-mcp"].
src/unity_local_mcp/ the MCP server, the terminal chat and the command line
unity-package/ the editor bridge, written in C#
tests/ Python tests, with a stand-in for Unity
Bug reports, ideas and pull requests are welcome. With a bug report, include your Unity version, your model and the output of doctor. If the project is useful to you, a star helps others find it.
Not affiliated with or endorsed by Unity Technologies, Ollama or LM Studio. Product names belong to their owners.