MCP Unity

MCP Unity

MCP Unity Server to integrate Unity Editor game engine with different AI Model clients (e.g. Claude Desktop, Windsurf, Cursor)

CoderGamester

Developer Tools
Visit Server

Tools

execute_menu_item

Executes a Unity menu item by path

select_object

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

package_manager

Manages packages in the Unity Package Manager

run_tests

Runs Unity's Test Runner tests

notify_message

Sends a message to the Unity console

README

MCP Unity Editor (Game Engine)

smithery badge

English 🇨🇳简体中文 🇯🇵日本語
                              ,/(/.   *(/,                                  
                          */(((((/.   *((((((*.                             
                     .*((((((((((/.   *((((((((((/.                         
                 ./((((((((((((((/    *((((((((((((((/,                     
             ,/(((((((((((((/*.           */(((((((((((((/*.                
            ,%%#((/((((((*                    ,/(((((/(#&@@(                
            ,%%##%%##((((((/*.             ,/((((/(#&@@@@@@(                
            ,%%######%%##((/(((/*.    .*/(((//(%@@@@@@@@@@@(                
            ,%%####%#(%%#%%##((/((((((((//#&@@@@@@&@@@@@@@@(                
            ,%%####%(    /#%#%%%##(//(#@@@@@@@%,   #@@@@@@@(                
            ,%%####%(        *#%###%@@@@@@(        #@@@@@@@(                
            ,%%####%(           #%#%@@@@,          #@@@@@@@(                
            ,%%##%%%(           #%#%@@@@,          #@@@@@@@(                
            ,%%%#*              #%#%@@@@,             *%@@@(                
            .,      ,/##*.      #%#%@@@@,     ./&@#*      *`                
                ,/#%#####%%#/,  #%#%@@@@, ,/&@@@@@@@@@&\.                    
                 `*#########%%%%###%@@@@@@@@@@@@@@@@@@&*´                   
                    `*%%###########%@@@@@@@@@@@@@@&*´                        
                        `*%%%######%@@@@@@@@@@&*´                            
                            `*#%%##%@@@@@&*´                                 
                               `*%#%@&*´                                     
                                                       
     ███╗   ███╗ ██████╗██████╗         ██╗   ██╗███╗   ██╗██╗████████╗██╗   ██╗
     ████╗ ████║██╔════╝██╔══██╗        ██║   ██║████╗  ██║██║╚══██╔══╝╚██╗ ██╔╝
     ██╔████╔██║██║     ██████╔╝        ██║   ██║██╔██╗ ██║██║   ██║    ╚████╔╝ 
     ██║╚██╔╝██║██║     ██╔═══╝         ██║   ██║██║╚██╗██║██║   ██║     ╚██╔╝  
     ██║ ╚═╝ ██║╚██████╗██║             ╚██████╔╝██║ ╚████║██║   ██║      ██║   
     ╚═╝     ╚═╝ ╚═════╝╚═╝              ╚═════╝ ╚═╝  ╚═══╝╚═╝   ╚═╝      ╚═╝   

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

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

  • notify_message: Displays messages in the Unity Editor

    Example prompt: "Send a notification to Unity that the task has been completed"

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

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://hierarchy: Retrieves a list of all game objects in the Unity hierarchy

    Example prompt: "Show me the current scene 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"

Requirements

<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

  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 2: Install Node.js

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

<details> <summary><span style="font-size: 1.1em; font-weight: bold;">Windows</span></summary>

  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
    

</details>

<details> <summary><span style="font-size: 1.1em; font-weight: bold;">macOS</span></summary>

  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
    

</details>

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>

  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

  1. Confirm the configuration installation with the given popup

image

</details>

<details> <summary><span style="font-size: 1.1em; font-weight: bold;">Option 2: Configure via Smithery</span></summary>

To install MCP Unity via Smithery:

Currently not available

</details>

<details> <summary><span style="font-size: 1.1em; font-weight: bold;">Option 3: Configure Manually</span></summary>

Open the MCP configuration file of your AI client (e.g. claude_desktop_config.json in Claude Desktop) and copy the following text:

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

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

</details>

<a name="start-server"></a>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 Claude Desktop or your AI Coding IDE (e.g. Cursor IDE, Windsurf IDE, 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. 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>

  1. Open the Unity Editor
  2. Navigate to Tools > MCP Unity > Server Window
  3. Change the "WebSocket Port" value to your desired port number
  4. Unity will setup the system environment variable UNITY_PORT to the new port number
  5. Restart the Node.js server
  6. Click again on "Start Server" to reconnect the Unity Editor web socket to the Node.js MCP Server

</details>

<details> <summary><span style="font-size: 1.1em; font-weight: bold;">Option 2: Using the terminal</span></summary>

  1. Set the UNITY_PORT environment variable in the terminal
    • Powershell
    $env:UNITY_PORT = "8090"
    
    • Command Prompt/Terminal
    set UNITY_PORT=8090
    
  2. Restart the Node.js server
  3. Click again on "Start Server" to reconnect the Unity Editor web socket to the Node.js MCP Server

</details>

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

  1. Navigate to the Server directory:

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

    npm install
    
  3. Build the server:

    npm run build
    
  4. Run the server:

    node build/index.js
    

</details>

<details> <summary><span style="font-size: 1.1em; font-weight: bold;">Debugging with MCP Inspector</span></summary>

Debug the server with @modelcontextprotocol/inspector:

  • Powershell
$env:UNITY_PORT=8090; npx @modelcontextprotocol/inspector node Server/build/index.js
  • Command Prompt/Terminal
set UNITY_PORT=8090 && 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.

</details>

<details> <summary><span style="font-size: 1.1em; font-weight: bold;">Enable Console Logs</span></summary>

  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
    

</details>

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) </details>

<details> <summary><span style="font-size: 1.1em; font-weight: bold;">Server Not Starting</span></summary>

  • 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 </details>

<details> <summary><span style="font-size: 1.1em; font-weight: bold;">Menu Items Not Executing</span></summary>

  • 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 </details>

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python