UniCortex
Provides tools for controlling the Unity Editor remotely, including scene manipulation, GameObject management, component editing, prefab operations, test running, and more.
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., "@UniCortexcreate a new GameObject named Player"
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.
UniCortex
This project is still under active development. The API and command structure may change without notice.
A toolkit for controlling Unity Editor externally via REST API, MCP (Model Context Protocol), and CLI.
UniCortex can be used in two ways:
As an MCP server for AI agents such as Claude Code or Codex CLI
As a CLI tool for direct terminal-based control
In both cases, you must install the UniCortex Unity package into the target Unity project first.
Requirements
Unity 2022.3 or later
.NET 10 SDK (for MCP server and CLI)
Installation
Add via Unity Package Manager using a Git URL:
Open Package Manager
Click the
+buttonSelect "Add package from git URL"
Enter the following URL:
https://github.com/VeyronSakai/UniCortex.gitUse UniCortex as an MCP Server
Use this mode when you want an MCP client to call Unity operations as tools. The UniCortex Unity package must be installed in the target Unity project.
MCP Server Setup
Add the following MCP server configuration to your MCP client's settings file (e.g., .mcp.json, claude_desktop_config.json, etc.). Refer to your client's documentation for the exact configuration location.
{
"mcpServers": {
"Unity": {
"type": "stdio",
"command": "bash",
"args": ["-c", "dotnet run --project ${UNICORTEX_PROJECT_PATH}/Library/PackageCache/com.veyron-sakai.uni-cortex@*/Tools~/UniCortex.Mcp/"],
"env": {
"UNICORTEX_PROJECT_PATH": "/path/to/your/unity/project"
}
}
}
}Replace /path/to/your/unity/project with the absolute path of your Unity project. After saving the configuration, restart the client to apply the changes.
The MCP server reads the port number from Library/UniCortex/config.json (written automatically when Unity Editor starts) and connects to the HTTP server.
No pre-build or tool installation is required. The MCP server is built and started automatically via dotnet run.
Alternatively, you can specify the URL directly via the UNICORTEX_URL environment variable (takes priority over UNICORTEX_PROJECT_PATH):
{
"mcpServers": {
"Unity": {
"type": "stdio",
"command": "bash",
"args": ["-c", "dotnet run --project ${UNICORTEX_PROJECT_PATH}/Library/PackageCache/com.veyron-sakai.uni-cortex@*/Tools~/UniCortex.Mcp/"],
"env": {
"UNICORTEX_PROJECT_PATH": "/path/to/your/unity/project",
"UNICORTEX_URL": "http://localhost:12345"
}
}
}
}Available MCP Tools
The MCP server exposes the following built-in tools.
Editor Control
Tool | Description |
| Check connectivity with the Unity Editor |
| Start Play Mode |
| Stop Play Mode |
| Get the current state of the Unity Editor (play mode, paused) |
| Pause the Unity Editor. Use with |
| Unpause the Unity Editor |
| Advance the Unity Editor by one frame while paused |
| Request script recompilation (domain reload) |
| Undo the last operation |
| Redo an undone operation |
| Save the currently active stage (Scene, Prefab, Timeline, etc.) |
Scene
Tool | Description |
| Create a new empty scene and save it at the specified asset path |
| Open a scene by path |
| Get the GameObject hierarchy tree of the current scene or Prefab |
GameObject
Tool | Description |
| Search GameObjects by name, tag, component type, instanceId, layer, path, or state |
| Create a new empty GameObject |
| Delete a GameObject (supports Undo) |
| Modify name, active state, tag, layer, or parent |
Component
Tool | Description |
| Add a component to a GameObject |
| Remove a component from a GameObject |
| Get serialized properties of a component |
| Set a serialized property on a component |
Component type arguments are supplied as a fully-qualified type name plus the defining assembly name (e.g. UnityEngine.Rigidbody + UnityEngine.PhysicsModule).
ScriptableObject
Tool | Description |
| Create a new ScriptableObject |
| Get serialized properties of an existing |
| Set a serialized property on an existing |
create_scriptable_object takes the ScriptableObject subclass name plus the defining assembly name (e.g. MyNamespace.MyData + Assembly-CSharp). Property paths and value formats match set_component_property.
Prefab
Tool | Description |
| Save a scene GameObject as a Prefab asset |
| Instantiate a Prefab into the scene |
| Open a Prefab asset in Prefab Mode for editing |
| Close Prefab Mode and return to the main stage |
Asset
Tool | Description |
| Refresh the Unity Asset Database |
Project Window
Tool | Description |
| Select an asset in the Project Window, focus the window, and ping it |
Console
Tool | Description |
| Get console log entries from the Unity Editor |
| Clear all console logs |
Test
Tool | Description |
| Run Unity Test Runner tests and return results |
Menu Item
Tool | Description |
| Execute a Unity Editor menu item by path |
Screenshot
Tool | Description |
| Capture a screenshot of the current Unity rendering output (Play Mode only) |
View
Tool | Description |
| Switch focus to the Scene View window |
| Switch focus to the Game View window |
| Get the current Game View size (width and height in pixels) |
| Get the list of available Game View sizes (built-in and custom) |
| Set the Game View resolution by index from the size list |
Recorder
Tool | Description |
| Get the list of all configured recorders and their settings (requires com.unity.recorder) |
| Add a Movie recorder to the list with name, output path, encoder, quality, audio capture (requires com.unity.recorder) |
| Remove a Movie recorder from the list by index (requires com.unity.recorder) |
| Start recording with the specified Movie recorder (Play Mode only, requires com.unity.recorder) |
| Stop recording and save the video file (requires com.unity.recorder) |
Input
Tool | Description |
| Send a keyboard event via Input System in Play Mode (requires com.unity.inputsystem) |
| Send a mouse event via Input System in Play Mode (requires com.unity.inputsystem). Supports press, release, and move for drag simulation |
Timeline
Tool | Description |
| Create a new TimelineAsset (.playable file) at the specified asset path (requires com.unity.timeline) |
| Add a track to a TimelineAsset (requires com.unity.timeline) |
| Remove a track from a TimelineAsset by index (requires com.unity.timeline) |
| Set the binding of a Timeline track on a PlayableDirector (requires com.unity.timeline) |
| Add a default clip to a Timeline track (requires com.unity.timeline) |
| Remove a clip from a Timeline track by index (requires com.unity.timeline) |
| Start playback of a Timeline on a PlayableDirector (requires com.unity.timeline) |
| Stop playback of a Timeline on a PlayableDirector and reset to the beginning (requires com.unity.timeline) |
Extensions
User-defined extensions in your Unity project are automatically discovered and exposed alongside the built-in tools. See Extension for details.
Use UniCortex as a CLI Tool
Use this mode when you want to control Unity Editor directly from a terminal. As with the MCP server, the UniCortex Unity package must be installed in the target Unity project, and the Unity Editor must be open with the package loaded.
Connection settings
The CLI resolves the Unity Editor endpoint in the following order:
If
UNICORTEX_URLis set, the CLI connects directly to that URL.Otherwise, it uses
UNICORTEX_PROJECT_PATHto readLibrary/UniCortex/config.json, which is written when the Unity Editor starts.If neither is set, the CLI exits with an error.
Choose how to run the CLI
Choose one of the following options depending on how you want to invoke the CLI.
Whichever option you choose, make sure the CLI version matches the UniCortex package version installed in the Unity project. Running via dotnet run --project from Library/PackageCache naturally uses the same package version.
Option 1: Run commands with dotnet run --project
export UNICORTEX_PROJECT_PATH="/path/to/your/unity/project"
export UNICORTEX_CLI_PROJECT=$(echo "${UNICORTEX_PROJECT_PATH}"/Library/PackageCache/com.veyron-sakai.uni-cortex@*/Tools~/UniCortex.Cli)
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- editor ping
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- scene hierarchy
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- gameobject find "t:Camera"
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- component property list 1234 UnityEngine.Transform UnityEngine.CoreModule
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- test run --test-mode EditModeOption 2: Install as a dotnet local tool
Install UniCortex.Cli from NuGet.org as a local tool.
dotnet new tool-manifest
dotnet tool install --local UniCortex.Cli
dotnet tool run unicortex -- editor ping
dotnet tool run unicortex -- scene hierarchyIf the tool is already installed, run dotnet tool update --local UniCortex.Cli instead.
If you share the tool manifest with your team, run dotnet tool restore before the first dotnet tool run ... so the manifest-defined tools are installed locally.
Option 3: Install as a dotnet global tool
Install UniCortex.Cli globally when you want to invoke unicortex directly from your shell.
dotnet tool install --global UniCortex.Cli
unicortex editor ping
unicortex scene hierarchyIf the tool is already installed, run dotnet tool update --global UniCortex.Cli instead.
Argument and output conventions
Required parameters are positional arguments, for example
scene open Assets/Scenes/Main.unity.Optional parameters with defaults become named options, for example
gameobject modify 1234 --name CameraRig --active-self true.Read/query commands usually print JSON, such as
scene hierarchy,gameobject find,component property list, andrecorder all list.State-changing commands usually print a short status message, such as
editor play,scene open,component add, andtimeline track bind.screenshot capturewrites a file to the path you pass, and recorder commands create media files in the configured output path.
Available CLI Commands
editor
Command | Description |
| Check connectivity with the Unity Editor. |
| Start Play Mode in the Unity Editor. |
| Stop Play Mode in the Unity Editor. |
| Show the current play/paused state. |
| Pause the Unity Editor. |
| Unpause the Unity Editor. |
| Advance the Unity Editor by one frame while paused. |
| Perform Undo. |
| Perform Redo. |
| Save the active stage. |
| Request script recompilation. |
scene
Command | Description |
| Create a new empty scene at the specified asset path. |
| Open a scene by asset path. |
| Print the current scene hierarchy as JSON. |
gameobject
Command | Description |
| Search GameObjects by Unity Search query. |
| Create a new empty GameObject with the specified name. |
| Delete a GameObject by |
| Rename, reparent, or change active state, tag, or layer. |
component
Command | Description |
| Add a component to a GameObject. |
| Remove a component from a GameObject. |
| Print serialized component properties as JSON. |
| Set a serialized property by path. |
Component commands accept the fully-qualified component type name plus the defining assembly name (e.g. UnityEngine.Rigidbody UnityEngine.PhysicsModule).
scriptable-object
Command | Description |
| Create a new ScriptableObject |
| Print serialized properties of an existing |
| Set a serialized property on an existing |
scriptable-object create accepts the fully-qualified ScriptableObject subclass name plus the defining assembly name (e.g. MyNamespace.MyData Assembly-CSharp).
prefab
Command | Description |
| Save a scene GameObject as a Prefab asset. |
| Instantiate a Prefab into the current scene. |
| Open a Prefab in Prefab Mode. |
| Close Prefab Mode and return to the main stage. |
test
Command | Description |
| Run Unity Test Runner tests. Supports filters such as |
console
Command | Description |
| Read Unity Editor console logs. |
| Clear Unity Editor console logs. |
asset, project-window, menu, screenshot
Command | Description |
| Refresh the Unity Asset Database. |
| Select and ping an asset in the Project Window. |
| Execute a Unity menu item by path. |
| Capture a PNG screenshot. Play Mode only. |
scene-view, game-view, game-view size
Command | Description |
| Focus the Scene View window. |
| Focus the Game View window. |
| Show the current Game View size. |
| List available Game View sizes. |
| Set the Game View size by index. |
input
Command | Description |
| Send an Input System key event. Requires |
| Send an Input System mouse event. Requires |
recorder all, recorder movie
Command | Description |
| List configured recorders. Requires |
| Add a Movie recorder. Requires |
| Remove a Movie recorder by index. Requires |
| Start movie recording. Play Mode only; requires |
| Stop movie recording and save the output file. |
timeline, timeline track, timeline clip
Command | Description |
| Create a Timeline asset. Requires |
| Start Timeline playback on a PlayableDirector. Requires |
| Stop Timeline playback and reset to the beginning. Requires |
| Add a Timeline track. Requires |
| Remove a Timeline track by index. Requires |
| Bind a Timeline track to a target object. Requires |
| Add a clip to a Timeline track. Requires |
| Remove a clip from a Timeline track. Requires |
extension
Command | Description |
| List registered extensions from the Unity project. |
| Execute an extension by name, optionally passing JSON through |
Representative workflows
# Find cameras and inspect a component
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- gameobject find "t:Camera"
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- component property list 1234 UnityEngine.Transform UnityEngine.CoreModule
# Rename and reparent a GameObject
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- gameobject modify 1234 --name CameraRig --parent-instance-id 5678
# Set a serialized property
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- component property set 1234 UnityEngine.Transform UnityEngine.CoreModule m_LocalPosition.x 1.5
# Create and edit a ScriptableObject .asset
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- scriptable-object create MyNamespace.MyData Assembly-CSharp Assets/Data/MyData.asset
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- scriptable-object property set Assets/Data/MyData.asset m_Speed 1.5
# Capture a screenshot
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- screenshot capture ./Artifacts/gameview.png
# Discover and run a custom extension
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- extension list
dotnet run --project "$UNICORTEX_CLI_PROJECT" -- extension execute count_gameobjects --arguments '{"nameFilter":"Camera"}'Extension
You can define extensions in your Unity project by creating Editor-only C# classes that inherit from ExtensionHandler. They are automatically discovered via TypeCache and exposed as MCP tools and CLI commands.
#if UNITY_EDITOR
using UniCortex.Editor.Handlers.Extension;
using UnityEngine;
public class CountGameObjects : ExtensionHandler
{
public override string Name => "count_gameobjects";
public override string Description => "Count GameObjects in the current scene.";
public override bool ReadOnly => true;
public override ExtensionSchema InputSchema => new ExtensionSchema(
new ExtensionProperty("nameFilter", ExtensionPropertyType.String,
"Only count GameObjects whose name contains this string.")
);
public override string Execute(string argumentsJson)
{
// Runs on the Unity main thread — safe to call Unity APIs
var filter = "";
if (!string.IsNullOrEmpty(argumentsJson))
{
var args = JsonUtility.FromJson<Args>(argumentsJson);
if (!string.IsNullOrEmpty(args.nameFilter))
filter = args.nameFilter;
}
var allObjects = Object.FindObjectsByType<GameObject>(FindObjectsSortMode.None);
var count = 0;
foreach (var obj in allObjects)
{
if (string.IsNullOrEmpty(filter) || obj.name.Contains(filter))
count++;
}
return $"Found {count} GameObject(s).";
}
[System.Serializable]
private class Args
{
public string nameFilter;
}
}
#endifAPI Reference
Class | Description |
| Abstract base class. Override |
| Defines the input parameter schema via |
| Defines a single parameter: name, type, description, and whether it is required |
| Parameter types: |
After adding or removing extensions, restart the MCP client (e.g., Claude Code) to refresh the tool list.
Architecture
graph LR
Agent["AI Agent"]
MCP["UniCortex.Mcp<br/>.NET 10"]
CLI["UniCortex.Cli<br/>.NET 10"]
Unity["Unity Editor<br/>HTTP Server"]
Agent -- "MCP / stdio" --> MCP
Agent -- "CLI" --> CLI
MCP -- "HTTP" --> Unity
CLI -- "HTTP" --> UnityUnity Editor side: C#
HttpListenerHTTP server embedded in the EditorShared Core:
UniCortex.Core— service layer and HTTP infrastructure shared by MCP and CLIMCP Server:
UniCortex.Mcp— .NET 10 + Model Context Protocol C# SDKCLI Tool:
UniCortex.Cli— .NET 10 + ConsoleAppFrameworkUPM Package:
com.veyron-sakai.uni-cortex
Documentation
Documentations~/SPEC.md— Full API endpoint and MCP tool definitions
Contributing
When developing this package locally:
# Build all projects
dotnet build Tools~/UniCortex.Core/
dotnet build Tools~/UniCortex.Mcp/
dotnet build Tools~/UniCortex.Cli/
# Run tests
UNICORTEX_PROJECT_PATH=$(pwd)/Samples~ dotnet test Tools~/UniCortex.Core.Test/
# Run MCP server
dotnet run --project Tools~/UniCortex.Mcp/
# Run CLI
dotnet run --project Tools~/UniCortex.Cli/ -- editor pingLicense
MIT License - LICENSE.txt
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.
Latest Blog Posts
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/VeyronSakai/UniCortex'
If you have feedback or need assistance with the MCP directory API, please join our Discord server