Unity MCP Integration
STDIOSeamless integration between MCP and Unity Editor for AI assistants to interact with projects.
Seamless integration between MCP and Unity Editor for AI assistants to interact with projects.
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)
Window > Package Manager
)+
button and select Add package from git URL...
https://github.com/quazaai/UnityMCPIntegration.git
Add
Option B: Import Custom Package
Assets > Import Package > Custom Package
UnityMCPIntegration.unitypackage
fileYou have two options to run the MCP server:
Option A: Run the server directly
mcpServer (likely <path-to-project>\Library\PackageCache\com.quaza.unitymcp@d2b8f1260bca\mcpServer\)
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>\\Library\\PackageCache\\com.quaza.unitymcp@d2b8f1260bca\\mcpServer\\mcpServer\\build\\index.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:
list_directory(path: "Scenes")
read_file(path: "Scripts/Player.cs")
edit_file(path: "Resources/config.json", edits: [{oldText: "value: 10", newText: "value: 20"}], dryRun: true)
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:
UnityMCPConnection/Editor
directoryServer Side:
mcpServer
directorynpm install
src
directorynpm run build
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.