U
Unity3d Game Engine
community
other
An MCP server that enables LLMs to interact with Unity3d Game Engine, supporting access to a variety of the Unit's Editor engine tools (e.g. Console Logs, Test Runner logs, Editor functions, hierarchy state, etc) and executing them as MCP tools or gather them as resources.
MCP Unity Editor (Game Engine)
,/(/. *(/, */(((((/. *((((((*. .*((((((((((/. *((((((((((/. ./((((((((((((((/ *((((((((((((((/, ,/(((((((((((((/*. */(((((((((((((/*. ,%%#((/((((((* ,/(((((/(#&@@( ,%%##%%##((((((/*. ,/((((/(#&@@@@@@( ,%%######%%##((/(((/*. .*/(((//(%@@@@@@@@@@@( ,%%####%#(%%#%%##((/((((((((//#&@@@@@@&@@@@@@@@( ,%%####%( /#%#%%%##(//(#@@@@@@@%, #@@@@@@@( ,%%####%( *#%###%@@@@@@( #@@@@@@@( ,%%####%( #%#%@@@@, #@@@@@@@( ,%%##%%%( #%#%@@@@, #@@@@@@@( ,%%%#* #%#%@@@@, *%@@@( ., ,/##*. #%#%@@@@, ./&@#* *` ,/#%#####%%#/, #%#%@@@@, ,/&@@@@@@@@@&\. `*#########%%%%###%@@@@@@@@@@@@@@@@@@&*ยด `*%%###########%@@@@@@@@@@@@@@&*ยด `*%%%######%@@@@@@@@@@&*ยด `*#%%##%@@@@@&*ยด `*%#%@&*ยด โโโโ โโโโ โโโโโโโโโโโโโโ โโโ โโโโโโโ โโโโโโโโโโโโโโโโโโ โโโ โโโโโ โโโโโโโโโโโโโโโโโโโโโ โโโ โโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโ โโโโโโโโโโโโโโ โโโโโโโโ โโโ โโโโโโโโโ โโโโโโ โโโ โโโโโโโ โโโโโโโโโโโโโโ โโโโโโโ โโโ โโโโโโโโโโโโโโโโ โโโ โโโโโ โโโ โโโ โโโโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโ โโโ โโโ โโโ โโโ โโโโโโโโโโ โโโโโโโ โโโ โโโโโโโโ โโโ โโโ
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 Claude, Windsurf, and Cursor to execute operations within the Unity Editor.
Features
<a href="https://glama.ai/mcp/servers/@CoderGamester/mcp-unity"> <img width="400" height="200" src="https://glama.ai/mcp/servers/@CoderGamester/mcp-unity/badge" alt="Unity MCP server" /> </a>IDE Integration - Package Cache Access
MCP Unity provides automatic integration with VSCode-like IDEs (Visual Studio Code, Cursor, Windsurf) by adding the Unity
Library/PackedCache
folder to your workspace. This feature:- Improves code intelligence for Unity packages
- Enables better autocompletion and type information for Unity packages
- Helps AI coding assistants understand your project's dependencies
MCP Server Tools
-
: Executes Unity menu items (functions tagged with the MenuItem attribute)execute_menu_item
Example prompt: "Execute the menu item 'GameObject/Create Empty' to create a new empty GameObject" -
: Selects game objects in the Unity hierarchy by path or instance IDselect_gameobject
Example prompt: "Select the Main Camera object in my scene" -
: Updates component fields on a GameObject or adds it to the GameObject if it does not contain the componentupdate_component
Example prompt: "Add a Rigidbody component to the Player object and set its mass to 5" -
: Installs new packages in the Unity Package Manageradd_package
Example prompt: "Add the TextMeshPro package to my project" -
: Runs tests using the Unity Test Runnerrun_tests
Example prompt: "Run all the EditMode tests in my project" -
: Displays messages in the Unity Editornotify_message
Example prompt: "Send a notification to Unity that the task has been completed" -
: Adds an asset from the AssetDatabase to the Unity sceneadd_asset_to_scene
Example prompt: "Add the Player prefab from my project to the current scene"
MCP Server Resources
-
: Retrieves a list of all available menu items in the Unity Editor to facilitateunity://menu-items
toolexecute_menu_item
Example prompt: "Show me all available menu items related to GameObject creation" -
: Retrieves a list of all game objects in the Unity hierarchyunity://hierarchy
Example prompt: "Show me the current scene hierarchy structure" -
: 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 fieldsunity://gameobject/{id}
Example prompt: "Get me detailed information about the Player GameObject" -
: Retrieves a list of all logs from the Unity consoleunity://logs
Example prompt: "Show me the recent error messages from the Unity console" -
: Retrieves information about installed and available packages from the Unity Package Managerunity://packages
Example prompt: "List all the packages currently installed in my Unity project" -
: Retrieves information about assets in the Unity Asset Databaseunity://assets
Example prompt: "Find all texture assets in my project" -
: Retrieves information about tests in the Unity Test Runnerunity://tests/{testMode}
Example prompt: "List all available tests in my Unity project"
Requirements
- Unity 2022.3 or later - to install the server
- Node.js 18 or later - to start the server
- npm 9 or later - to debug the server
<a name="install-server"></a>Installation
Installing this MCP Unity Server is a multi-step process:
Step 1: Install Unity MCP Server package via Unity Package Manager
- Open the Unity Package Manager (Window > Package Manager)
- Click the "+" button in the top-left corner
- Select "Add package from git URL..."
- Enter:
https://github.com/CoderGamester/mcp-unity.git
- Click "Add"
Step 2: Install Node.js
<details> <summary><span style="font-size: 1.1em; font-weight: bold;">Windows</span></summary>To run MCP Unity server, you'll need to have Node.js 18 or later installed on your computer:
- Visit the Node.js download page
- Download the Windows Installer (.msi) for the LTS version (recommended)
- Run the installer and follow the installation wizard
- Verify the installation by opening PowerShell and running:
node --version
- Visit the Node.js download page
- Download the macOS Installer (.pkg) for the LTS version (recommended)
- Run the installer and follow the installation wizard
- Alternatively, if you have Homebrew installed, you can run:
brew install node@18
- Verify the installation by opening Terminal and running:
node --version
Step 3: Configure AI LLM Client
<details open> <summary><span style="font-size: 1.1em; font-weight: bold;">Option 1: Configure using Unity Editor</span></summary>- Open the Unity Editor
- Navigate to Tools > MCP Unity > Server Window
- Click on the "Configure" button for your AI LLM client as shown in the image below
- Confirm the configuration installation with the given popup
Open the MCP configuration file of your AI client (e.g. claude_desktop_config.json in Claude Desktop) and copy the following text:
Replacewith 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).ABSOLUTE/PATH/TO
</details>{ "mcpServers": { "mcp-unity": { "command": "node", "args": [ "ABSOLUTE/PATH/TO/mcp-unity/Server/build/index.js" ] } } }
<a name="start-server"></a>Start Unity Editor MCP Server
- Open the Unity Editor
- Navigate to Tools > MCP Unity > Server Window
- Click "Start Server" to start the WebSocket server
- Open Claude Desktop or your AI Coding IDE (e.g. Cursor IDE, Windsurf IDE, etc.) and start executing Unity tools
When the AI client connects to the WebSocket server, it will automatically show in the green box in the window
Optional: Set WebSocket Port
By default, the WebSocket server runs on port 8090. You can change this port in two ways:
<details>
<summary><span style="font-size: 1.1em; font-weight: bold;">Option 1: Using the Unity Editor</span></summary>
- Open the Unity Editor
- Navigate to Tools > MCP Unity > Server Window
- Change the "WebSocket Port" value to your desired port number
- Unity will setup the system environment variable UNITY_PORT to the new port number
- Restart the Node.js server
- Click again on "Start Server" to reconnect the Unity Editor web socket to the Node.js MCP Server
- Set the UNITY_PORT environment variable in the terminal
- Powershell
$env:UNITY_PORT = "8090"
- Command Prompt/Terminal
set UNITY_PORT=8090
- Restart the Node.js server
- Click again on "Start Server" to reconnect the Unity Editor web socket to the Node.js MCP Server
<a name="debug-server"></a>Debugging the Server
<details> <summary><span style="font-size: 1.1em; font-weight: bold;">Building the Node.js Server</span></summary>The MCP Unity server is built using Node.js . It requires to compile the TypeScript code to JavaScript in the
build
directory.
To build the server, open a terminal and:-
Navigate to the Server directory:
cd ABSOLUTE/PATH/TO/mcp-unity/Server
-
Install dependencies:
npm install
-
Build the server:
npm run build
-
Run the server:
node build/index.js
Debug the server with @modelcontextprotocol/inspector:
- Powershell
npx @modelcontextprotocol/inspector node Server/build/index.js
- Command Prompt/Terminal
npx @modelcontextprotocol/inspector node Server/build/index.js
Don't forget to shutdown the server with
</details>
<details>
<summary><span style="font-size: 1.1em; font-weight: bold;">Enable Console Logs</span></summary>
Ctrl + C
before closing the terminal or debugging it with the MCP Inspector.- Enable logging on your terminal or into a log.txt file:
- Powershell
$env:LOGGING = "true" $env:LOGGING_FILE = "true"
- Command Prompt/Terminal
set LOGGING=true set LOGGING_FILE=true
Troubleshooting
<details> <summary><span style="font-size: 1.1em; font-weight: bold;">Connection Issues</span></summary>- Ensure the WebSocket server is running (check the Server Window in Unity)
- Check if there are any firewall restrictions blocking the connection
- Make sure the port number is correct (default is 8080)
- Change the port number in the Unity Editor MCP Server window. (Tools > MCP Unity > Server Window)
- Check the Unity Console for error messages
- Ensure Node.js is properly installed and accessible in your PATH
- Verify that all dependencies are installed in the Server directory
- Ensure the menu item path is correct (case-sensitive)
- Check if the menu item requires confirmation
- Verify that the menu item is available in the current context
Support & Feedback
If you have any questions or need support, please open an issue on this repository.
Alternative you can reach out on:
- Linkedin:
- Discord: gamester7178
- Email: game.gamester@gmail.com
Contributing
Contributions are welcome! Please feel free to submit a Pull Request or open an Issue with your request.
Commit your changes following the Conventional Commits format.
License
This project is under MIT License
Acknowledgements
Related Servers
S
Sequential Thinking
reference
Dynamic and reflective problem-solving through thought sequences
View Details