An AI game development assistant based on the Model Context Protocol that seamlessly connects Claude, Cursor, Copilot, Gemini and other AI agents to the Unity Editor and Runtime via 100+ built-in tools, enabling full-chain automation from coding and scene building to asset management and runtime NPC interaction.
Positioning#
Unity-MCP addresses the limitation of traditional AI coding assistants lacking awareness and control over Unity engine internals (scene hierarchy, assets, runtime instances), enabling AI to directly participate in game building and debugging rather than only generating code snippets.
Core Capabilities#
AI Agent Compatibility#
No vendor lock-in; natively supports any MCP-compatible client including Anthropic Claude, OpenAI Codex, Microsoft Copilot, Google Gemini, Claude Code, Claude Desktop, Cursor, VS Code Copilot, and Gemini CLI.
100+ Built-in MCP Tools#
- Project & Assets: Asset search/create/delete/copy/move, prefab management, material creation, UPM package management
- Scene & Hierarchy: GameObject create/destroy/copy/modify, component CRUD, scene management, multi-view screenshots (Game View / Scene View / Camera)
- Scripting & Editor: C# script read/write/create/delete, Unity log retrieval, editor state control (play/pause), test execution, C# reflection method lookup and invocation
Advanced Execution Mechanisms#
- Skills System: Auto-generates AI skill descriptions based on OS, Unity version, and installed project plugins for enhanced context understanding
- Reflection-Driven: Dynamically discovers and invokes any method in the project codebase via C# Reflection, including private methods and compiled DLLs
- Just-in-Time Compilation: Uses Roslyn for instant C# code snippet compilation and execution
Runtime Support#
Enables LLM interaction inside compiled games for dynamic NPC behavior and real-time AI debugging (e.g., chess AI bot).
Architecture#
Three-layer decoupled architecture:
- Unity-MCP-Plugin (C#): Runs in Unity Editor or game Runtime, exposing Unity API and project code as MCP tools/resources/prompts via reflection and Roslyn
- Unity-MCP-Server (Node.js/TypeScript): Middleware proxy bridging AI agents and Unity Plugin, supporting streamableHttp and stdio transport protocols
- AI Agent / MCP Client: Various AI clients interact with the Server via standard MCP protocol
Key implementations include MainThread dispatching (via MainThread.Instance.Run() for safe cross-thread Unity API calls) and a declarative attribute system ([McpPluginTool], [McpPluginResource], [McpPluginPrompt]).
Installation#
Unity Package#
openupm add com.ivanmurzak.unity.mcp
Or download .unitypackage from GitHub Releases.
CLI Installation (Recommended)#
npm install -g unity-mcp-cli
unity-mcp-cli install-plugin ./MyUnityProject
unity-mcp-cli login ./MyUnityProject
unity-mcp-cli open ./MyUnityProject
Docker Deployment#
Pull image ivanmurzakdev/unity-mcp-server for containerized deployment.
Initial setup: Open Window/AI Game Developer in Unity Editor, click Auto-generate Skills or Configure MCP.
Custom Extension#
Declare custom MCP Tools via C# attributes:
[McpPluginToolType]
public class Tool_GameObject
{
[McpPluginTool("MyCustomTask", Title = "Create a new GameObject")]
[Description("Explain here to LLM what is this, when it should be called.")]
public string CustomTask(
[Description("Explain to LLM what is this.")] string inputData)
{
return MainThread.Instance.Run(() => {
return $"[Success] Operation completed.";
});
}
}
Runtime integration example:
var mcpPlugin = UnityMcpPluginRuntime.Initialize(builder =>
{
builder.WithConfig(config =>
{
config.Host = "http://localhost:8080";
config.Token = "your-token";
});
builder.WithToolsFromAssembly(Assembly.GetExecutingAssembly());
}).Build();
await mcpPlugin.Connect();
Server Configuration#
| Environment Variable | CLI Argument | Description |
|---|---|---|
MCP_PLUGIN_PORT | --port | Connection port (default 8080) |
MCP_PLUGIN_CLIENT_TIMEOUT | --plugin-timeout | Plugin connection timeout (ms, default 10000) |
Extension Ecosystem#
Additional tool packages: AI Animation, AI ParticleSystem, AI ProBuilder.
Unconfirmed Information#
- Minimum Unity version requirement not stated in README
- Cloud service (CLI login) pricing/free tier policy not documented
- Specific Node.js framework used by MCP Server not specified in README