Skip to main content
Glama

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 Cursor, Windsurf, Claude Code, Codex CLI, GitHub Copilot, Google Antigravity, and OpenCode to execute operations within the Unity Editor.

Features

IDE Integration - Package Cache Access

MCP 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:

  • 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

The following tools are available for manipulating and querying Unity scenes and GameObjects via MCP:

  • execute_menu_item: Executes Unity menu items (functions tagged with the MenuItem attribute)

    Example prompt: "Execute the menu item 'GameObject/Create Empty' to create a new empty GameObject"

  • select_gameobject: Selects game objects in the Unity hierarchy by path or instance ID

    Example prompt: "Select the Main Camera object in my scene"

  • update_gameobject: Updates a GameObject's core properties (name, tag, layer, active/static state), or creates the GameObject if it does not exist

    Example prompt: "Set the Player object's tag to 'Enemy' and make it inactive"

  • update_component: Updates component fields on a GameObject or adds it to the GameObject if it does not contain the component

    Example prompt: "Add a Rigidbody component to the Player object and set its mass to 5"

  • add_package: Installs new packages in the Unity Package Manager

    Example prompt: "Add the TextMeshPro package to my project"

  • run_tests: Runs tests using the Unity Test Runner

    Example prompt: "Run all the EditMode tests in my project"

  • send_console_log: Send a console log to Unity

    Example prompt: "Send a console log to Unity Editor"

  • add_asset_to_scene: Adds an asset from the AssetDatabase to the Unity scene

    Example prompt: "Add the Player prefab from my project to the current scene"

  • create_prefab: Creates a prefab with optional MonoBehaviour script and serialized field values

    Example prompt: "Create a prefab named 'Player' from the 'PlayerController' script"

  • create_scene: Creates a new scene and saves it to the specified path

    Example prompt: "Create a new scene called 'Level1' in the Scenes folder"

  • load_scene: Loads a scene by path or name, with optional additive loading

    Example prompt: "Load the MainMenu scene"

  • delete_scene: Deletes a scene by path or name and removes it from Build Settings

    Example prompt: "Delete the old TestScene from my project"

  • get_gameobject: Gets detailed information about a specific GameObject including all components

    Example prompt: "Get the details of the Player GameObject"

  • get_console_logs: Retrieves logs from the Unity console with pagination support

    Example prompt: "Show me the last 20 error logs from the Unity console"

  • recompile_scripts: Recompiles all scripts in the Unity project

    Example prompt: "Recompile scripts in my Unity project"

  • save_scene: Saves the current active scene, with optional Save As to a new path

    Example prompt: "Save the current scene" or "Save the scene as 'Assets/Scenes/Level2.unity'"

  • get_scene_info: Gets information about the active scene including name, path, dirty state, and all loaded scenes

    Example prompt: "What scenes are currently loaded in my project?"

  • unload_scene: Unloads a scene from the hierarchy (does not delete the scene asset)

    Example prompt: "Unload the UI scene from the hierarchy"

  • duplicate_gameobject: Duplicates a GameObject in the scene with optional renaming and reparenting

    Example prompt: "Duplicate the Enemy prefab 5 times and rename them Enemy_1 through Enemy_5"

  • delete_gameobject: Deletes a GameObject from the scene

    Example prompt: "Delete the old Player object from the scene"

  • reparent_gameobject: Changes the parent of a GameObject in the hierarchy

    Example prompt: "Move the HealthBar object to be a child of the UI Canvas"

  • move_gameobject: Moves a GameObject to a new position (local or world space)

    Example prompt: "Move the Player object to position (10, 0, 5) in world space"

  • rotate_gameobject: Rotates a GameObject to a new rotation (local or world space, Euler angles or quaternion)

    Example prompt: "Rotate the Camera 45 degrees on the Y axis"

  • scale_gameobject: Scales a GameObject to a new local scale

    Example prompt: "Scale the Enemy object to twice its size"

  • set_transform: Sets position, rotation, and scale of a GameObject in a single operation

    Example prompt: "Set the Cube's position to (0, 5, 0), rotation to (0, 90, 0), and scale to (2, 2, 2)"

  • create_material: Creates a new material with specified shader and saves it to the project

    Example prompt: "Create a red material called 'EnemyMaterial' using the URP Lit shader"

  • assign_material: Assigns a material to a GameObject's Renderer component

    Example prompt: "Assign the 'EnemyMaterial' to the Enemy GameObject"

  • modify_material: Modifies properties of an existing material (colors, floats, textures)

    Example prompt: "Change the color of 'EnemyMaterial' to blue and set metallic to 0.8"

  • get_material_info: Gets detailed information about a material including shader and all properties

    Example prompt: "Show me all the properties of the 'PlayerMaterial'"

  • batch_execute: Executes multiple tool operations in a single batch request, reducing round-trips and enabling atomic operations with optional rollback on failure

    Example prompt: "Create 10 empty GameObjects named Enemy_1 through Enemy_10 in a single batch operation"

