Unity MCP Server
Integrations
Supports containerized deployment of the MCP server, allowing the Unity tools to be run in an isolated environment with proper project mounting.
Offers integration through the repository hosting, with the server code available at a GitHub repository (unity-smithery-mcp).
Built on Node.js as a runtime environment, requiring Node.js 16+ to operate.
Unity MCP Server
A Model Context Protocol (MCP) server for Unity game development, enabling AI assistants to interact with Unity projects through a set of specialized tools.
Overview
The Unity MCP Server provides a bridge between AI assistants (like Cursor AI or Claude) and Unity projects. It offers tools for:
- Reading and searching files in Unity projects
- Parsing Unity scenes and prefabs
- Analyzing C# code and detecting errors
- Running automated tests in batch mode
- Generating scripts from templates
- Validating shaders
- And more...
The server is designed to run with Unity in batch mode, allowing for operations that require the Unity engine without needing the Editor GUI.
Installation
Prerequisites
- Node.js 16+
- Unity 2022.3 LTS or newer (recommended)
Setup
- Clone this repository:Copy
- Install dependencies:Copy
- Build the project:Copy
Configuration
The server uses the config
package for configuration. Edit config/default.json
to adjust settings:
Usage
Starting the Server
To run in Smithery mode:
Using with AI Assistants
This server is primarily designed to work with AI assistants through tools defined in the MCP specification. For Cursor or Smithery.ai integration, follow their documentation to connect to this MCP server.
Available Tools
Tool Name | Description |
---|---|
open_file | Reads the contents of a file in the Unity project |
search_files | Searches for text patterns in project files |
list_assets | Lists project assets of a certain type or in a folder |
get_project_info | Gets high-level information about the Unity project |
parse_scene | Parses a Unity scene file to extract game objects hierarchy |
parse_prefab | Parses a Unity prefab file to extract components |
find_in_scenes | Finds scenes containing a specific GameObject or component |
analyze_cs_code | Compiles C# code to find compiler errors |
find_references | Finds references to a C# class or method |
generate_script | Creates a new C# script file from a template |
validate_shader | Compiles a shader and reports errors |
inspect_yaml | Inspects a YAML asset file |
run_tests | Runs Unity's automated tests in batch mode |
simulate_playmode | Experimental - runs a scene in play mode for a short duration |
Docker Support
A Dockerfile is included for containerized deployment. Build the Docker image:
Run the container:
Smithery.ai Integration
This server can be deployed on Smithery.ai using the provided smithery.yaml
configuration.
License
MIT
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
This server cannot be installed
A protocol server that bridges AI assistants with Unity projects, allowing them to analyze code, parse scenes, generate scripts, and perform other Unity operations through specialized tools.