MCP Unity is an implementation of the Model Context Protocol for Unity Editor, allowing AI assistants to interact with your Unity projects. This package provides a bridge between Unity and a Node.js server that implements the MCP protocol, enabling AI agents like Cursor, Windsurf, Claude Code, Codex CLI, GitHub Copilot, and Google Antigravity to execute operations within the Unity Editor. MCP Unit
Add this skill
npx mdskills install CoderGamester/mcp-unityComprehensive Unity Editor integration with 30+ well-documented MCP tools for scene manipulation and project management
1# MCP Unity Editor (Game Engine)23[](https://modelcontextprotocol.io/introduction)4[](https://unity.com/releases/editor/archive)5[](https://nodejs.org/en/download/)6[](https://github.com/CoderGamester/mcp-unity/stargazers)7[](https://github.com/CoderGamester/mcp-unity/commits/main)8[](https://opensource.org/licenses/MIT)910| [๐บ๐ธEnglish](README.md) | [๐จ๐ณ็ฎไฝไธญๆ](README_zh-CN.md) | [๐ฏ๐ตๆฅๆฌ่ช](README-ja.md) |11|----------------------|---------------------------------|----------------------|1213```14 ,/(/. *(/,15 */(((((/. *((((((*.16 .*((((((((((/. *((((((((((/.17 ./((((((((((((((/ *((((((((((((((/,18 ,/(((((((((((((/*. */(((((((((((((/*.19 ,%%#((/((((((* ,/(((((/(#&@@(20 ,%%##%%##((((((/*. ,/((((/(#&@@@@@@(21 ,%%######%%##((/(((/*. .*/(((//(%@@@@@@@@@@@(22 ,%%####%#(%%#%%##((/((((((((//#&@@@@@@&@@@@@@@@(23 ,%%####%( /#%#%%%##(//(#@@@@@@@%, #@@@@@@@(24 ,%%####%( *#%###%@@@@@@( #@@@@@@@(25 ,%%####%( #%#%@@@@, #@@@@@@@(26 ,%%##%%%( #%#%@@@@, #@@@@@@@(27 ,%%%#* #%#%@@@@, *%@@@(28 ., ,/##*. #%#%@@@@, ./&@#* *`29 ,/#%#####%%#/, #%#%@@@@, ,/&@@@@@@@@@&\.30 `*#########%%%%###%@@@@@@@@@@@@@@@@@@&*ยด31 `*%%###########%@@@@@@@@@@@@@@&*ยด32 `*%%%######%@@@@@@@@@@&*ยด33 `*#%%##%@@@@@&*ยด34 `*%#%@&*ยด3536 โโโโ โโโโ โโโโโโโโโโโโโโ โโโ โโโโโโโ โโโโโโโโโโโโโโโโโโ โโโ37 โโโโโ โโโโโโโโโโโโโโโโโโโโโ โโโ โโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโ38 โโโโโโโโโโโโโโ โโโโโโโโ โโโ โโโโโโโโโ โโโโโโ โโโ โโโโโโโ39 โโโโโโโโโโโโโโ โโโโโโโ โโโ โโโโโโโโโโโโโโโโ โโโ โโโโโ40 โโโ โโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโ โโโ โโโ41 โโโ โโโ โโโโโโโโโโ โโโโโโโ โโโ โโโโโโโโ โโโ โโโ42```4344MCP Unity is an implementation of the Model Context Protocol for Unity Editor, allowing AI assistants to interact with your Unity projects. This package provides a bridge between Unity and a Node.js server that implements the MCP protocol, enabling AI agents like Cursor, Windsurf, Claude Code, Codex CLI, GitHub Copilot, and Google Antigravity to execute operations within the Unity Editor.4546## Features4748### IDE Integration - Package Cache Access4950MCP Unity provides automatic integration with VSCode-like IDEs (Visual Studio Code, Cursor, Windsurf, Google Antigravity) by adding the Unity `Library/PackedCache` folder to your workspace. This feature:5152- Improves code intelligence for Unity packages53- Enables better autocompletion and type information for Unity packages54- Helps AI coding assistants understand your project's dependencies5556### MCP Server Tools5758The following tools are available for manipulating and querying Unity scenes and GameObjects via MCP:5960- `execute_menu_item`: Executes Unity menu items (functions tagged with the MenuItem attribute)61 > **Example prompt:** "Execute the menu item 'GameObject/Create Empty' to create a new empty GameObject"6263- `select_gameobject`: Selects game objects in the Unity hierarchy by path or instance ID64 > **Example prompt:** "Select the Main Camera object in my scene"6566- `update_gameobject`: Updates a GameObject's core properties (name, tag, layer, active/static state), or creates the GameObject if it does not exist67 > **Example prompt:** "Set the Player object's tag to 'Enemy' and make it inactive"6869- `update_component`: Updates component fields on a GameObject or adds it to the GameObject if it does not contain the component70 > **Example prompt:** "Add a Rigidbody component to the Player object and set its mass to 5"7172- `add_package`: Installs new packages in the Unity Package Manager73 > **Example prompt:** "Add the TextMeshPro package to my project"7475- `run_tests`: Runs tests using the Unity Test Runner76 > **Example prompt:** "Run all the EditMode tests in my project"7778- `send_console_log`: Send a console log to Unity79 > **Example prompt:** "Send a console log to Unity Editor"8081- `add_asset_to_scene`: Adds an asset from the AssetDatabase to the Unity scene82 > **Example prompt:** "Add the Player prefab from my project to the current scene"8384- `create_prefab`: Creates a prefab with optional MonoBehaviour script and serialized field values85 > **Example prompt:** "Create a prefab named 'Player' from the 'PlayerController' script"8687- `create_scene`: Creates a new scene and saves it to the specified path88 > **Example prompt:** "Create a new scene called 'Level1' in the Scenes folder"8990- `load_scene`: Loads a scene by path or name, with optional additive loading91 > **Example prompt:** "Load the MainMenu scene"9293- `delete_scene`: Deletes a scene by path or name and removes it from Build Settings94 > **Example prompt:** "Delete the old TestScene from my project"9596- `get_gameobject`: Gets detailed information about a specific GameObject including all components97 > **Example prompt:** "Get the details of the Player GameObject"9899- `get_console_logs`: Retrieves logs from the Unity console with pagination support100 > **Example prompt:** "Show me the last 20 error logs from the Unity console"101102- `recompile_scripts`: Recompiles all scripts in the Unity project103 > **Example prompt:** "Recompile scripts in my Unity project"104105- `save_scene`: Saves the current active scene, with optional Save As to a new path106 > **Example prompt:** "Save the current scene" or "Save the scene as 'Assets/Scenes/Level2.unity'"107108- `get_scene_info`: Gets information about the active scene including name, path, dirty state, and all loaded scenes109 > **Example prompt:** "What scenes are currently loaded in my project?"110111- `unload_scene`: Unloads a scene from the hierarchy (does not delete the scene asset)112 > **Example prompt:** "Unload the UI scene from the hierarchy"113114- `duplicate_gameobject`: Duplicates a GameObject in the scene with optional renaming and reparenting115 > **Example prompt:** "Duplicate the Enemy prefab 5 times and rename them Enemy_1 through Enemy_5"116117- `delete_gameobject`: Deletes a GameObject from the scene118 > **Example prompt:** "Delete the old Player object from the scene"119120- `reparent_gameobject`: Changes the parent of a GameObject in the hierarchy121 > **Example prompt:** "Move the HealthBar object to be a child of the UI Canvas"122123- `move_gameobject`: Moves a GameObject to a new position (local or world space)124 > **Example prompt:** "Move the Player object to position (10, 0, 5) in world space"125126- `rotate_gameobject`: Rotates a GameObject to a new rotation (local or world space, Euler angles or quaternion)127 > **Example prompt:** "Rotate the Camera 45 degrees on the Y axis"128129- `scale_gameobject`: Scales a GameObject to a new local scale130 > **Example prompt:** "Scale the Enemy object to twice its size"131132- `set_transform`: Sets position, rotation, and scale of a GameObject in a single operation133 > **Example prompt:** "Set the Cube's position to (0, 5, 0), rotation to (0, 90, 0), and scale to (2, 2, 2)"134135- `create_material`: Creates a new material with specified shader and saves it to the project136 > **Example prompt:** "Create a red material called 'EnemyMaterial' using the URP Lit shader"137138- `assign_material`: Assigns a material to a GameObject's Renderer component139 > **Example prompt:** "Assign the 'EnemyMaterial' to the Enemy GameObject"140141- `modify_material`: Modifies properties of an existing material (colors, floats, textures)142 > **Example prompt:** "Change the color of 'EnemyMaterial' to blue and set metallic to 0.8"143144- `get_material_info`: Gets detailed information about a material including shader and all properties145 > **Example prompt:** "Show me all the properties of the 'PlayerMaterial'"146147- `batch_execute`: Executes multiple tool operations in a single batch request, reducing round-trips and enabling atomic operations with optional rollback on failure148 > **Example prompt:** "Create 10 empty GameObjects named Enemy_1 through Enemy_10 in a single batch operation"149150### MCP Server Resources151152- `unity://menu-items`: Retrieves a list of all available menu items in the Unity Editor to facilitate `execute_menu_item` tool153 > **Example prompt:** "Show me all available menu items related to GameObject creation"154155- `unity://scenes-hierarchy`: Retrieves a list of all game objects in the current Unity scene hierarchy156 > **Example prompt:** "Show me the current scenes hierarchy structure"157158- `unity://gameobject/{id}`: Retrieves detailed information about a specific GameObject by instance ID or object path in the scene hierarchy, including all GameObject components with it's serialized properties and fields159 > **Example prompt:** "Get me detailed information about the Player GameObject"160161- `unity://logs`: Retrieves a list of all logs from the Unity console162 > **Example prompt:** "Show me the recent error messages from the Unity console"163164- `unity://packages`: Retrieves information about installed and available packages from the Unity Package Manager165 > **Example prompt:** "List all the packages currently installed in my Unity project"166167- `unity://assets`: Retrieves information about assets in the Unity Asset Database168 > **Example prompt:** "Find all texture assets in my project"169170- `unity://tests/{testMode}`: Retrieves information about tests in the Unity Test Runner171 > **Example prompt:** "List all available tests in my Unity project"172173## Requirements174- Unity 6 or later - to [install the server](#install-server)175- Node.js 18 or later - to [start the server](#start-server)176- npm 9 or later - to [debug the server](#debug-server)177178> [!NOTE]179> **Project Paths with Spaces**180>181> MCP Unity supports project paths containing spaces. However, if you experience connection issues, try moving your project to a path without spaces as a troubleshooting step.182>183> **Examples:**184> - โ **Recommended:** `C:\Users\YourUser\Documents\UnityProjects\MyAwesomeGame`185> - โ **Supported:** `C:\Users\Your User\Documents\Unity Projects\My Awesome Game`186187## <a name="install-server"></a>Installation188189Installing this MCP Unity Server is a multi-step process:190191### Step 1: Install Node.js192> To run MCP Unity server, you'll need to have Node.js 18 or later installed on your computer:193194195196<details>197<summary><span style="font-size: 1.1em; font-weight: bold;">Windows</span></summary>1981991. Visit the [Node.js download page](https://nodejs.org/en/download/)2002. Download the Windows Installer (.msi) for the LTS version (recommended)2013. Run the installer and follow the installation wizard2024. Verify the installation by opening PowerShell and running:203 ```bash204 node --version205 ```206</details>207208<details>209<summary><span style="font-size: 1.1em; font-weight: bold;">macOS</span></summary>2102111. Visit the [Node.js download page](https://nodejs.org/en/download/)2122. Download the macOS Installer (.pkg) for the LTS version (recommended)2133. Run the installer and follow the installation wizard2144. Alternatively, if you have Homebrew installed, you can run:215 ```bash216 brew install node@18217 ```2185. Verify the installation by opening Terminal and running:219 ```bash220 node --version221 ```222</details>223224### Step 2: Install Unity MCP Server package via Unity Package Manager2251. Open the Unity Package Manager (Window > Package Manager)2262. Click the "+" button in the top-left corner2273. Select "Add package from git URL..."2284. Enter: `https://github.com/CoderGamester/mcp-unity.git`2295. Click "Add"230231232233### Step 3: Configure AI LLM Client234235<details open>236<summary><span style="font-size: 1.1em; font-weight: bold;">Option 1: Configure using Unity Editor</span></summary>2372381. Open the Unity Editor2392. Navigate to Tools > MCP Unity > Server Window2403. Click on the "Configure" button for your AI LLM client as shown in the image below2412422432444. Confirm the configuration installation with the given popup245246247248</details>249250<details>251<summary><span style="font-size: 1.1em; font-weight: bold;">Option 2: Configure Manually</span></summary>252253Open the MCP configuration file of your AI client and add the MCP Unity server configuration:254255> Replace `ABSOLUTE/PATH/TO` with the absolute path to your MCP Unity installation or just copy the text from the Unity Editor MCP Server window (Tools > MCP Unity > Server Window).256257**For JSON-based clients** (Cursor, Windsurf, Claude Code, GitHub Copilot, etc.):258259```json260{261 "mcpServers": {262 "mcp-unity": {263 "command": "node",264 "args": [265 "ABSOLUTE/PATH/TO/mcp-unity/Server~/build/index.js"266 ]267 }268 }269}270```271272**For Codex CLI** (`~/.codex/config.toml`):273274```toml275[mcp_servers.mcp-unity]276command = "node"277args = ["ABSOLUTE/PATH/TO/mcp-unity/Server~/build/index.js"]278```279280</details>281282## <a name="start-server"></a>Start Unity Editor MCP Server2831. Open the Unity Editor2842. Navigate to Tools > MCP Unity > Server Window2853. Click "Start Server" to start the WebSocket server2864. Open your AI Coding IDE (e.g. Cursor, Windsurf, Claude Code, Codex CLI, GitHub Copilot, Google Antigravity, etc.) and start executing Unity tools287288289290> When the AI client connects to the WebSocket server, it will automatically show in the green box in the window291292## Optional: Set WebSocket Port293By default, the WebSocket server runs on port '8090'. You can change this port in two ways:2942951. Open the Unity Editor2962. Navigate to Tools > MCP Unity > Server Window2973. Change the "WebSocket Port" value to your desired port number2984. Unity will setup the system environment variable UNITY_PORT to the new port number2995. Restart the Node.js server3006. Click again on "Start Server" to reconnect the Unity Editor web socket to the Node.js MCP Server301302## Optional: Set Timeout303304By default, the timeout between the MCP server and the WebSocket is 10 seconds.305You can change depending on the OS you are using:3063071. Open the Unity Editor3082. Navigate to Tools > MCP Unity > Server Window3093. Change the "Request Timeout (seconds)" value to your desired timeout seconds3104. Unity will setup the system environment variable UNITY_REQUEST_TIMEOUT to the new timeout value3115. Restart the Node.js server3126. Click again on "Start Server" to reconnect the Unity Editor web socket to the Node.js MCP Server313314> [!TIP]315> The timeout between your AI Coding IDE (e.g., Claude Desktop, Cursor IDE, Windsurf IDE) and the MCP Server depends on the IDE.316317## Optional: Allow Remote MCP Bridge Connections318319By default, the WebSocket server binds to 'localhost'. To allow MCP bridge connections from other machines:3203211. Open the Unity Editor3222. Navigate to Tools > MCP Unity > Server Window3233. Enable the "Allow Remote Connections" checkbox3244. Unity will bind the WebSocket server to '0.0.0.0' (all interfaces)3255. Restart the Node.js server to apply the new host configuration3266. Set the environment variable UNITY_HOST to your Unity machine's IP address when running the MCP bridge remotely: `UNITY_HOST=192.168.1.100 node server.js`327328## <a name="debug-server"></a>Debugging the Server329330<details>331<summary><span style="font-size: 1.1em; font-weight: bold;">Building the Node.js Server</span></summary>332333The MCP Unity server is built using Node.js . It requires to compile the TypeScript code to JavaScript in the `build` directory.334In case of issues, you can force install it in by:3353361. Open the Unity Editor3372. Navigate to Tools > MCP Unity > Server Window3383. Click on "Force Install Server" button339340341342If you want to build it manually, you can follow these steps:3433441. Open a terminal/PowerShell/Command Prompt3453462. Navigate to the Server directory:347 ```bash348 cd ABSOLUTE/PATH/TO/mcp-unity/Server~349 ```3503513. Install dependencies:352 ```bash353 npm install354 ```3553564. Build the server:357 ```bash358 npm run build359 ```3603615. Run the server:362 ```bash363 node build/index.js364 ```365366</details>367368<details>369<summary><span style="font-size: 1.1em; font-weight: bold;">Debugging with MCP Inspector</span></summary>370371Debug the server with [@modelcontextprotocol/inspector](https://github.com/modelcontextprotocol/inspector):372 - Powershell373 ```powershell374 npx @modelcontextprotocol/inspector node Server~/build/index.js375 ```376 - Command Prompt/Terminal377 ```cmd378 npx @modelcontextprotocol/inspector node Server~/build/index.js379 ```380381Don't forget to shutdown the server with `Ctrl + C` before closing the terminal or debugging it with the [MCP Inspector](https://github.com/modelcontextprotocol/inspector).382383</details>384385<details>386<summary><span style="font-size: 1.1em; font-weight: bold;">Enable Console Logs</span></summary>3873881. Enable logging on your terminal or into a log.txt file:389 - Powershell390 ```powershell391 $env:LOGGING = "true"392 $env:LOGGING_FILE = "true"393 ```394 - Command Prompt/Terminal395 ```cmd396 set LOGGING=true397 set LOGGING_FILE=true398 ```399400</details>401402## Frequently Asked Questions403404<details>405<summary><span style="font-size: 1.1em; font-weight: bold;">What is MCP Unity?</span></summary>406407MCP Unity is a powerful bridge that connects your Unity Editor environment to AI assistants LLM tools using the Model Context Protocol (MCP).408409In essence, MCP Unity:410- Exposes Unity Editor functionalities (like creating objects, modifying components, running tests, etc.) as "tools" and "resources" that an AI can understand and use.411- Runs a WebSocket server inside Unity and a Node.js server (acting as a WebSocket client to Unity) that implements the MCP. This allows AI assistants to send commands to Unity and receive information back.412- Enables you to use natural language prompts with your AI assistant to perform complex tasks within your Unity project, significantly speeding up development workflows.413414</details>415416<details>417<summary><span style="font-size: 1.1em; font-weight: bold;">Why use MCP Unity?</span></summary>418419MCP Unity offers several compelling advantages for developers, artists, and project managers:420421- **Accelerated Development:** Automate repetitive tasks, generate boilerplate code, and manage assets using AI prompts. This frees up your time to focus on creative and complex problem-solving.422- **Enhanced Productivity:** Interact with Unity Editor features without needing to manually click through menus or write scripts for simple operations. Your AI assistant becomes a direct extension of your capabilities within Unity.423- **Improved Accessibility:** Allows users who are less familiar with the deep intricacies of the Unity Editor or C# scripting to still make meaningful contributions and modifications to a project through AI guidance.424- **Seamless Integration:** Designed to work with various AI assistants and IDEs that support MCP, providing a consistent way to leverage AI across your development toolkit.425- **Extensibility:** The protocol and the toolset can be expanded. You can define new tools and resources to expose more of your project-specific or Unity's functionality to AI.426- **Collaborative Potential:** Facilitates a new way of collaborating where AI can assist in tasks traditionally done by team members, or help in onboarding new developers by guiding them through project structures and operations.427428</details>429430<details>431<summary><span style="font-size: 1.1em; font-weight: bold;">How does MCP Unity compare with the upcoming Unity 6.2 AI features?</span></summary>432433Unity 6.2 is set to introduce new built-in AI tools, including the previous Unity Muse (for generative AI capabilities like texture and animation generation) and Unity Sentis (for running neural networks in Unity runtime). As Unity 6.2 is not yet fully released, this comparison is based on publicly available information and anticipated functionalities:434435- **Focus:**436 - **MCP Unity:** Primarily focuses on **Editor automation and interaction**. It allows external AI (like LLM-based coding assistants) to *control and query the Unity Editor itself* to manipulate scenes, assets, and project settings. It's about augmenting the *developer's workflow* within the Editor.437 - **Unity 6.2 AI:**438 - Aims at in-Editor content creation (generating textures, sprites, animations, behaviors, scripts) and AI-powered assistance for common tasks, directly integrated into the Unity Editor interface.439 - A fine-tuned model to ask any question about Unity's documentation and API structure, with customized examples more accurate to Unity's environment.440 - Adds the functionality to run AI model inference, allowing developers to deploy and run pre-trained neural networks *within your game or application* for features like NPC behavior, image recognition, etc.441442- **Use Cases:**443 - **MCP Unity:** "Create a new 3D object, name it 'Player', add a Rigidbody, and set its mass to 10." "Run all Play Mode tests." "Ask to fix the error on the console log." "Execute the custom menu item 'Prepare build for iOS' and fix any errors that may occur."444 - **Unity 6.2 AI:** "Generate a sci-fi texture for this material." "Update all trees position in the scene to be placed inside of terrain zones tagged with 'forest'." "Create a walking animation for this character." "Generate 2D sprites to complete the character." "Ask details about the error on the console log."445446- **Complementary, Not Mutually Exclusive:**447 MCP Unity and Unity's native AI tools can be seen as complementary. You might use MCP Unity with your AI coding assistant to set up a scene or batch-modify assets, and then use Unity AI tools to generate a specific texture, or to create animations, or 2D sprites for one of those assets. MCP Unity provides a flexible, protocol-based way to interact with the Editor, which can be powerful for developers who want to integrate with a broader range of external AI services or build custom automation workflows.448449</details>450451<details>452<summary><span style="font-size: 1.1em; font-weight: bold;">What MCP hosts and IDEs currently support MCP Unity?</span></summary>453454MCP Unity is designed to work with any AI assistant or development environment that can act as an MCP client. The ecosystem is growing, but current known integrations or compatible platforms include:455- Cursor456- Windsurf457- Claude Desktop458- Claude Code459- Codex CLI460- GitHub Copilot461- Google Antigravity462463</details>464465<details>466<summary><span style="font-size: 1.1em; font-weight: bold;">Can I extend MCP Unity with custom tools for my project?</span></summary>467468Yes, absolutely! One of the significant benefits of the MCP Unity architecture is its extensibility.469- **In Unity (C#):** You can create new C# classes that inherit from `McpToolBase` (or a similar base for resources) to expose custom Unity Editor functionality. These tools would then be registered in `McpUnityServer.cs`. For example, you could write a tool to automate a specific asset import pipeline unique to your project.470- **In Node.js Server (TypeScript):** You would then define the corresponding TypeScript tool handler in the `Server/src/tools/` directory, including its Zod schema for inputs/outputs, and register it in `Server/src/index.ts`. This Node.js part will forward the request to your new C# tool in Unity.471472This allows you to tailor the AI's capabilities to the specific needs and workflows of your game or application.473474</details>475476<details>477<summary><span style="font-size: 1.1em; font-weight: bold;">Is MCP Unity free to use?</span></summary>478479Yes, MCP Unity is an open-source project distributed under the MIT License. You are free to use, modify, and distribute it according to the license terms.480481</details>482483<details>484<summary><span style="font-size: 1.1em; font-weight: bold;">Why am I unable to connect to MCP Unity?</span></summary>485486- Ensure the WebSocket server is running (check the Server Window in Unity)487- Send a console log message from MCP client to force a reconnection between MCP client and Unity server488- Change the port number in the Unity Editor MCP Server window. (Tools > MCP Unity > Server Window)489490</details>491492<details>493<summary><span style="font-size: 1.1em; font-weight: bold;">Why won't the MCP Unity server start?</span></summary>494495- Check the Unity Console for error messages496- Ensure Node.js is properly installed and accessible in your PATH497- Verify that all dependencies are installed in the Server directory498499</details>500501<details>502<summary><span style="font-size: 1.1em; font-weight: bold;">Why do I get a connection failed error when running Play Mode tests?</span></summary>503504The `run_tests` tool returns the following response:505```506Error:507Connection failed: Unknown error508```509510This error occurs because the bridge connection is lost when the domain reloads upon switching to Play Mode. The workaround is to turn off **Reload Domain** in **Edit > Project Settings > Editor > "Enter Play Mode Settings"**.511512</details>513514## Troubleshooting: WSL2 (Windows 11) networking515516When running the MCP (Node.js) server inside WSL2 while Unity runs on Windows 11, connecting to `ws://localhost:8090/McpUnity` may fail with `ECONNREFUSED`.517518Cause: WSL2 and Windows have separate network namespaces โ `localhost` inside WSL2 does not point to the Windows host. By default, Unity listens on `localhost:8090`.519520### Solution 1 โ Enable WSL2 Mirrored mode networking (preferred)521- Windows 11: Settings โ System โ For developers โ WSL โ Enable โMirrored mode networkingโ.522- Or via `.wslconfig` (then run `wsl --shutdown` and reopen WSL):523524```ini525[wsl2]526networkingMode=mirrored527```528529After enabling, `localhost` is shared between Windows and WSL2, so the default config (`localhost:8090`) works.530531### Solution 2 โ Point the Node client to the Windows host532Set in your WSL shell before starting the MCP client:533534```bash535# Use the Windows host IP detected from resolv.conf536export UNITY_HOST=$(grep -m1 nameserver /etc/resolv.conf | awk '{print $2}')537```538539With this, `Server~/src/unity/mcpUnity.ts` will connect to `ws://$UNITY_HOST:8090/McpUnity` instead of `localhost` (it reads `UNITY_HOST`, and may also honor a `Host` in `ProjectSettings/McpUnitySettings.json` if present).540541### Solution 3 โ Allow remote connections from Unity542- Unity: Tools โ MCP Unity โ Server Window โ enable โAllow Remote Connectionsโ (Unity binds to `0.0.0.0`).543- Ensure Windows Firewall allows inbound TCP on your configured port (default 8090).544- From WSL2, connect to the Windows host IP (see Solution 2) or to `localhost` if mirrored mode is enabled.545546> [!NOTE]547> Default port is `8090`. You can change it in the Unity Server Window (Tools โ MCP Unity โ Server Window). The value maps to `McpUnitySettings` and is persisted in `ProjectSettings/McpUnitySettings.json`.548549#### Validate connectivity550551```bash552npm i -g wscat553# After enabling mirrored networking554wscat -c ws://localhost:8090/McpUnity555# Or using the Windows host IP556wscat -c ws://$UNITY_HOST:8090/McpUnity557```558559## Running Tests560561### C# Tests (Unity)562Run tests using Unity's Test Runner:5631. Open Unity Editor5642. Navigate to Window > General > Test Runner5653. Select "EditMode" tab5664. Click "Run All" to execute all tests567568### TypeScript Tests (Server)569Run tests using Jest:570```bash571cd Server~572npm test573```574575To run tests in watch mode:576```bash577npm run test:watch578```579580## Support & Feedback581582If you have any questions or need support, please open an [issue](https://github.com/CoderGamester/mcp-unity/issues) on this repository or alternative you can reach out on:583- Linkedin: [](https://www.linkedin.com/in/miguel-tomas/)584- Discord: gamester7178585- Email: game.gamester@gmail.com586587## Contributing588589Contributions are welcome! Please feel free to submit a Pull Request or open an Issue with your request.590591**Commit your changes** following the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format.592593## License594595This project is under [MIT License](LICENSE.md)596597## Acknowledgements598599- [Model Context Protocol](https://modelcontextprotocol.io)600- [Unity Technologies](https://unity.com)601- [Node.js](https://nodejs.org)602- [WebSocket-Sharp](https://github.com/sta/websocket-sharp)603
Full transparency โ inspect the skill content before installing.