MCP App tools

  • show_unity_dashboard: Opens the Unity dashboard MCP App in VS Code (requires VS Code 1.109+)

    Example prompt: "Open the Unity dashboard app"

  • get_play_mode_status: Gets Unity play mode status (isPlaying, isPaused)

    Example prompt: "Is Unity in play mode?"

  • set_play_mode_status: Controls Unity play mode with actions: 'play' (start or unpause), 'pause' (toggle pause), 'stop' (exit play mode), 'step' (advance one frame)

    Example prompt: "Start Unity play mode" or "Pause the game" or "Step forward one frame"

MCP Server Resources

  • unity://menu-items: Retrieves a list of all available menu items in the Unity Editor to facilitate execute_menu_item tool

    Example prompt: "Show me all available menu items related to GameObject creation"

  • unity://scenes-hierarchy: Retrieves a list of all game objects in the current Unity scene hierarchy

    Example prompt: "Show me the current scenes hierarchy structure"

  • 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 fields

    Example prompt: "Get me detailed information about the Player GameObject"

  • unity://logs: Retrieves a list of all logs from the Unity console

    Example prompt: "Show me the recent error messages from the Unity console"

  • unity://packages: Retrieves information about installed and available packages from the Unity Package Manager

    Example prompt: "List all the packages currently installed in my Unity project"

  • unity://assets: Retrieves information about assets in the Unity Asset Database

    Example prompt: "Find all texture assets in my project"

  • unity://tests/{testMode}: Retrieves information about tests in the Unity Test Runner

    Example prompt: "List all available tests in my Unity project"

  • ui://unity-dashboard: Unity dashboard MCP App UI

    Example prompt: "Open the Unity dashboard app"

MCP Server Prompts

Prompts are pre-configured templates that provide guided workflows for common Unity tasks. They help AI assistants understand the proper sequence of operations and available tools for specific scenarios.

  • unity_dashboard: Opens the Unity dashboard MCP app with contextual information about its features

    Usage: In your AI assistant, use the prompt "unity_dashboard" to get guided access to the Unity dashboard

  • gameobject_handling_strategy: Provides a structured workflow for working with GameObjects, including which tools and resources to use

    Usage: In your AI assistant, use the prompt "gameobject_handling_strategy" with a GameObject ID, name, or path to get step-by-step guidance

Related MCP server: MCP For Unity

Requirements

NOTE

Project Paths with Spaces

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.

Examples:

  • โœ… Recommended: C:\Users\YourUser\Documents\UnityProjects\MyAwesomeGame

  • โœ… Supported: C:\Users\Your User\Documents\Unity Projects\My Awesome Game

Installation

Installing this MCP Unity Server is a multi-step process:

Step 1: Install Node.js

To run MCP Unity server, you'll need to have Node.js 18 or later installed on your computer:

node

  1. Visit the Node.js download page

  2. Download the Windows Installer (.msi) for the LTS version (recommended)

  3. Run the installer and follow the installation wizard

  4. Verify the installation by opening PowerShell and running:

    node --version
  1. Visit the Node.js download page

  2. Download the macOS Installer (.pkg) for the LTS version (recommended)

  3. Run the installer and follow the installation wizard

  4. Alternatively, if you have Homebrew installed, you can run:

    brew install node@18
  5. Verify the installation by opening Terminal and running:

    node --version

