A powerful, free and open source Model Context Protocol (MCP) server that enables seamless Unity Editor integration with any MCP-compatible AI client or coding assistant (Claude Code, Cursor, Windsurf, and more). Control Unity projects through natural language commands powered by AI — no subscription or paid license required.
This is a community-driven alternative to the official Unity AI Assistant's MCP integration (which requires a Unity AI subscription for Personal users beyond a short trial).
- 🎯 43 Unity Tools - Comprehensive project, scene, asset, code, and build management
- 👁️ Viewport Capture - AI can "see" the Unity scene, enabling visual feedback loops
- ⏱️ Runtime Observation - AI records property changes over time during Play Mode — the temporal debugger that closes the build→test→fix loop
- 🎮 Input Simulation - AI can play the game by sending keyboard/mouse input during Play Mode
- 🔄 Real-time Integration - Direct Unity Editor communication via HTTP API
- 🤖 AI-Powered - Natural language commands for complex Unity operations
- 🛠️ Extensible - Easy to add custom tools for specific project needs
- 📱 Cross-Platform - Works on Windows, macOS, and Linux
- 🚀 Zero Config - Auto-discovery and setup for new Unity projects
MCP Client ←→ Node.js MCP Server ←→ Unity Editor C# Plugin
│ │ │
AI Commands Protocol Bridge Unity API
Complete AI Development Loop:
Build ──→ Run ──→ Observe ──→ Evaluate ──→ Fix ──→ Build
│ │ │ │ │
code.* play.* observe AI reasons code.*
scene.* enter (time- on temporal scene.*
asset.* series) data + stats
- Node.js MCP Server (
Server/) - Handles MCP client communication and tool routing - Unity C# Plugin (
Unity/) - Executes commands directly in Unity Editor - Python Client (
unity_mcp_client.py) - Test client for development
Any MCP-compatible client or AI coding assistant that supports the Model Context Protocol (stdio or HTTP transport). Common examples include various AI-powered IDEs and extensions. See CLIENT_CONFIGS.md for configuration patterns.
- Unity 2022.3+
- Node.js 18+
- An MCP-compatible AI client or coding assistant
-
Clone the repository:
git clone https://github.com/isekream/Unity_MCP.git cd Unity_MCP -
Install Node.js dependencies:
cd Server npm install npm run build cd ..
-
Configure Your AI IDE:
Configuration varies by IDE. See CLIENT_CONFIGS.md for detailed examples.
Quick Example: Add a server entry to your MCP client's configuration file (exact location depends on the client; see CLIENT_CONFIGS.md for common patterns):
{ "mcpServers": { "unity-mcp": { "command": "node", "args": ["/absolute/path/to/UnityMCP/Server/build/index.js"], "env": { "NODE_ENV": "production", "UNITY_PORT": "8090" } } } }See CLIENT_CONFIGS.md for configuration details for popular clients.
-
Install Unity Plugin:
- Open Unity Editor with your project
- Go to
Window > Package Manager - Click
+→Add package from git URL... - Enter:
https://github.com/isekream/Unity_MCP.git?path=/Unity
-
Start the Unity MCP Server:
- In Unity: go to Tools > Unity MCP > Server Window (opens the control window)
- Click the Start Server button
- Look for the log message "MCP Server started on port 8090"
- The window should show status "Running" at http://localhost:8090
-
Restart Your AI IDE to load the MCP server
project.analyze- Comprehensive project analysis and structure overviewproject.getInfo- Get basic project information and settingsproject.setSettings- Modify project configuration and player settingsproject.listScenes- List all scenes in build settings with statusproject.getBuildSettings- Get current build configurationproject.setBuildTarget- Change active build target platformproject.refreshAssets- Force refresh of project assets database
scene.createGameObject- Create GameObjects with components and hierarchyscene.modifyComponent- Add, remove, or update component propertiesscene.query- Query scene hierarchy and find objects by criteriascene.selectObjects- Select and focus objects in Scene/Hierarchy viewscene.deleteGameObject- Remove GameObjects and children safelyscene.moveGameObject- Transform position, rotation, scale, and parentingscene.save- Save current scene or all open scenesscene.load- Open and switch between project scenesscene.capture- Capture viewport screenshot for AI visual inspection
assets.import- Import files with custom import settingsassets.createMaterial- Generate materials with shader propertiesassets.managePrefabs- Create, modify, and instantiate prefab assetsassets.organize- Folder operations, moving, and organizing project assetsassets.search- Find assets by name, type, or propertiesassets.createTexture- Generate procedural textures and import imagespackages.manage- Install, update, and remove Unity packagesassets.getInfo- Get detailed information about selected assets
code.createScript- Generate C# scripts from templates or descriptionscode.analyzeScripts- Parse existing scripts and extract informationcode.attachScripts- Attach MonoBehaviour scripts to GameObjectscode.findReferences- Find script and component usage across projectcode.refactor- Rename, move, and restructure code safelycode.generateDocumentation- Auto-generate XML documentationcode.validate- Check scripts for common issues and best practicescode.format- Format and style code according to conventions
build.configure- Set build settings, scenes, and platform optionsbuild.execute- Trigger builds for target platformsbuild.runTests- Execute Unity Test Runner and get resultsbuild.getReport- Get detailed build reports and statisticsbuild.clean- Clean build cache and temporary filesbuild.addressables- Manage Addressable Asset System configurationbuild.optimize- Analyze and optimize build size and performancebuild.getConsoleLogs- Retrieve Unity Console messages and errorsbuild.profile- Performance profiling and optimization suggestions
playmode.getState- Check if game is playing, paused, or stoppedplaymode.enter- Enter Play Mode to run the gameplaymode.exit- Exit Play Mode and return to Edit Modeplaymode.pause- Pause the running gameplaymode.resume- Resume a paused gameplaymode.step- Advance by N frames for frame-by-frame debuggingplaymode.inspectGameObject- Inspect live runtime component valuesplaymode.setProperty- Modify component properties at runtimeplaymode.invokeMethod- Call public methods on components during Play Modeplaymode.getConsoleLogs- Retrieve runtime console logs and errorsplaymode.getRuntimeInfo- Get FPS, memory, physics stats, and time infoplaymode.setTimeScale- Change game speed (slow-motion, fast-forward)playmode.observe- Record property values over time during Play Mode — the AI's temporal debugger. Tracks transforms, velocities, custom fields across multiple frames and returns structured time-series with summary stats (min/max/mean/delta). Optionally simulates input to test behavior end-to-end.playmode.simulateInput- Send keyboard/mouse input to the running game. Supports press, release, and tap actions. Works with both legacy Input and new Input System.
memory.status- Inspect the current state of the project's long-term memorymemory.rebuild- Deeply index scripts, design docs, and intent into a queryable modelmemory.query- Ask natural-language questions against accumulated project knowledge and past insightsmemory.recordInsight- Explicitly store design decisions, measured results, and learnings from observationsmemory.getDesignDoc/memory.updateDesignDoc- Read and maintain a living design document that captures the "soul" and current truth of the game
This layer gives the AI persistent, project-specific memory and taste that compounds across sessions.
Built on top of memory + observation, the Lab lets the AI run rigorous, data-driven experiments at scale:
- Define hypotheses and parameter spaces tied to your living design goals
- Automatically execute dozens of instrumented play sessions using the existing runtime observation and input simulation systems
- Measure results quantitatively and visually
- Evolve mechanics toward what actually feels good for this game
- Apply winning variants with full audit trail back into memory
This is the closest thing that currently exists to giving an AI a real game design research lab inside Unity.
Ask your AI IDE:
"Analyze my Unity project and show me the structure"
→ Executes: project.analyze
"Create a player character with movement controls in the scene"
→ Executes: scene.createGameObject, code.createScript, code.attachScripts
"Build my project for Android with development settings"
→ Executes: build.configure, build.setBuildTarget, build.execute
"Find all scripts that use the PlayerController component"
→ Executes: code.findReferences
"Create a fire particle system with appropriate materials"
→ Executes: scene.createGameObject, assets.createMaterial, assets.managePrefabs
The AI can now build features, play-test them, and self-correct without human intervention. More importantly, it can remember what worked, what didn't, and why — across many sessions.
After a successful tuning pass using playmode.observe, the agent should call memory.recordInsight with the measured results and rationale. Over time this creates a living project model that makes every subsequent interaction dramatically more grounded and effective.
"Create a WASD player controller, enter play mode, verify the player moves at 5 units/sec"
→ AI creates script → attaches to Player → enters Play Mode
→ Executes: playmode.observe with simulateInput key="w"
→ AI reads time-series: position delta over 2s = (0, 0, 10.1) → speed ≈ 5.05 u/s ✓
"The jump feels too floaty — make it snappier"
→ AI increases gravity scale → enters Play Mode
→ Executes: playmode.observe on Rigidbody.velocity with simulateInput key="space"
→ AI reads velocity curve: apex reached in 0.3s, descent in 0.4s → adjusts until symmetric
"Test that enemies patrol between waypoints correctly"
→ Executes: playmode.observe on Enemy/Transform.position for 5s at 10Hz
→ AI reads position time-series: enemy oscillates between (0,0,0) and (10,0,0) ✓
This is the highest-leverage capability:
- Agent explores and tunes using
playmode.observe+simulateInput - After every meaningful session, it calls
memory.recordInsightwith the actual measured results - Later (next day, next week, new team member), the agent calls
memory.queryormemory.suggest - The suggestions are now grounded in the real history and design intent of this specific game
Example flow an advanced agent will follow:
memory.status
memory.rebuild
memory.query "What have we learned about movement feel so far?"
memory.suggest "Make the coyote time feel more generous without breaking precision"
... implement ...
playmode.observe + simulateInput
memory.recordInsight "Coyote time of 0.18s produced the best player feedback in testing"
memory.updateDesignDoc (with new known-good values)
Over time this creates a project that genuinely gets better at being worked on by AI.
You can test tools directly using the Python client:
# Analyze project structure
python3 unity_mcp_client.py project.analyze
# Get project info
python3 unity_mcp_client.py project.getInfo
# Create a cube in the scene
python3 unity_mcp_client.py scene.createGameObject '{"name": "TestCube", "primitive": "Cube"}'
# List all scenes
python3 unity_mcp_client.py project.listScenes
# Get build settings
python3 unity_mcp_client.py project.getBuildSettings-
Server Settings:
- Port: 8090 (default, configurable)
- Timeout: 10 seconds (configurable)
- Auto-start: Optional for convenience
-
Tool Categories:
- All tools are auto-registered on Unity Editor startup
- Custom tools can be added by extending
McpToolBase
| Variable | Description | Default |
|---|---|---|
UNITY_PORT |
Unity Editor HTTP server port | 8090 |
NODE_ENV |
Node.js environment mode | production |
REQUEST_TIMEOUT |
Tool execution timeout (seconds) | 10 |
LOG_LEVEL |
Logging verbosity | info |
-
Create Unity Tool (C#):
public class MyCustomTool : McpToolBase { public override string ToolName => "custom_mytool"; public override string Description => "My custom Unity tool"; public override string Category => "custom"; public override object Execute(object parameters) { // Your Unity API calls here return CreateSuccessResponse(result); } }
-
Register in Unity Server:
// In McpUnityServer.InitializeTools() RegisterTool(new MyCustomTool());
-
Add Node.js Tool (TypeScript):
// In Server/src/tools/custom-tools.ts export const myCustomTool: Tool = { name: 'custom.mytool', description: 'My custom Unity tool', inputSchema: { /* JSON schema */ }, handler: async (params) => { return await unityClient.sendRequest('custom.mytool', params); } };
# Build Node.js server
cd Server
npm run build
# Run tests
npm test
# Start development server with hot reload
npm run dev
# Test specific tool
python3 unity_mcp_client.py your.tool '{"param": "value"}'-
"Connection refused":
- Ensure Unity Editor is running
- Check Unity MCP Server window shows "Running"
- Verify port 8090 is not blocked
-
"Tool execution timed out":
- Unity Editor may be busy or not responding
- Increase timeout in Unity MCP Server settings
- Check Unity Console for errors
-
"Tool not found":
- Verify tool is registered in Unity C# server
- Check Node.js server logs for tool registration
- Ensure tool name format matches (category.action)
-
MCP not appearing in your IDE:
- Restart your AI IDE after configuration changes
- Check MCP configuration file syntax (see CLIENT_CONFIGS.md)
- Verify Node.js server builds without errors
# Test Unity connection
curl -X POST http://localhost:8090 -H "Content-Type: application/json" -d '{"id":"test","type":"request","method":"project.getInfo","params":{}}'
# Check Node.js server status
node Server/build/index.js --test
# Validate MCP configuration (location is client-specific; see CLIENT_CONFIGS.md)Unity_MCP/
├── Server/ # Node.js MCP Server
│ ├── src/ # TypeScript source code
│ │ ├── tools/ # Tool implementations
│ │ ├── unity-client.ts # Unity communication client
│ │ └── index.ts # Main server entry point
│ ├── build/ # Compiled JavaScript
│ └── package.json # Node.js dependencies
├── Unity/ # Unity C# Plugin
│ ├── Editor/ # Unity Editor scripts
│ │ ├── Tools/ # Individual MCP tools
│ │ └── McpUnityServer.cs # Main Unity HTTP server
│ └── package.json # Unity package definition
├── unity_mcp_client.py # Python test client
├── mcp.json # Local MCP configuration
└── README.md # This documentation
Contributions are welcome from everyone!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-tool) - Add your tool following the established patterns
- Write tests and documentation
- Submit a pull request
- Follow Unity C# coding conventions
- Use TypeScript for Node.js components
- Include comprehensive error handling
- Add parameter validation and helpful error messages
- Document all public APIs and tool parameters
- Test tools with various Unity project configurations
MIT License - see the LICENSE file for details.
- Unity Technologies for the comprehensive Editor API
- Anthropic for the Model Context Protocol (MCP) specification
- MCP client developers and the Model Context Protocol community for the integration standard
- Open source contributors, beta testers, and the Unity and AI development community
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📧 Email: [email protected] (or use GitHub issues for faster community support)
- 📖 Docs: Wiki
Made with ❤️ for the Unity and AI development community