Supports building Unity projects for Android as one of the available build targets.
Supports building Unity projects for iOS as one of the available build targets.
Supports building Unity projects for Linux (StandaloneLinux64) as one of the available build targets.
Supports building Unity projects for macOS (StandaloneOSX) as one of the available build targets.
Utilizes Node.js as the runtime environment for the MCP server, with Node.js 18.x or higher required.
Implements the MCP server using TypeScript for type-safe development and better code organization.
Enables direct interaction with Unity projects, providing tools for script creation, asset management, shader creation, custom editor extensions, ProBuilder integration, package management, and project building for multiple platforms.
Supports building Unity projects for WebGL as one of the available build targets.
Unity MCP Server
A Model Context Protocol (MCP) server that enables AI assistants like Claude to interact with Unity projects programmatically. Supports both Claude Desktop integration and HTTP API for flexible development workflows.
Features
📦 Core Features
- Project Management: Set up and manage Unity projects with automatic validation
- Asset Creation: Create scripts, materials, shaders, and scenes
- Asset Management: Read, list, and update Unity assets
- Build Automation: Multi-platform builds with custom settings
- Render Pipeline Detection: Automatic detection of Built-in, URP, or HDRP
🔧 Material Management
- Material Creation: Auto-detects render pipeline for correct shader selection
- Shader Updates: Change material shaders with GUID management
- Property Editing: Update colors, floats, textures, and vectors
- Batch Conversion: Convert multiple materials to different shaders
- Material Reading: Inspect material properties and shader information
📝 Code Management
- Script Creation: Create C# scripts with proper namespace structure
- Script Updates: Update existing scripts with full content replacement
- Code Analysis: Diff comparison, duplicate class detection
- Namespace Management: Auto-suggest and apply namespaces based on file location
- Compilation Monitoring: Real-time compilation error tracking
🛠️ Advanced Features
- Editor Extensions: Custom windows, inspectors, property drawers
- Shader Creation: Built-in, URP, HDRP, Shader Graph support
- Unity Refresh: Automatic asset database refresh with batch operations
- Diagnostics: Compilation errors, asset validation, editor log analysis
Installation
Usage Options
Option 1: Claude Desktop (MCP stdio)
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Then use natural language in Claude Desktop:
- "Set Unity project to /path/to/project"
- "Create a 2D platformer with inventory system"
- "Generate a player controller with double jump"
Option 2: HTTP Server
- Start the HTTP server:
- Set up your Unity project:
- Analyze requirements with AI:
Documentation
- API Documentation - Complete HTTP API reference
- Available Tools - List of all MCP tools
- Documentation Index - All documentation
Key Endpoints
GET /health
- Health checkGET /api-docs
- API documentationPOST /api/project/setup
- Configure Unity projectPOST /api/ai/analyze
- Analyze requirementsPOST /api/system/player-controller
- Generate player controllerPOST /api/asset/create-script
- Create C# scriptsPOST /api/batch
- Execute batch operations
Usage Examples
Create a Player Controller
Generate Project Structure
Development
Configuration
Environment Variables
PORT
- HTTP server port (default: 3000)UNITY_PATH
- Path to Unity executable (auto-detected if not set)
Supported Platforms
- macOS
- Windows
- Linux
Unity Versions
- Unity 2021.3 LTS and newer
- Unity 6000.x (Unity 6)
Architecture
The server uses a modular service architecture:
- AI Core - Natural language processing and planning
- Service Layer - Unity project operations
- HTTP API - RESTful endpoints
- Template System - Code generation templates
Requirements
- Node.js 18.x or higher
- Unity 2021.3 LTS or newer
- npm or yarn
Contributing
See CONTRIBUTING.md for contribution guidelines.
License
MIT License - see LICENSE for details.
Acknowledgments
Built with:
- Express.js for HTTP server
- TypeScript for type safety
- Unity Editor integration
Support
For issues and feature requests, please use the GitHub issue tracker.
For direct tool usage, here are the available MCP tools:
Project Management
project_setup_path
- Set Unity project pathproject_read_info
- Get project information
Asset Creation & Management
asset_create_script
- Create C# scriptsasset_read_script
- Read script contentsasset_update_script
- Update script contentasset_list_scripts
- List all scriptsasset_create_scene
- Create Unity scenesasset_create_shader
- Create shaders (builtin, URP, HDRP, ShaderGraph)asset_read_shader
- Read shader contentasset_update_shader
- Update shader contentasset_list_shaders
- List all shadersasset_list_all
- List all assets by type
Editor Extensions
editor_create_script
- Create editor scriptseditor_list_scripts
- List editor scripts
Material Management
asset_create_material
- Create materials with auto-detected render pipelineasset_create_material_with_shader
- Create material with specific shaderasset_update_material_shader
- Change material shaderasset_update_material_properties
- Update material propertiesasset_read_material
- Read material propertiesasset_update_material
- Update entire material content (YAML)asset_clone_material
- Clone material with new nameasset_batch_convert_materials
- Batch convert materialsasset_list_materials
- List all materials
Code Analysis
code_analyze_diff
- Get detailed diff between filescode_detect_duplicates
- Detect duplicate class namescode_suggest_namespace
- Suggest namespace for filecode_apply_namespace
- Apply namespace to script
Compilation Tools
compile_get_errors
- Get compilation errors with contextcompile_get_status
- Get current compilation statuscompile_install_helper
- Install compilation monitoring helper
Build Operations
build_execute_project
- Build Unity project
System Operations
system_setup_refresh
- Setup Unity refresh handlersystem_refresh_assets
- Refresh Unity assetssystem_batch_start
- Start batch modesystem_batch_end
- End batch mode
Supported Build Targets
- StandaloneWindows64
- StandaloneOSX
- StandaloneLinux64
- iOS
- Android
- WebGL
Development
Scripts
npm run build
- Build the TypeScript projectnpm run dev
- Watch mode for developmentnpm start
- Run the built servernpm run clean
- Clean build directorynpm run test
- Run automated tests (when implemented)npm run test:manual
- Instructions for manual testing
Project Structure
Troubleshooting
Unity project not recognized
- Ensure the project path contains both
Assets
andProjectSettings
folders - Check file permissions
Build command fails
- Verify Unity is installed at the expected location
- For custom Unity installations, modify the Unity path in your fork
Script not found
- Scripts are searched recursively from the Assets folder
- Ensure the file has a .cs extension
Testing
The project includes comprehensive test cases with 100% feature coverage:
Comprehensive Test Suite
Automated Integration Tests
Manual Testing
Test Coverage
- 38 automated test cases covering all features
- 10 test categories: Project, Scripts, Assets, Shaders, Editor, ProBuilder, Packages, Refresh, Build, Errors
- Automatic cleanup after test execution
- Performance metrics for each test
- Test Documentation: See tests/README.md for testing guide
- Test Cases: Comprehensive test coverage in
tests/
directory
Recent Updates
v2.2.0 (2025-06-06)
- Added shader and material update features
- Implemented temporary backup system with automatic cleanup
- Added material cloning functionality
- Enhanced shader GUID caching and lookup
- Added comprehensive read operations for shaders
v2.1.0 (2025-06-06)
- Fixed shader-material GUID reference issues
- Added meta file generation for all Unity assets
- Improved custom shader detection and lookup
- Enhanced material creation with proper shader references
- Added comprehensive debugging and logging
See CHANGELOG.md for full version history.
Known Issues and Solutions
Custom Shader References
When creating custom shaders, use the full shader name (including "Custom/" prefix) when creating materials:
Contributing
See CONTRIBUTING.md for development setup and contribution guidelines.
Repository
Recommended repository name: mcp-server-unity
This follows the MCP ecosystem naming convention where MCP servers are prefixed with mcp-server-
.
License
MIT License - see LICENSE file for details.
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
A Model Context Protocol server that enables Claude to interact directly with Unity projects, providing tools for script creation, asset management, and project building.
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol server that allows Claude to interact with Linear's API for managing teams, issues, projects, and cycles.Last updated -181TypeScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server that allows Claude to make API requests on your behalf, providing tools for testing various APIs including HTTP requests and OpenAI integrations without sharing your API keys in the chat.Last updated -Python
- -securityAlicense-qualityA Model Context Protocol server that integrates Claude with Blender, enabling users to analyze and interact with IFC (Industry Foundation Classes) building models through natural language commands.Last updated -9PythonMIT License
- -securityFlicense-qualityModel Context Protocol server that enables Claude to retrieve and analyze code from GitHub repositories through the uithub API.Last updated -229JavaScript