Step 2: Install Unity MCP Server package via Unity Package Manager

  1. Open the Unity Package Manager (Window > Package Manager)

  2. Click the "+" button in the top-left corner

  3. Select "Add package from git URL..."

  4. Enter: https://github.com/CoderGamester/mcp-unity.git

  5. Click "Add"

package manager

Step 3: Configure AI LLM Client

  1. Open the Unity Editor

  2. Navigate to Tools > MCP Unity > Server Window

  3. Click on the "Configure" button for your AI LLM client as shown in the image below

image

Global vs. Project configuration:

  • Configure [Client] โ€” writes to your global user config file (e.g. ~/.claude.json). Uses an absolute path. Applies to all projects on your machine. Best for personal, single-developer setups.

  • Configure [Client] (Project) โ€” writes to a .mcp.json file (or equivalent) in the Unity project root. Uses a relative path, so it works across machines. Intended to be committed to git and shared with the team. Best for collaborative projects or when you want the config to travel with the project.

If in doubt, prefer the (Project) variant โ€” the relative path is more portable and won't break if you move your project folder.

  1. Confirm the configuration installation with the given popup

image

Open the MCP configuration file of your AI client and add the MCP Unity server configuration:

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).

For configs that live inside the Unity project tree and get committed to git (e.g. <project>/.vscode/mcp.json, <project>/opencode.json, <project>/.cursor/mcp.json, <project>/.mcp.json, <project>/.codex/config.toml), prefer a project-relative path so the same file works across machines. Toggle "Use relative path" in the Server Window to switch the copy-paste snippet between absolute and project-relative forms. The Configure GitHub Copilot, Configure OpenCode, Configure Cursor (Project), Configure Claude Code (Project), and Configure Codex CLI (Project) buttons already emit relative paths automatically.

Project-local buttons (Cursor / Claude Code / Codex CLI) write the MCP server entry into the Unity project directory instead of your global user config, so other (non-Unity) projects don't see MCP connection-failure warnings. For Codex CLI (Project) specifically, you must approve the project trust prompt the first time you run codex from the project root, otherwise Codex ignores <project>/.codex/config.toml.

For JSON-based clients (Cursor, Windsurf, Claude Code, GitHub Copilot, etc.):

{
   "mcpServers": {
       "mcp-unity": {
          "command": "node",
          "args": [
             "ABSOLUTE/PATH/TO/mcp-unity/Server~/build/index.js"
          ]
       }
   }
}

For workspace-scoped VS Code / GitHub Copilot (.vscode/mcp.json), use ${workspaceFolder} so the path is portable across machines:

{
   "mcpServers": {
       "mcp-unity": {
          "command": "node",
          "args": [
             "${workspaceFolder}/Library/PackageCache/com.gamelovers.mcp-unity@<hash>/Server~/build/index.js"
          ]
       }
   }
}

For Codex CLI (~/.codex/config.toml):

[mcp_servers.mcp-unity]
command = "node"
args = ["ABSOLUTE/PATH/TO/mcp-unity/Server~/build/index.js"]

For Cursor โ€” project-local (.cursor/mcp.json in the Unity project root, project-relative path):

{
   "mcpServers": {
       "mcp-unity": {
          "command": "node",
          "args": [
             "Library/PackageCache/com.gamelovers.mcp-unity@<hash>/Server~/build/index.js"
          ]
       }
   }
}

For Claude Code โ€” project-local (.mcp.json in the Unity project root, project-relative path โ€” Claude Code's team-shared MCP config):

{
   "mcpServers": {
       "mcp-unity": {
          "command": "node",
          "args": [
             "Library/PackageCache/com.gamelovers.mcp-unity@<hash>/Server~/build/index.js"
          ]
       }
   }
}

For Codex CLI โ€” project-local (.codex/config.toml in the Unity project root, project-relative path):

[mcp_servers.mcp-unity]
command = "node"
args = ["Library/PackageCache/com.gamelovers.mcp-unity@<hash>/Server~/build/index.js"]

Codex layers this file over the global ~/.codex/config.toml, but only when the project is marked trusted. The first time you cd into the project and run codex, approve the trust prompt โ€” otherwise Codex ignores .codex/config.toml.

For OpenCode (opencode.json in the Unity project root):

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "mcp-unity": {
      "type": "local",
      "enabled": true,
      "command": ["node", "Library/PackageCache/com.gamelovers.mcp-unity@<hash>/Server~/build/index.js"],
      "environment": {}
    }
  }
}

