Unity MCP Server
Provides tools for interacting with the Unity Editor, including managing GameObjects, scenes, assets, menus, play mode, console logs, and tests, as well as searching Unity documentation and local assets via RAG.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Unity MCP ServerCreate a new scene and add a Cube"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Unity MCP Server
A unified Model Context Protocol (MCP) server that combines Unity Editor integration, Unity knowledge base search, and comprehensive XREAL One Pro mixed reality development capabilities for AI assistants.
Features
Core Unity Editor Integration (22 Tools)
Tool | Description |
| Execute Unity menu items by path |
| Select GameObjects in the editor |
| Get detailed GameObject information |
| Update or create GameObjects |
| Delete GameObjects from the scene |
| Duplicate GameObjects |
| Search for GameObjects by name/tag/layer/component |
| Add or modify components on GameObjects |
| Instantiate prefabs/assets in the scene |
| Create prefabs from GameObjects |
| Create new scenes |
| Delete scenes |
| Load scenes (single or additive) |
| Add packages via Package Manager |
| Move, copy, rename, delete assets |
| Run Unity Test Runner tests |
| Send messages to Unity console |
| Retrieve Unity console logs |
| Force script recompilation |
| Control play mode (enter/exit/pause/step) |
| Get/set editor selection |
| Search Unity API docs via RAG |
Related MCP server: Union Unity MCP Server
XREAL Mixed Reality Tools (32 Tools)
Project Setup (4 Tools)
Tool | Description |
| Configure Unity project for XREAL One Pro (NRSDK, XR Plugin Management) |
| Android build settings optimized for Samsung S24 + XREAL |
| Import NRSDK package from local file or URL |
| Validate project configuration and fix issues |
Device Control (4 Tools)
Tool | Description |
| Query connected device status, tracking state, battery |
| Switch between 0DoF, 3DoF, and 6DoF tracking |
| Trigger IPD, brightness, and tracking calibration |
| Capture RGB camera frame for CV/AR development |
Hand Tracking (4 Tools)
Tool | Description |
| Enable/configure hand tracking with gesture recognition |
| Query hand pose, joint positions, detected gestures |
| Configure gesture detection (pinch, grab, point, etc.) |
| Add hand interaction to GameObjects (grab, poke, hover) |
Spatial Mapping (5 Tools)
Tool | Description |
| Detect horizontal/vertical planes (floors, walls, tables) |
| Query all detected planes with poses and classifications |
| Create persistent spatial anchors in the real world |
| Load, save, delete, query spatial anchors |
| Generate spatial mesh for physics and occlusion |
Image Tracking (3 Tools)
Tool | Description |
| Register images for marker-based AR tracking |
| Set tracking quality, simultaneous image count |
| Query currently detected and tracked images |
Mixed Reality (3 Tools)
Tool | Description |
| Enable camera passthrough with blend settings |
| Switch between VR, AR, and MR rendering modes |
| Set up depth-based real-world occlusion |
Build & Deploy (2 Tools)
Tool | Description |
| Build optimized APK for XREAL devices |
| List ADB-connected Android devices |
XR Interaction Toolkit (4 Tools)
Tool | Description |
| Configure XR Interaction Toolkit for XREAL |
| Create XREAL-configured XR Origin camera rig |
| Add ray/direct/poke interactors to controllers |
| Create world-space UI optimized for XR |
Performance & Debug (3 Tools)
Tool | Description |
| Real-time FPS, GPU, CPU, thermals, memory |
| Analyze scene for XR performance issues |
| Capture mono/stereo XR viewport screenshots |
Resources
Core Unity Resources (7)
Resource | URI | Description |
Scene Hierarchy |
| All GameObjects in loaded scenes |
GameObject |
| Detailed GameObject info |
Menu Items |
| Available Unity menu items |
Console Logs |
| Console logs with filtering |
Packages |
| Package Manager packages |
Assets |
| Asset Database contents |
Tests |
| Test Runner tests |
XREAL Resources (6)
Resource | URI | Description |
Device State |
| Connection status, tracking quality, thermals |
Hand Tracking |
| Real-time hand joint positions and gestures |
Spatial Anchors |
| All spatial anchors in scene |
Detected Planes |
| Environment surfaces with classifications |
Tracked Images |
| Currently tracked image markers |
Build Settings |
| Android/XREAL build configuration |
Prompts
Core Unity Prompts (1)
Prompt | Description |
| Workflow guidance for GameObject manipulation |
XREAL Prompts (4)
Prompt | Description |
| Step-by-step guide for new XREAL projects |
| Best practices for hand tracking UX |
| Creating persistent MR experiences |
| Mobile XR performance optimization |
Installation
npm install
npm run buildConfiguration
Claude Code (Project-Level)
Create .mcp.json in your project:
{
"mcpServers": {
"unity-mcp": {
"command": "node",
"args": ["C:/path/to/unity-mcp/build/index.js"],
"env": {
"UNITY_PORT": "8090",
"UNITY_HOST": "localhost",
"LOGGING": "true"
}
}
}
}Claude Desktop
Add to %APPDATA%/Claude/claude_desktop_config.json:
{
"mcpServers": {
"unity-mcp": {
"command": "node",
"args": ["C:/path/to/unity-mcp/build/index.js"],
"env": {
"UNITY_PORT": "8090"
}
}
}
}With RAG Knowledge Search
{
"mcpServers": {
"unity-mcp": {
"command": "node",
"args": ["path/to/unity-mcp/build/index.js"],
"env": {
"UNITY_PORT": "8090",
"RAG_PYTHON_PATH": "python",
"RAG_SERVER_PATH": "path/to/unity-rag-server",
"RAG_DB_PATH": "path/to/unity-rag-server/data"
}
}
}
}Environment Variables
Variable | Description | Default |
| Unity WebSocket server port |
|
| Unity WebSocket server host |
|
| Enable console logging |
|
| Enable file logging |
|
| Path to Python executable | - |
| Path to RAG server directory | - |
| Path to RAG database | - |
Quick Start: XREAL Development
1. Setup New XREAL Project
Use prompt: xreal_project_setup
Parameters: { projectType: "MR", targetDevice: "XREALOnePro" }This will guide you through:
Project configuration
NRSDK import
Android build settings
XR rig creation
Hand tracking setup
2. Create Hand-Interactive Object
Tool: create_hand_interactable
Parameters: {
targetGameObject: "MyCube",
interactionType: "Grab",
highlightOnHover: true,
hapticFeedback: true
}3. Add Spatial Anchor
Tool: create_spatial_anchor
Parameters: {
anchorName: "my_anchor",
position: { x: 0, y: 1, z: 2 },
persistent: true
}4. Build and Deploy
Tool: build_xreal_apk
Parameters: {
buildType: "Development",
developmentBuild: true
}Architecture
+-------------------+ STDIO +-------------------+
| AI Assistant | <-----------> | Unity MCP |
| (Claude Code) | | Server (Node) |
+-------------------+ +--------+----------+
|
WebSocket (8090) |
v
+--------+----------+
| Unity Editor |
| + NRSDK |
+--------+----------+
|
USB/WiFi |
v
+--------+----------+
| Samsung S24 |
| + XREAL One Pro |
+-------------------+Development
# Build
npm run build
# Watch mode
npm run watch
# Run with MCP Inspector
npm run inspector
# Start
npm startFile Structure
unity-mcp/
├── src/
│ ├── index.ts # Server entry point
│ ├── unity/
│ │ └── mcpUnity.ts # Unity WebSocket bridge
│ ├── tools/
│ │ ├── *.ts # Core Unity tools (22)
│ │ └── xreal/ # XREAL tools (32)
│ │ ├── setupXrealProjectTool.ts
│ │ ├── enableHandTrackingTool.ts
│ │ ├── createSpatialAnchorTool.ts
│ │ └── ...
│ ├── resources/
│ │ ├── *.ts # Core Unity resources (7)
│ │ └── xreal/ # XREAL resources (6)
│ │ ├── getDeviceStateResource.ts
│ │ ├── getHandTrackingResource.ts
│ │ └── ...
│ ├── prompts/
│ │ ├── gameobjectHandlingPrompt.ts
│ │ └── xreal/ # XREAL prompts (4)
│ │ ├── xrealProjectSetupPrompt.ts
│ │ ├── handInteractionPrompt.ts
│ │ └── ...
│ └── utils/
│ ├── logger.ts
│ └── errors.ts # Includes XREAL error types
├── build/ # Compiled JavaScript
├── .mcp.json # MCP server configuration
└── package.jsonUnity Side Requirements
The MCP server sends JSON-RPC messages to Unity. You need a Unity C# plugin that:
Listens on WebSocket port 8090
Handles incoming tool/resource requests
Interfaces with NRSDK for XREAL features
Returns JSON responses with
{ success: true/false, ... }
Summary
Category | Count |
Core Unity Tools | 22 |
XREAL Tools | 32 |
Total Tools | 54 |
Core Resources | 7 |
XREAL Resources | 6 |
Total Resources | 13 |
Prompts | 5 |
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/joel-wehr/unity-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server