Back to catalog
Unity3D Game Engine MCP Server
An MCP server that enables AI assistants to interact with Unity Editor, providing manipulation of Unity projects, scenes, GameObjects, and access to Unity tools such as Test Runner and Package Manager.
Get this MCP server
An MCP server that enables AI assistants to interact with Unity Editor, providing manipulation of Unity projects, scenes, GameObjects, and access to Unity tools such as Test Runner and Package Manager.
Installation
Unity Package Manager
1. Open Unity Package Manager (Window > Package Manager)
2. Click "+" button
3. Select "Add package from git URL..."
4. Enter: https://github.com/CoderGamester/mcp-unity.git
5. Click "Add"
Manual Build
cd ABSOLUTE/PATH/TO/mcp-unity/Server~
npm install
npm run build
node build/index.js
Configuration
Standard MCP Client
{
"mcpServers": {
"mcp-unity": {
"command": "node",
"args": [
"ABSOLUTE/PATH/TO/mcp-unity/Server~/build/index.js"
]
}
}
}
Available Tools
| Tool | Description |
|---|---|
execute_menu_item |
Executes Unity menu items (functions with MenuItem attribute) |
select_gameobject |
Selects game objects in Unity hierarchy by path or instance ID |
update_gameobject |
Updates main GameObject properties (name, tag, layer, active/static state) or creates Ga... |
update_component |
Updates component fields on a GameObject or adds it to the GameObject if it doesn't contain... |
add_package |
Installs new packages in Unity Package Manager |
run_tests |
Runs tests using Unity Test Runner |
send_console_log |
Sends console log to Unity |
add_asset_to_scene |
Adds an asset from AssetDatabase to a Unity scene |
create_prefab |
Creates a prefab with optional MonoBehaviour script and serialized field values |
recompile_scripts |
Recompiles all scripts in the Unity project |
Features
- IDE integration with access to package cache for improved code analysis
- Automatic workspace setup for IDE environments like VSCode
- Unity scene and GameObject manipulation
- Unity Package Manager integration
- Access to Unity Test Runner
- Console log management
- Asset Database integration
- WebSocket communication
- Configurable port and timeout
- Remote connection support
Environment Variables
Optional
UNITY_PORT- WebSocket port for connecting to Unity Editor (default: 8090)UNITY_REQUEST_TIMEOUT- Timeout in seconds for MCP server requests (default: 10)UNITY_HOST- Host IP address for remote bridge connectionsLOGGING- Enable console logging for debuggingLOGGING_FILE- Enable file logging for debugging
Usage Examples
Execute the menu item 'GameObject/Create Empty' to create a new empty GameObject
Select the Main Camera object in my scene
Set the Player object's tag to 'Enemy' and make it inactive
Add a Rigidbody component to the Player object and set its mass to 5
Add the TextMeshPro package to my project
Notes
Requires Unity 2022.3 or higher and Node.js 18 or higher. The project path must not contain spaces, otherwise the MCP client will not be able to connect. The server provides both tools for manipulating Unity objects and resources for querying Unity state. Includes support for multilingual documentation (English, Chinese, Japanese).