Note: the @<hash> segment in the UPM package cache path changes when the package is updated. If you update MCP Unity, re-run the Configure button (or update the path manually) so the snippet points at the new cache directory.

Start Unity Editor MCP Server

  1. Open the Unity Editor

  2. Navigate to Tools > MCP Unity > Server Window

  3. Click "Start Server" to start the WebSocket server

  4. Open your AI Coding IDE (e.g. Cursor, Windsurf, Claude Code, Codex CLI, GitHub Copilot, Google Antigravity, OpenCode, etc.) and start executing Unity tools

connect

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'. To change it:

  1. Open the Unity Editor

  2. Navigate to Tools > MCP Unity > Server Window

  3. Change the "Connection Port" value to your desired port number

  4. Unity persists the value in ProjectSettings/McpUnitySettings.json

  5. Restart the Node.js server

The Node bridge discovers that project settings file from its installed package path, so it does not depend on the MCP client's working directory. To override it for one Node process, set UNITY_PORT, for example: UNITY_PORT=9001 node build/index.js.

Optional: Set Timeout

By default, the timeout between the MCP server and the WebSocket is 10 seconds. To change it:

  1. Open the Unity Editor

  2. Navigate to Tools > MCP Unity > Server Window

  3. Change the "Request Timeout (seconds)" value to your desired timeout seconds

  4. Unity persists the value in ProjectSettings/McpUnitySettings.json

  5. Restart the Node.js server

To override it for one Node process, set UNITY_REQUEST_TIMEOUT (in seconds), for example: UNITY_REQUEST_TIMEOUT=30 node build/index.js.

TIP


The timeout between your AI Coding IDE (e.g., Claude Desktop, Cursor IDE, Windsurf IDE) and the MCP Server depends on the IDE.

Optional: Run a Persistent Headless MCP Host

MCP Unity remains disabled in -batchmode by default so CI and cloud builds do not start a bridge or run npm. To run a long-lived headless Editor as an MCP host, opt in before launching Unity by either enabling Allow Batch Mode Server in the Server Window or setting MCP_UNITY_ALLOW_BATCH_MODE=true:

MCP_UNITY_ALLOW_BATCH_MODE=true Unity -batchmode -nographics -projectPath /path/to/project -logFile /path/to/unity.log

The Unity-side WebSocket server starts normally when opted in, but it never runs npm install or npm run build in batch mode. Ensure the Node bridge is already built and available to the MCP client.

Bridge Configuration Resolution

The Node bridge resolves each connection value in this order: its environment variable (UNITY_PORT, UNITY_HOST, or UNITY_REQUEST_TIMEOUT), MCP_UNITY_SETTINGS_PATH, the ProjectSettings/McpUnitySettings.json file found above the installed package, then a file found above its working directory, and finally the defaults. Generated MCP configurations set MCP_UNITY_SETTINGS_PATH explicitly. The bridge logs the value source and warns before falling back to defaults.

Optional: Allow Remote MCP Bridge Connections

By default, the WebSocket server binds to 'localhost'. To allow MCP bridge connections from other machines:

  1. Open the Unity Editor

  2. Navigate to Tools > MCP Unity > Server Window

  3. Enable the "Allow Remote Connections" checkbox

  4. Unity will bind the WebSocket server to '0.0.0.0' (all interfaces)

  5. Restart the Node.js server to apply the new host configuration

  6. 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

Debugging the Server

The MCP Unity server is built using Node.js . It requires to compile the TypeScript code to JavaScript in the build directory. In case of issues, you can force install it in by:

  1. Open the Unity Editor

  2. Navigate to Tools > MCP Unity > Server Window

  3. Click on "Force Install Server" button

