unity
Allows AI agents to drive the Unity Editor, including scene management, object manipulation, component editing, asset operations, prefab handling, console logging, play mode control, and test execution.
Click on "Install 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., "@unitycompile the current scripts"
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.
AgentBridge
AgentBridge is an MCP server for the Unity Editor.
Install the package, run dffrnt-agent serve, and your LLM can inspect scenes, write scripts, run tests, and control the Editor from the chat.
Why AgentBridge
Most Unity MCP tools embed a WebSocket or TCP server inside the Unity process. That approach breaks on every domain reload. It needs background threads to work around Unity's single-threaded API. It also requires a free port on every machine.
AgentBridge uses a file queue instead:
Commands land in
Temp/agent/requests/and run on Unity's main thread. No sockets, no marshalling, no port conflicts.A heartbeat file (
Temp/agent/session.json) tells the agent whether Unity is idle, compiling, or in play mode. The agent reads this file before each command.Domain reloads are transparent. The queue stays on disk and Unity replays any pending request after reload.
New commands need only one
IAgentCommandclass in any Editor assembly. No changes to the bridge or the Go CLI are needed.
Related MCP server: MCP For Unity
Requirements
Unity 6000.0 or later
Go 1.23 or later (only to build from source)
Quickstart
1. Install the package
Go to Window > Package Manager > + > Add package from git URL and enter:
https://github.com/simonwittber/AgentBridge.git?path=/AgentBridgeFor a specific version:
https://github.com/simonwittber/AgentBridge.git?path=/AgentBridge#v0.3.02. Get the CLI
Download a pre-built binary from the latest release and place it on your PATH.
To build from source:
cd AgentBridge/Harness~/dffrnt-agent
go build -o dffrnt-agent . # macOS / Linux
go build -o dffrnt-agent.exe . # Windows3. Configure Claude Code
Add to .claude/settings.json inside your Unity project:
{
"mcpServers": {
"unity": {
"command": "dffrnt-agent",
"args": ["serve"]
}
}
}Run dffrnt-agent from your Unity project root, or pass --project <path> to set the project directory.
4. Open Unity and verify
Open or focus your Unity project.
The unity MCP server appears in /mcp in Claude Code with all bridge commands available as tools.
5. Check status
dffrnt-agent statusExpected output:
{
"cmd": "status",
"status": "ok",
"uptime_s": 42.3,
"busy": false
}Built-in commands
Core
Command | Description |
| Bridge liveness, uptime, queue depth |
| Request script compilation; returns errors and warnings |
| Trigger |
| List all available commands and their arguments |
| Full description and argument details for a named command |
| Bring the Unity Editor window to the foreground |
Scene
Command | Description |
| Name, path, dirty flag, root count |
| Open a scene by asset path |
| Save the active scene |
| Create a new empty or default scene |
Hierarchy and objects
Command | Description |
| Scene tree as JSON (configurable depth) |
| Find a GameObject by path; returns components |
| Find all objects with a given component type |
| Create a GameObject or primitive |
| Delete a GameObject |
| Activate or deactivate a GameObject |
| Rename a GameObject |
| Select one or more objects in the Editor |
| Duplicate a GameObject |
| Move a GameObject to a new parent |
| Set position, rotation, and scale in one call |
Components and assets
Command | Description |
| Get all serialized fields of a component |
| Set a serialized field on a component |
| Add a component by type name |
| Open a prefab in prefab stage |
| Save and exit the current prefab stage |
| GUID and importer settings for an asset |
| Set an importer field and reimport |
| Find assets by type or label filter |
| Create a new folder or material asset |
| Delete an asset |
| Move an asset to a new path |
| Copy an asset to a new path |
| Write a text file under |
| Get all shader properties of a material |
| Set a shader property on a material |
| Get a named serialized field from a ScriptableObject asset |
| Set a named serialized field on a ScriptableObject asset and save |
Editor and console
Command | Description |
| All Unity console messages (ring buffer, newest first) |
| Enter play mode |
| Exit play mode |
| Invoke a Unity menu item by path |
| Run edit-mode tests; returns pass/fail/skip |
| Run play-mode tests; returns pass/fail/skip |
| Capture the current view to PNG; returns immediately and fires a |
| Compile and run a C# snippet in the Editor |
| Return the currently selected GameObjects and assets |
| Perform an undo operation |
| Perform a redo operation |
| Generate a UUID v4 |
Profiler
Command | Description |
| Begin recording named |
| Stop the current recording session |
| Stop and dispose all recorders |
| Return summary stats (and optionally raw values) for recorded markers |
Player settings and editor prefs
Command | Description |
| Return current PlayerSettings values |
| Set a PlayerSettings value by key |
| Get a value from EditorPrefs |
| Set a value in EditorPrefs |
Tags and layers
Command | Description |
| Return all tags and layers defined in the project |
| Add a new tag |
| Add a new layer |
Packages
Command | Description |
| List installed Unity packages |
| Add or update a package by identifier |
| Remove an installed package |
| Search the Unity Package Registry |
Reflection
Command | Description |
| List loaded assemblies |
| Search for public types by name or namespace |
| List public members of a named type |
Build
Command | Description |
| Build the Unity player for the specified target |
Adding custom commands
Implement IAgentCommand in any Editor assembly:
using System.Text.Json.Nodes;
using LLMDevTools;
public class MyCommand : IAgentCommand
{
public string Cmd => "my_cmd";
public string Description => "Does something useful.";
public ArgSpec[] Args => new[]
{
new ArgSpec("message", "string", "", "Text to log"),
};
public JsonObject Execute(string uid, string requestJson)
{
var resp = AgentBridge.MakeResponse(uid, Cmd, "ok");
resp["echoed"] = requestJson;
return resp;
}
}AgentBridge discovers the class automatically on the next domain reload.
No [InitializeOnLoad] attribute or manual registration call is needed.
Protocol
Commands are JSON objects written to Temp/agent/requests/<timestamp>-<uid>.json:
{"uid":"a1b2c3d4","cmd":"compile","agent_id":"agent-1"}Responses appear in Temp/agent/responses/<uid>.json:
{"uid":"a1b2c3d4","cmd":"compile","status":"ok","errors":[],"warnings":[]}Unity also writes Temp/agent/session.json every 5 seconds:
{
"pid": 12345,
"state": "idle",
"active_scene": "Main",
"play_mode": false,
"compile_errors": 0,
"agent_id": "",
"written_at": 1749123456789
}dffrnt-agent reads this file to check that Unity is alive before each command.
agent_id is empty when no command is active and contains the current agent identifier when a command runs.
Notifications
Unity writes compiler and asset-import lifecycle events to Temp/agent/notifications/<ts>-<uid>.json.
In serve mode, dffrnt-agent polls this directory every 500 ms and forwards each event to MCP clients as a notifications/message.
Example notification file:
{"type":"compile_finished","data":{"error_count":0},"written_at":1749123456789}Event types: compile_started, compile_finished, compile_failure, refresh_started, refresh_finished, play_mode_entered, play_mode_exited, scene_opened, screenshot_ready.
Commands that trigger async state changes note their notifications in the tool description.
Testing
Build and install the dffrnt-agent binary, open AgentBridge/Example~ in Unity, then:
cd AgentBridge/Harness~/dffrnt-agent
go test -timeout 300sThe tests run against a live Unity session over the MCP protocol. They skip automatically if Unity is not running or the session file is missing.
LLM Agent Log window
Open via Window > General > LLM Agent Log. This window shows a live view of all commands and responses: green for success, red for error.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-quality-maintenanceEnables AI assistants to interact with Unity Editor through the Model Context Protocol, allowing natural language control of Unity projects including scene manipulation, GameObject creation, component updates, package management, and test execution.Last updated
- Flicense-qualityCmaintenanceEnables AI clients to interact with and control the Unity Editor through a Python MCP server bridge, allowing natural language-based Unity project manipulation.Last updated
- Alicense-qualityCmaintenanceEnables AI agents to control the Unity Editor through MCP, allowing scene building, runtime scripting, visual QA, and more.Last updated4Apache 2.0
- Flicense-qualityDmaintenanceThis server enables AI assistants to directly control the Unity Editor via MCP, supporting scene manipulation, script editing, level generation, monetization management, build pipelines, and more—all with zero external dependencies.Last updated
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…
Generate, edit, and deploy immersive 3D/WebGL web projects from any MCP assistant.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/simonwittber/AgentBridge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server