UnityMCPIntegration
A server that enables AI assistants to understand and interact with Unity projects in real-time, providing access to scene hierarchy, project settings, and the ability to execute code directly in the Unity Editor.
A server that enables AI assistants to understand and interact with Unity projects in real-time, providing access to scene hierarchy, project settings, and the ability to execute code directly in the Unity Editor.
This package provides a seamless integration between Model Context Protocol (MCP) and Unity Editor, allowing AI assistants to understand and interact with your Unity projects in real-time. With this integration, AI assistants can access information about your scene hierarchy, project settings, and execute code directly in the Unity Editor context.
You have several options to install the Unity package:
Option A: Package Manager (Git URL)
1. Open the Unity Package Manager (Window > Package Manager
)
2. Click the +
button and select Add package from git URL...
3. Enter the repository URL: https://github.com/quazaai/UnityMCPIntegration.git
4. Click Add
Option B: Import Custom Package
1. Clone this repository or download it as a unityPackage
2. In Unity, go to Assets > Import Package > Custom Package
3. Select the UnityMCPIntegration.unitypackage
file
You have two options to run the MCP server:
Option A: Run the server directly
mcpServer (likely <path-to-project>LibraryPackageCachecom.quaza.unitymcp@d2b8f1260bcamcpServer)
directorynpm install
node build/index.js
Option B: Add to MCP Host configuration
Add the server to your MCP Host configuration for Claude Desktop, Custom Implementation etc
{
"mcpServers": {
"unity-mcp-server": {
"command": "node",
"args": [
"path-to-project>LibraryPackageCachecom.quaza.unitymcp@d2b8f1260bcamcpServermcpServerbuildindex.js"
],
"env": {
"MCP_WEBSOCKET_PORT": "5010"
}
}
}
}
To install Unity MCP Integration for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @quazaai/unitymcpintegration --client claude
You can open the MCP Debug window in Unity to monitor the connection and test features:
Window > MCP Debug
The Unity MCP integration provides several tools to AI assistants:
File paths can be absolute or relative to the Unity project's Assets folder. For example, "Scenes/MyScene.unity"
refers to <project>/Assets/Scenes/MyScene.unity
.
The integration consists of two main components:
Communication between them happens via WebSocket, transferring JSON messages for commands and data.
The Unity MCP integration now includes powerful filesystem tools that allow AI assistants to:
All file operations are restricted to the Unity project directory for security. The system intelligently handles both absolute and relative paths, always resolving them relative to your project's Assets folder for convenience.
Example usages:
- Get a directory listing: list_directory(path: "Scenes")
- Read a script file: read_file(path: "Scripts/Player.cs")
- Edit a configuration file: edit_file(path: "Resources/config.json", edits: [{oldText: "value: 10", newText: "value: 20"}], dryRun: true)
- Find all materials: find_assets_by_type(assetType: "Material")
Contributions are welcome! Here's how you can contribute:
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)Unity Side:
- Open the project in Unity
- Modify the C# scripts in the UnityMCPConnection/Editor
directory
Server Side:
- Navigate to the mcpServer
directory
- Install dependencies: npm install
- Make changes to the TypeScript files in the src
directory
- Build the server: npm run build
- Run the server: node build/index.js
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please file an issue on the GitHub repository.