install

If you want to build it manually, you can follow these steps:

  1. Open a terminal/PowerShell/Command Prompt

  2. Navigate to the Server directory:

    cd ABSOLUTE/PATH/TO/mcp-unity/Server~
  3. Install dependencies:

    npm install
  4. Build the server:

    npm run build
  5. 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 Ctrl + C before closing the terminal or debugging it with the MCP Inspector.

  1. 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

Frequently Asked Questions

MCP Unity is a powerful bridge that connects your Unity Editor environment to AI assistants LLM tools using the Model Context Protocol (MCP).

In essence, MCP Unity:

  • Exposes Unity Editor functionalities (like creating objects, modifying components, running tests, etc.) as "tools" and "resources" that an AI can understand and use.

  • 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.

  • Enables you to use natural language prompts with your AI assistant to perform complex tasks within your Unity project, significantly speeding up development workflows.

MCP Unity offers several compelling advantages for developers, artists, and project managers:

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

Unity 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:

  • Focus:

    • 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.

    • Unity 6.2 AI:

      • 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.

      • A fine-tuned model to ask any question about Unity's documentation and API structure, with customized examples more accurate to Unity's environment.

      • 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.

  • Use Cases:

    • 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."

    • 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."

  • Complementary, Not Mutually Exclusive: 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.

MCP 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:

  • Cursor

  • Windsurf

  • Claude Desktop

  • Claude Code

  • Codex CLI

  • GitHub Copilot

  • Google Antigravity

  • OpenCode

Yes, absolutely! One of the significant benefits of the MCP Unity architecture is its extensibility.

  • 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.

  • 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.

This allows you to tailor the AI's capabilities to the specific needs and workflows of your game or application.

Yes, 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.

  • Ensure the WebSocket server is running (check the Server Window in Unity)

  • Send a console log message from MCP client to force a reconnection between MCP client and Unity server

  • 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

The run_tests tool returns the following response:

Error:
Connection failed: Unknown error

This 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".

Some MCP clients may fail while parsing tool schemas when they contain local JSON pointer references such as #/properties/position.

MCP Unity avoids this by registering transform tool inputs (set_transform, move_gameobject, rotate_gameobject, scale_gameobject) with fresh nested vector schemas per field, so the generated schema does not rely on local #/properties/... references.

If you still see this error:

  • update your MCP client to the latest version,

  • rebuild the Node server (cd Server~ && npm run build),

  • confirm your package version includes this compatibility fix.

Troubleshooting: WSL2 (Windows 11) networking

When running the MCP (Node.js) server inside WSL2 while Unity runs on Windows 11, connecting to ws://localhost:8090/McpUnity may fail with ECONNREFUSED.

Cause: WSL2 and Windows have separate network namespaces โ€” localhost inside WSL2 does not point to the Windows host. By default, Unity listens on localhost:8090.

Solution 1 โ€” Enable WSL2 Mirrored mode networking (preferred)

  • Windows 11: Settings โ†’ System โ†’ For developers โ†’ WSL โ†’ Enable โ€œMirrored mode networkingโ€.

  • Or via .wslconfig (then run wsl --shutdown and reopen WSL):

[wsl2]
networkingMode=mirrored

After enabling, localhost is shared between Windows and WSL2, so the default config (localhost:8090) works.

Solution 2 โ€” Point the Node client to the Windows host

Set in your WSL shell before starting the MCP client:

# Use the Windows host IP detected from resolv.conf
export UNITY_HOST=$(grep -m1 nameserver /etc/resolv.conf | awk '{print $2}')

With 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).

Solution 3 โ€” Allow remote connections from Unity

  • Unity: Tools โ†’ MCP Unity โ†’ Server Window โ†’ enable โ€œAllow Remote Connectionsโ€ (Unity binds to 0.0.0.0).

  • Ensure Windows Firewall allows inbound TCP on your configured port (default 8090).

  • From WSL2, connect to the Windows host IP (see Solution 2) or to localhost if mirrored mode is enabled.

NOTE

Default port is8090. 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.

