Unity3d MCP
FastMCP 2.14.3 Unity 3D automation server with VRM avatar pipeline and VRChat integration
Installation
npx unity3d-mcpAsk AI about Unity3d MCP
Powered by Claude Β· Grounded in docs
I know everything about Unity3d MCP. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
English | δΈζ
Unity3d MCP Documentation

Table of Contents
- System Overview
- Architecture
- Source Code
- Usage
- Agent Skills Module
- Innovation
- Technical Features
- API Reference
- Troubleshooting
System Overview
Unity3d MCP β Bridging AI and Unity for intelligent game development
Unity3d MCP (Model Context Protocol) is an AIβUnity integration system that connects AI assistants (e.g. Cursor, Claude, Trae) with the Unity Editor via a built-in MCP server, enabling an AI-driven Unity workflow.
Core Value
- AI-driven development: Control the Unity Editor with natural language
- Seamless integration: Works with mainstream AI clients without changing your workflow
- Rich tooling: 40+ tools covering the full Unity development pipeline
- High performance: HTTP-based communication
- Extensible: Modular design for easy extension
- Zero config: Built-in MCP server inside Unity, no external dependencies
System Components
- Built-in MCP Server (C#): MCP protocol server inside the Unity Editor
- Unity Package (C#): Full Unity Editor plugin
- Tool ecosystem: 40+ Unity development tools
- Protocol: HTTP + JSON-RPC 2.0
Architecture
Overall Architecture
Layers (top to bottom):
- AI client layer: Cursor, Claude, Trae, etc.
- MCP protocol layer: Unity built-in MCP server
- Communication layer: HTTP (configurable port, default 8000) + JSON-RPC 2.0
- Unity Editor layer: Unity Editor + Unity API
- Tool layer: 40+ tools + message-queue execution engine
Architecture Diagram

Figure 1: Data flow from AI clients to the Unity Editor
Data Flow

Figure 2: Flow from AI instructions to Unity execution
Design Principles
1. Two-tier call architecture
AI client β FacadeTools β MethodTools β Unity API
- FacadeTools:
async_callandbatch_call - MethodTools: 40+ methods, invoked only via FacadeTools
2. State-tree execution engine
- State-based routing
- Parameter validation and type conversion
- Unified error handling
3. Connection management
- Configurable port (default 8000)
- Message queue processing
- Main-threadβsafe execution
Source Code
1. Unity MCP server (C#)
Main files
unity-package/Editor/Connect/
βββ McpService.cs
βββ McpServiceStatusWindow.cs
βββ McpServiceGUI.cs
Components
- McpService.cs: HTTP listener, MCP request handling
- Message queue: EnqueueTask / ProcessMessageQueue, main-thread execution
- Tool discovery: DiscoverTools, reflection-based registration of async_call / batch_call
2. Unity tool package (C#)
Structure
- Runtime: StateTreeContext
- Editor/Executer: AsyncCall, BatchCall, ToolsCall, CoroutineRunner, McpTool, StateMethodBase, IToolMethod, etc.
- Editor/StateTree: StateTree, StateTreeBuilder
- Editor/Selector: HierarchySelector, ProjectSelector, IObjectSelector
- Editor/Tools: Hierarchy, ResEdit, Console, RunCode, UI, Storage, etc.
- Editor/GUI: McpServiceGUI, McpDebugWindow
3. Tool categories
- Hierarchy: hierarchy_create, hierarchy_search, hierarchy_apply
- ResEdit: edit_gameobject, edit_component, edit_material, edit_texture, β¦
- Project: project_search, project_operate
- UI: ugui_layout, ui_rule_manage, figma_manage
- Console: console_read, console_write
- RunCode: code_runner, python_runner
- Editor: base_editor, manage_package, gameplay, object_delete
- Storage: prefers, source_location
- Network: request_http
Usage
1. Requirements
- Unity 2020.3+ (recommended 2022.3.61f1c1)
- MCP-capable AI client (Cursor / Claude / Trae)
- Windows / macOS / Linux
No extra Python or external dependencies for the Unity package.
2. Configuration
MCP client config
Add to your AI client MCP config (e.g. ~/.cursor/mcp.json, Claude/VS/Trae equivalents):
{
"mcpServers": {
"unity3d-mcp": {
"url": "http://localhost:8000"
}
}
}
Unity Editor
- MCP Settings (
Edit β Project Settings β MCP): connection toggle, tool list, port (default 8000), log level, UI/Figma settings. - MCP Debug Window (
Window β MCP β Debug Window): call history, re-run, filter, export logs.
3. Agent skills and token saving
To avoid large context from full MCP tool lists and schemas, the project provides an Agent Skills module (see Agent Skills Module). Reference demo/.cursor/skills SKILL.md files in Cursor Rules or Agent config so the agent loads only the needed skill docs and then calls MCP, reducing token usage.
4. Quick start
- Import the Unity package and open the project.
- The built-in MCP server starts automatically (default port 8000).
- In the AI client, try: "Create a Cube named Player".
5. Examples
- Create GameObject: "Create a Cube named Player"
- Batch: "Create 5 Enemy objects at (0,0,0), (1,0,0), β¦"
- Resources: "Download a random image and apply it to an Image component"
6. Advanced
- Custom tools: Add classes under
unity-package/Editor/Tools/, inheritStateMethodBaseorIToolMethod, useToolNameAttribute; Unity discovers and registers them. - Batch: Use
batch_callwith an array of{ "func", "args" }for better performance.
7. Extended scenarios
The doc in README.zh-CN.md describes extended scenarios (AI texture generation, Poly Haven batch download, project architecture diagrams, performance analysis, test data generation, localization). Use python_runner and code_runner for automation.
Agent Skills Module
The MCP protocol exposes full tool lists and parameter schemas to the AI, which can consume many tokens. The project adds a Skill module (unity-package/Skills/unity3d-skill/) used together with MCP: load skill docs on demand instead of all tool schemas at once.
How it works
- Unified skill entry: A single
SKILL.mdprovides a function overview (32 functions across 7 categories: Editor & Preferences, Code Execution, Scene & Hierarchy, GameObject & Component Editing, Project & Asset Management, UI & Layout, Gameplay & Networking). - JSON Schema references: Each function has a dedicated JSON Schema file in
references/<func_name>.json, containing fullargsschema,actionsenum (with conditional params), andresponseformat. - On-demand load: The agent reads the overview in
SKILL.mdto find the right function, then loads the specificreferences/<func_name>.jsonfor detailed parameter info β instead of loading all 32 tool schemas at once.
With MCP
- MCP handles tool discovery and execution; Skills describe when and how to pass arguments.
- Reference
SKILL.mdin Cursor Rules or Agent config so the agent consults the overview and loads the relevant JSON schema on demand, then calls MCP. - This keeps full MCP capability while reducing tokens by not keeping 32+ tool descriptions in context.
File structure
unity-package/Skills/unity3d-skill/
βββ SKILL.md # Function overview & category summary
βββ references/ # JSON Schema for each function
βββ base_editor.json
βββ hierarchy_create.json
βββ gameplay.json
βββ request_http.json
βββ ... (32 schemas total)
Innovation
1. Two-tier call architecture
- FacadeTools (
async_call,batch_call) + 40+ MethodTools invoked only through them.
2. State-tree execution engine
- State-based routing, parameter validation, unified error handling.
3. Message-queue execution
- Configurable port (default 8000), main-thread safety, EditorApplication.updateβbased queue.
4. Coroutine support
- Async operations (e.g. HTTP, downloads) without blocking the main thread.
5. Smart file/data handling
- Detect file types; for large content return metadata instead of full data to save memory and bandwidth.
Technical Features
- Communication: HTTP, JSON-RPC 2.0, message queue, batch calls
- Reliability: Configurable port, main-thread safety, error handling, timeouts
- Extensibility: Modular tools, reflection, custom tools, configurable parameters
- DX: Natural language, real-time feedback, logging, documentation
API Reference
Facade tools
async_call β single call:
{
"func": "async_call",
"args": {
"func": "hierarchy_create",
"args": { "name": "Player", "primitive_type": "Cube", "source": "primitive" }
}
}
batch_call β batch:
{
"func": "batch_call",
"args": [
{ "func": "hierarchy_create", "args": { "name": "Player", "primitive_type": "Cube" } },
{ "func": "edit_gameobject", "args": { "path": "Player", "position": [0, 1, 0] } }
]
}
Core tools (examples)
- Hierarchy: hierarchy_create, hierarchy_search, hierarchy_apply
- ResEdit: edit_gameobject, edit_component, edit_material, edit_texture
- Project: project_search, project_operate
- Network: request_http, figma_manage
Response format
Success: { "success": true, "message": "...", "data": { ... } }
Error: { "success": false, "message": "...", "error": "..." }
Troubleshooting
Connection
- Cannot connect: Ensure Unity is running, port 8000 (or your port) is free, firewall allows it; check Unity console.
- Disconnects: Check network, Unity performance, and timeout settings.
Tool execution
- Call fails: Check parameter format and types, ensure target objects exist, permissions.
- Partial batch failure: Reorder operations, check resource conflicts, try smaller batches.
Performance
- Slow response: Improve network, reduce Unity load, simplify operations.
- High memory: Destroy unused objects, release resources, check coroutine lifecycle.
Debugging
- Enable detailed logs (e.g.
McpLoggerin Unity). - Use MCP Debug Window for history and re-run.
- Use network tools (e.g. Wireshark) if needed for HTTP.
Summary
Unity3d MCP connects AI assistants to the Unity Editor via a built-in MCP server, using a two-tier call architecture, message-queue execution, and main-thread safety. It provides 40+ tools across the Unity development pipeline.
Advantages
- AI-driven: Natural language control of the Editor
- Rich: 40+ tools for the full pipeline
- Performant: HTTP + message queue
- Extensible: Modular, custom tools
- Compatible: Works with major AI clients
- Zero config: No external MCP process
Use cases
- AI-assisted game development
- Automated resource and batch operations
- Education and training
Roadmap
- More Unity tools, visual tool authoring, performance and monitoring, multi-platform support, better debugging.
Document version: v2.0
Last updated: September 2025
Unity3d MCP Development Team
