mcp-unity logo

MCP Unity

by CoderGamester

4 forks
61 stars
Free

What is mcp-unity

mcp-unity is a server implementation created by CoderGamester that brings the power of the Model Context Protocol (MCP) to the Unity Editor. This tool serves as a bridge between Unity projects and AI assistants, allowing these assistants to interact with and perform operations within the Unity environment. By utilizing the MCP framework, mcp-unity facilitates seamless communication between the Unity Editor and a Node.js server, enabling AI agents like Claude, Windsurf, and Cursor to execute tasks and gather information from Unity projects efficiently.

How to Use mcp-unity

To start using mcp-unity, ensure you have Unity 2022.3 or later, Node.js 18 or higher, and npm 9 or later installed on your system. Follow these steps to set up and run mcp-unity:

  1. Install the Unity MCP Server Package: Use the Unity Package Manager to add the mcp-unity package by entering the package URL.
  2. Set Up Node.js: Ensure Node.js is installed and accessible from your terminal. You can verify this by checking the versions using node --version and npm --version.
  3. Configure the Server:
    • Use the Unity Editor to open the MCP Server window (Tools > MCP Unity > Server Window).
    • Configure your AI client by specifying the command to start the server and setting the appropriate environment variables.
  4. Run the Server:
    • Navigate to the mcp-unity package directory and start the server using Node.js.
    • In the Unity Editor, initiate the server via the MCP Server Window to start the WebSocket server.

Key Features of mcp-unity

mcp-unity offers several powerful features designed to enhance the interaction between AI assistants and Unity projects:

  • Execute Menu Items: This feature allows AI agents to trigger Unity menu items, which are functions annotated with the MenuItem attribute, directly from the server.
  • Retrieve Menu Items List: AI systems can obtain a comprehensive list of all available menu items in the Unity Editor, facilitating the use of the execute_menu_item tool.
  • Access Game Object Hierarchy: The server can provide a detailed list of all game objects within the Unity hierarchy, enabling AI agents to understand and manipulate the scene structure.
  • Fetch Console Logs: AI assistants can retrieve logs from the Unity console, providing insights into runtime behavior and assisting in debugging and validation tasks.

These features make mcp-unity an indispensable tool for developers looking to integrate AI capabilities into their Unity projects, enabling a new level of interactivity and automation. The server's compatibility with widely used technologies like Node.js, TypeScript, and WebSocket ensures a robust and flexible development environment.

How to Use

To use the mcp-unity, follow these steps:

  1. Visit https://github.com/CoderG...
  2. Follow the setup instructions to create an account (if required)
  3. Connect the MCP server to your Claude Desktop application
  4. Start using mcp-unity capabilities within your Claude conversations

Additional Information

Created

March 13, 2025

Start building your own MCP Server

Interested in creating your own MCP Server? Check out the official documentation and resources.

Learn More