Unity MCP Server
Unity MCP servers enable AI models to interact with the Unity Editor, providing capabilities for scene manipulation, asset management, script editing, and game development automation.
Overview
The MCP Unity Server bridges AI and the Unity Editor, allowing language models (LLMs) to directly interact with Unity projects. It's part of the Model Context Protocol (MCP) system, providing a safe and standard way to connect AI with game development workflows. Other notable implementations include CoplayDev/unity-mcp (Python) and IvanMurzak/Unity-MCP (Docker).
Developed by:
Primary implementation by CoderGamester
Key Features
Scene \u0026 GameObject Management
Create, modify, and delete GameObjects, components, and scenes
Asset \u0026 Project Control
Import, create, modify, and delete assets; manage packages and project settings
Scripting \u0026 Code Assistance
Edit C# scripts, validate code, and automate script-related tasks
Editor Automation \u0026 Testing
Automate repetitive editor workflows and run tests within the Unity Test Runner
Available Tools
Quick Reference
| Tool | Purpose | Category |
|---|---|---|
execute_menu_item | Executes Unity menu items | Editor |
select_gameobject | Selects GameObjects in hierarchy | Scene |
update_gameobject | Updates or creates GameObjects | Scene |
update_component | Updates or adds components to GameObjects | Scene |
add_package | Installs new Unity packages | Project |
run_tests | Runs Unity Test Runner tests | Testing |
send_console_log | Sends a log message to Unity console | Debugging |
add_asset_to_scene | Adds an asset to the current scene | Scene |
create_prefab | Creates a prefab | Assets |
Detailed Usage
execute_menu_item▶
Executes Unity menu items (functions tagged with the MenuItem attribute).
use_mcp_tool({
server_name: "unity",
tool_name: "execute_menu_item",
arguments: {
menu_item_path: "GameObject/Create Empty"
}
});
select_gameobject▶
Selects game objects in the Unity hierarchy by path or instance ID.
use_mcp_tool({
server_name: "unity",
tool_name: "select_gameobject",
arguments: {
path: "Main Camera"
}
});
update_gameobject▶
Updates a GameObject's core properties (name, tag, layer, active/static state), or creates the GameObject if it does not exist.
use_mcp_tool({
server_name: "unity",
tool_name: "update_gameobject",
arguments: {
name: "Player",
tag: "Enemy",
is_active: false
}
});
update_component▶
Updates component fields on a GameObject or adds it to the GameObject if it does not contain the component.
use_mcp_tool({
server_name: "unity",
tool_name: "update_component",
arguments: {
game_object_name: "Player",
component_type: "Rigidbody",
properties: {
mass: 5
}
}
});
add_package▶
Installs new packages in the Unity Package Manager.
use_mcp_tool({
server_name: "unity",
tool_name: "add_package",
arguments: {
package_name: "com.unity.textmeshpro"
}
});
run_tests▶
Runs tests using the Unity Test Runner.
use_mcp_tool({
server_name: "unity",
tool_name: "run_tests",
arguments: {
test_mode: "EditMode"
}
});
send_console_log▶
Sends a console log to Unity.
use_mcp_tool({
server_name: "unity",
tool_name: "send_console_log",
arguments: {
message: "Hello from MCP!"
}
});
add_asset_to_scene▶
Adds an asset from the AssetDatabase to the Unity scene.
use_mcp_tool({
server_name: "unity",
tool_name: "add_asset_to_scene",
arguments: {
asset_path: "Assets/Prefabs/Player.prefab"
}
});
create_prefab▶
Creates a prefab with optional MonoBehaviour script and serialized fields.
use_mcp_tool({
server_name: "unity",
tool_name: "create_prefab",
arguments: {
name: "NewCubePrefab",
path: "Assets/Prefabs",
game_object_name: "Cube",
component_type: "MeshRenderer"
}
});
Installation
{
"mcpServers": {
"unity": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mcp-unity"
],
"env": {
"UNITY_PROJECT_PATH": "/path/to/your/unity/project"
}
}
}
}
Sources
Related Articles
Model Context Protocol (MCP): Open Standard for AI Integration
The Model Context Protocol (MCP) is an open standard enabling AI systems to connect with diverse data sources, tools, and services, eliminating custom integrations for seamless interaction.
Supabase MCP Server
Supabase MCP servers enable AI models to interact with Supabase backends, providing capabilities for PostgreSQL databases, real-time subscriptions, authentication, and storage operations.
Blender MCP Server
Blender MCP Server connects Blender to Claude AI through the Model Context Protocol (MCP), enabling prompt-assisted 3D modeling, scene creation, and manipulation.