Validate connectivity

npm i -g wscat
# After enabling mirrored networking
wscat -c ws://localhost:8090/McpUnity
# Or using the Windows host IP
wscat -c ws://$UNITY_HOST:8090/McpUnity

Running Tests

C# Tests (Unity)

Run tests using Unity's Test Runner:

  1. Open Unity Editor

  2. Navigate to Window > General > Test Runner

  3. Select "EditMode" tab

  4. Click "Run All" to execute all tests

TypeScript Tests (Server)

Run tests using Jest:

cd Server~
npm test

To run tests in watch mode:

npm run test:watch

Support & Feedback

If you have any questions or need support, please open an issue on this repository or alternative you can reach out on:

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

Available Tools

5 tools
execute_menu_itemC

Executes a Unity menu item by path

ParametersJSON Schema
NameRequiredDescriptionDefault
menuPathYesThe path to the menu item to execute (e.g. "GameObject/Create Empty")

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Executes') but doesn't clarify what 'execute' entailsโ€”whether it triggers UI changes, runs scripts, modifies project state, or has side effects like requiring specific permissions or being irreversible. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with zero wasted words. It's front-loaded with the core action and resource, making it highly efficient and easy to parse, which is ideal for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of executing a Unity menu item (which could involve UI interactions, project changes, or script execution), the description is incomplete. With no annotations, no output schema, and minimal behavioral context, it fails to provide enough information for safe and effective use, especially for a tool that likely performs mutations in a development environment.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the single parameter 'menuPath' well-documented in the schema (including an example). The description adds no additional semantic context beyond what the schema provides, such as format constraints or common use cases, so it meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Executes') and the target resource ('a Unity menu item by path'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its siblings (like notify_message or run_tests), which would require more specific context about Unity menu execution versus other operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing Unity running), exclusions, or how it relates to sibling tools like run_tests or select_object, leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

notify_messageC

Sends a message to the Unity console

ParametersJSON Schema
NameRequiredDescriptionDefault
messageYesThe message to display in the Unity console
typeNoThe type of message (info, warning, error)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states what the tool does without disclosing behavioral traits. It doesn't mention whether this is a read-only operation, if it requires specific permissions, how messages appear in the console, or any rate limits. The description is minimal and lacks necessary context for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that sends messages (implying mutation) with no annotations and no output schema, the description is incomplete. It doesn't explain what happens after sending, return values, error conditions, or integration with Unity's console system. The minimal description leaves significant gaps in understanding the tool's behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description doesn't add any meaning beyond what the schema provides about message content or type options. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('sends') and target ('message to the Unity console'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'execute_menu_item' or 'run_tests', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like logging to files or using other console methods. It lacks context about appropriate scenarios or exclusions, offering only basic functional information.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

package_managerC

Manages packages in the Unity Package Manager

