execute_csharp_script_in_unity_editorLABSCO SUMMARY
The closed loop — act, observe, adapt — is what this is for.
Enter Play Mode with time paused, simulate an input, screenshot the Game View, read the console, decide the next move: that sequence is the reason to use it over a code generator that never sees the result. The cost is real — generated C# executes with the editor's privileges and reflection is available, so run it on a project you are willing to have changed.
What it is
A Unity Editor package that serves MCP from inside the editor. The agent executes generated C# in the editor's own context, reads the console back, runs tests, and can drive and observe a running game.
What you get
- execute_csharp_script_in_unity_editor — run generated C# with full access to UnityEngine and UnityEditor APIs and reflection; logs, errors and return values are captured automatically
- read_unity_console_logs — read the Editor console, with a configurable entry limit
- run_unity_tests — run tests through the Test Runner in EditMode, PlayMode or both, all of them or filtered by fully qualified name
- enter_play_mode — enter Play Mode with time paused, and return as soon as the transition is triggered
- play_unity_game — unpause, simulate the configured Input System actions, collect logs, then pause again
- get_unity_game_view_window_screenshot — capture the Game View as an image without routing through gameplay input
- exit_play_mode — leave Play Mode and unpause
- get_unity_info — the current project and the server's own settings
- Bundled agent skills that teach the execute-then-read-console loop and the play-and-observe loop
Requirements
Unity 2022.3 LTS or higher, and uv for the bundled stdio bridge. Install the package from its git URL through the Unity Package Manager; the editor auto-starts a file-backed transport and the client is pointed at the bridge with uv. Set an Input Actions asset in the server settings if you want gameplay simulation. The agent's C# runs with the same privileges as the Unity Editor process.
Setup effort
Follow the published steps — Install uv: Follow instructions at https://docs.astral.sh/uv/getting-started/installation
USE CASES
Building a scene by describing it
Execute C# that creates the GameObjects and assets, then read the console to confirm it worked.
Checking a change did not break anything
Run the EditMode and PlayMode tests, filtered to the area you touched.
Playtesting a mechanic
Enter Play Mode, simulate the input actions, capture the Game View, and adapt from what you see.
Diagnosing a runtime error
Read the console after the run and inspect live state by executing a query script.
Confirming which project you are attached to
Read the current project and server settings before making changes.
8 tools
Listed in project docs. Your client may show a different list.
read_unity_console_logsrun_unity_testsenter_play_modeplay_unity_gameget_unity_game_view_window_screenshotexit_play_modeget_unity_infoBEFORE YOU INSTALL
What to know first
Tools you get
8 tools named in the project's documentation.
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
Server setup
Install uv: Follow instructions at https://docs.astral.sh/uv/getting-started/installation
Install Unity Code MCP Server from Unity Package Manager. Open Window > Package Manager, click the + button, select Add package from git URL..., and enter:
https://github.com/Signal-Loop/UnityCodeMCPServer.git?path=Assets/Plugins/UnityCodeMcpServerConfigure the skill install location. Open Tools/UnityCodeMcpServer/Show or Create Settings, scroll to the Skills section, and confirm or change the install directory.
Open your Unity project. Unity auto-starts the file-backed transport and watches .unityCodeMcpServer/messages in the project root.
Configure your MCP client to run the bundled STDIO bridge (see config block).
MCP Clients
Any MCP client
{
"mcpServers": {
"unity-code-mcp-stdio": {
"command": "uv",
"args": [
"run",
"--directory",
"<YOUR_PATH_TO_UNITY_PROJECT_ASSETS_PLUGINS>",
"unity-code-mcp-stdio"
]
}
}
}