MCP For Unity
This project implements a Model Context Protocol (MCP) server that acts as a bridge to the Unity Editor.
Structure
- Server/: Contains the Python MCP server that AI clients connect to.
- Scripts/: Contains the Unity C# scripts.
- package.json: Unity Package definition file.
Installation
1. Unity Setup (via Package Manager)
You can install the Unity integration directly from GitHub using the Unity Package Manager.
- Open Unity.
- Go to Window > Package Manager.
- Click the + button in the top-left corner.
- Select Add package from git URL....
- Enter the following URL:
https://github.com/yunuscan/MCPForUnity.git - Click Add.
2. Python Server Setup (via Unity Editor)
- In Unity, go to UnityMCP > Dashboard.
- Click Install 'uv' and Requirements.
- Click Start Python MCP Server (uv run) to test the connection.
3. Client Configuration (VS Code / Copilot / Claude)
To use this with your AI assistant:
- Open the UnityMCP > Dashboard window.
- Click Configure for VS Code (Copilot).
- This will generate a
.vscode/mcp.jsonfile in your project root. - It will also create a
tasks.jsonto easily run the server.
- This will generate a
- Alternatively, copy the JSON config manually for Claude Desktop or Cursor.
Usage
- Ensure the Unity project is open.
- Connect your AI client using the generated configuration.
- Ask your AI to "Create a cube" or "Check console logs".