ParametersJSON Schema
NameRequiredDescriptionDefault
branchNoThe branch to use for GitHub packages (optional)
methodSourceYesThe method source to use (registry, github, or disk) to add the package
packageNameNoThe package name to add from Unity registry (e.g. com.unity.textmeshpro)
pathNoThe path to use (folder path for disk method or subfolder for GitHub)
repositoryUrlNoThe GitHub repository URL (e.g. https://github.com/username/repo.git)
versionNoThe version to use for registry packages (optional)

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but only states a general purpose. It doesn't describe whether this tool performs read-only or destructive operations, what permissions are needed, how it handles errors, or what the typical output looks like, which is insufficient for a tool with multiple parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words, making it appropriately concise. However, it lacks front-loaded detail that could immediately clarify the tool's specific actions, slightly reducing its effectiveness despite the brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity with 6 parameters, no annotations, and no output schema, the description is incomplete. It fails to explain what the tool does beyond a vague purpose, leaving gaps in understanding behavioral traits, return values, and proper usage context, which is inadequate for effective agent invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so all parameters are documented in the schema itself. The description adds no additional meaning about parameters beyond the general purpose, resulting in a baseline score of 3 where the schema does the heavy lifting without enhancement from the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Manages packages in the Unity Package Manager' states a general purpose but is vague about what specific actions are performed. It doesn't specify whether it adds, removes, updates, or lists packages, and doesn't distinguish from sibling tools like 'execute_menu_item' or 'run_tests' which are unrelated to package management.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention any prerequisites, context for package management, or exclusions, leaving the agent to infer usage from the parameters alone without explicit direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_testsC

Runs Unity's Test Runner tests

ParametersJSON Schema
NameRequiredDescriptionDefault
testFilterNoOptional test filter (e.g. specific test name or namespace)
testModeNoThe test mode to run (EditMode, PlayMode, or All)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but lacks behavioral details. It doesn't disclose whether this is a read-only or destructive operation, execution time, error handling, or output format (e.g., test results). The phrase 'Runs' implies execution but gives no further context on safety or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words, making it easy to parse. It's front-loaded with the core action and resource, earning full marks for conciseness and structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of running tests (which involves execution and potential side effects), no annotations, and no output schema, the description is incomplete. It doesn't explain what happens during execution, what results to expect, or any constraints, leaving significant gaps for an agent to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, documenting both parameters clearly. The description adds no additional meaning beyond what the schema provides, such as examples of test filters or implications of test modes. With high schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Runs') and the resource ('Unity's Test Runner tests'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'execute_menu_item' or 'package_manager', which could also involve Unity operations, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, context (e.g., when in Unity's workflow), or comparisons to siblings like 'execute_menu_item' for other Unity actions, leaving the agent to infer usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

select_objectC

Sets the selected object in the Unity editor by path or ID

ParametersJSON Schema
NameRequiredDescriptionDefault
objectPathYesThe path or ID of the object to select (e.g. "Main Camera" or a Unity object ID)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Sets the selected object' which implies a mutation (changing editor state), but doesn't disclose critical traits like whether this requires specific editor modes, if changes are undoable, potential side effects, or error handling. For a mutation tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('Sets the selected object') with essential details ('in the Unity editor by path or ID'). Every word earns its place with no redundancy or fluff, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a mutation in an editor environment), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like permissions, side effects, or return values, leaving gaps for an AI agent to understand how to invoke it correctly in context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'objectPath' fully documented in the schema. The description adds minimal value beyond the schema by mentioning 'path or ID' and providing an example ('Main Camera'), but doesn't elaborate on syntax, format differences, or edge cases. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Sets the selected object') and the resource ('in the Unity editor'), with the method ('by path or ID') specified. It distinguishes from siblings like 'execute_menu_item' or 'run_tests' by focusing on object selection. However, it doesn't explicitly differentiate from all siblings (e.g., 'notify_message' is clearly different, but the distinction could be more explicit for a perfect score).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an open Unity project), exclusions, or comparisons to sibling tools. Usage is implied through the action but lacks explicit context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.2/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose targeting different Unity Editor functionalities: executing menu items, sending console messages, managing packages, running tests, and selecting objects. There is no overlap or ambiguity in their intended uses.

Naming Consistency4/5

The tool names follow a consistent snake_case pattern with descriptive verb_noun combinations (e.g., execute_menu_item, notify_message). However, 'package_manager' deviates slightly by using a noun-only name instead of a verb_noun structure, but overall the naming is highly readable and predictable.

Tool Count5/5

With 5 tools, the server is well-scoped for its purpose of interacting with the Unity Editor. Each tool serves a specific, essential function, and there are no extraneous or redundant tools, making the count appropriate for the domain.

Completeness3/5

The toolset covers key Unity Editor operations like executing commands, messaging, package management, testing, and object selection. However, there are notable gaps for a full editor integration, such as creating or modifying assets, building projects, or accessing scene hierarchies, which limits comprehensive workflow coverage.

Maintenance

ActivityActive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    Seamless automation and intelligent control over your Unity projects. By integrating with the MCP server and client, it allows AI agents or external tools to interact with your Unity environmentโ€”creating, modifying, and managing GameObjects, Components, Assets, Scenes, and more.
    4,016
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CoderGamester/mcp-unity'

If you have feedback or need assistance with the MCP directory API, please join our Discord server