home / mcp / unity mcp complex mcp server
Provides a bridge between Unity Editor and an MCP server to control scenes, objects, and editor tasks via AI assistants.
Configuration
View docs{
"mcpServers": {
"2996371275-unity_mcp_complex": {
"command": "node",
"args": [
"ABSOLUTE/PATH/TO/mcp-unity/Server~/build/index.js"
],
"env": {
"UNITY_HOST": "192.168.1.100",
"UNITY_PORT": "8090",
"UNITY_REQUEST_TIMEOUT": "10"
}
}
}
}MCP Unity creates a bridge between the Unity Editor and an MCP-compliant Node.js server, enabling AI assistants to control and query your Unity projects. You can automate scene edits, asset management, tests, and other editor tasks through natural language prompts or MCP client tools, speeding up workflows and enabling AI-assisted development inside Unity.
You run a local MCP Unity server inside the Unity Editor and connect it to an MCP client (such as an AI assistant or IDE) over WebSocket. The client can request actions like selecting GameObjects, updating components, running tests, and executing Unity menu items. Start the server from the Unity Editor, then use your MCP client to send commands. The server exposes a set of tools and resources that your AI can invoke to perform common editor tasks without manual clicks.
Prerequisites you need before starting:
- Node.js 18 or later
- npm 9 or later
- Unity 2022.3 or later
Step 1. Install Node.js
Windows: install Node.js using the Windows Installer for the LTS version, then verify with node --version.
macOS: install Node.js using the macOS installer for the LTS version, or run brew install node@18 if you have Homebrew, then verify with node --version.
Step 2. Install the Unity MCP Server package via Unity Package Manager
- Open Unity
- Go to Window > Package Manager
- Click the + button and choose Add package from git URLโฆ
- Enter: https://github.com/CoderGamester/mcp-unity.git and click Add
Option 1: Configure using the Unity Editor
1. Open the Unity Editor
2. Navigate to Tools > MCP Unity > Server Window
3. Click the Configure button for your AI LLM client as shown in the interface
4. Confirm the configuration installation when prompted
Option 2: Configure Manually
Open the MCP configuration file for your AI client and paste the following, replacing ABSOLUTE/PATH/TO with your path to the MCP Unity installation.
{
"mcpServers": {
"mcp-unity": {
"command": "node",
"args": [
"ABSOLUTE/PATH/TO/mcp-unity/Server~/build/index.js"
]
}
}
}Step 1. Open the Unity Editor
Step 2. Open Tools > MCP Unity > Server Window
Step 3. Click Start Server to start the WebSocket server
Step 4. Open your MCP client and begin issuing Unity editor commands
The default WebSocket port is 8090. To change it
1. Open Unity Editor
2. Go to Tools > MCP Unity > Server Window
3. Change the WebSocket Port value
4. Restart Node.js server to apply changes
You can adjust the request timeout between and the MCP server
1. Open Unity Editor
2. Go to Tools > MCP Unity > Server Window
3. Change the Request Timeout (seconds) value
4. Restart the Node.js server
To allow remote MCP bridge connections
1. Open Unity Editor
2. Go to Tools > MCP Unity > Server Window
3. Enable the Allow Remote Connections option
4. Restart the Node.js server to apply changes
Building the Node.js Server
The MCP Unity server runs on Node.js and compiles TypeScript to JavaScript in a build directory. If issues arise, force install the server
Manual build steps
1. Open the Unity Editor
2. Tools > MCP Unity > Server Window
3. Click on "Force Install Server"If you want to build it manually, run these commands from the Server directory
cd ABSOLUTE/PATH/TO/mcp-unity/Server~
npm install
npm run build
node build/index.jsDebug the server with MCP Inspector using either PowerShell or a terminal
npx @modelcontextprotocol/inspector node Server~/build/index.js
`npx @modelcontextprotocol/inspector node Server~/build/index.jsTurn on logging in your terminal or log file to diagnose issues
# Powershell
$env:LOGGING = "true"
$env:LOGGING_FILE = "true"
```
```cmd
set LOGGING=true
set LOGGING_FILE=trueWhat is MCP Unity? It bridges your Unity Editor with AI assistants using the Model Context Protocol, exposing editor tasks as tools and resources for AI control.
Why am I unable to connect? Ensure the WebSocket server is running, try forcing a reconnection, and verify the port configuration in the Server Window.
If you need help, reach out through the provided channels for guidance and feedback.
Project path must not contain spaces to avoid MCP client connection issues.
Executes Unity menu items (functions tagged with the MenuItem attribute) to perform editor actions like creating objects or triggering menu commands.
Selects GameObjects in the hierarchy by path or instance ID for further operations.
Updates a GameObject's core properties (name, tag, layer, active/static state) or creates the GameObject if it does not exist.
Updates or adds a component on a GameObject and sets its fields.
Installs new packages in the Unity Package Manager.
Runs tests using the Unity Test Runner.
Sends a console log message to Unity Editor.
Adds an asset from the AssetDatabase to the current scene.