Unity-MCP

Unity-MCP

MCP Server + Plugin for Unity Editor and Unity game. The Plugin allows to connect to MCP clients like Claude Desktop or others.

Stars: 401

Visit
 screenshot

Unity-MCP is an AI helper designed for game developers using Unity. It facilitates a wide range of tasks in Unity Editor and running games on any platform by connecting to AI via TCP connection. The tool allows users to chat with AI like with a human, supports local and remote usage, and offers various default AI tools. Users can provide detailed information for classes, fields, properties, and methods using the 'Description' attribute in C# code. Unity-MCP enables instant C# code compilation and execution, provides access to assets and C# scripts, and offers tools for proper issue understanding and project data manipulation. It also allows users to find and call methods in the codebase, work with Unity API, and access human-readable descriptions of code elements.

README:

✨ AI Game Developer — Unity MCP

Docker Image MCP r Unity Asset Store Unity Editor Unity Runtime OpenUPM Discord Stars License Stand With Ukraine

AI helper which does wide range of tasks in Unity Editor and even in a running game compiled to any platform. It connects to AI using TCP connection, that is why it is so flexible.

💬 Join our community: Discord Server - Ask questions, showcase your work, and connect with other developers!

AI work

Made with AI — samples (click to see)
Animation Animation
Runner Game Procedural Terrain
Material creating Maze Game

Features for a human

  • ✅ Chat with AI like with a human
  • ✅ Local and Remote usage supported
  • STDIO and HTTP protocols supported
  • ✅ Wide range of default AI tools
  • ✅ Use Description attribute in C# code to provide detailed information for class, field, property or method.
  • ✅ Customizable reflection convertors, inspired by System.Text.Json convertors
    • do you have something extremely custom in your project? Make custom reflection convertor to let LLM be able to read and write into that data
  • ✅ Remote AI units setup using docker containers,
    • make a team of AI workers which work on your project simultaneously

Features for LLM

  • ✅ Agent ready tools, find anything you need in 1-2 steps
  • ✅ Instant C# code compilation & execution using Roslyn, iterate faster
  • ✅ Assets access (read / write), C# scripts access (read / write)
  • ✅ Well described positive and negative feedback for proper understanding of an issue
  • ✅ Provide references to existed objects for the instant C# code using Reflection
  • ✅ Get full access to entire project data in a readable shape using Reflection
  • ✅ Populate & Modify any granular piece of data in the project using Reflection
  • ✅ Find any method in the entire codebase, including compiled DLL files using Reflection
  • ✅ Call any method in the entire codebase using Reflection
  • ✅ Provide any property into method call, even if it is a reference to existed object in memory using Reflection and advanced reflection convertors
  • ✅ Unity API instantly available for usage, even if Unity changes something you will get fresh API using Reflection.
  • ✅ Get access to human readable description of any class, method, field, property by reading it's Description attribute.

Stability status

Unity Version Editmode Playmode Standalone
2022.3.61f1 r r r
2023.2.20f1 r r r
6000.2.3f1 r r r

Requirements

[!IMPORTANT] Project path cannot contain spaces

  • C:/MyProjects/Project
  • C:/My Projects/Project

Install MCP Client

Choose MCP Client you prefer, don't need to install all of them. This is will be your main chat window to talk with LLM.

MCP protocol is quite universal, that is why you may any MCP client you prefer, it will work as smooth as anyone else. The only important thing, that the MCP client has to support dynamic tool update.

Installation

Step 1: Install Unity Plugin

  • ⬇️ Download Installer
  • 📂 Import installer into Unity project
    • You may use double click on the file - Unity will open it
    • OR: You may open Unity Editor first, then click on Assets/Import Package/Custom Package, then choose the file
Alternative: Install Unity Plugin via OpenUPM
openupm add com.ivanmurzak.unity.mcp

Step 2: Configure MCP Client

Automatic configuration

  • Open Unity project
  • Open Window/AI Connector (Unity-MCP)
  • Click Configure at your MCP client

Unity_AI

If MCP client is not in the list, use the raw JSON below in the window, to inject it into your MCP client. Read instructions for your MCP client how to do that.

Manual configuration

If Automatic configuration doesn't work for you for any reason. Use JSON from AI Connector (Unity-MCP) window to configure any MCP Client on your own.

Add Unity-MCP to Claude Code (Windows)

Replace unityProjectPath with your real project path

claude mcp add Unity-MCP "<unityProjectPath>/Library/mcp-server/win-x64/unity-mcp-server.exe" client-transport=stdio
Add Unity-MCP to Claude Code (MacOS Apple-Silicon)

Replace unityProjectPath with your real project path

claude mcp add Unity-MCP "<unityProjectPath>/Library/mcp-server/osx-arm64/unity-mcp-server" client-transport=stdio
Add Unity-MCP to Claude Code (MacOS Apple-Intel)

Replace unityProjectPath with your real project path

claude mcp add Unity-MCP "<unityProjectPath>/Library/mcp-server/osx-x64/unity-mcp-server" client-transport=stdio
Add Unity-MCP to Claude Code (Linux x64)

Replace unityProjectPath with your real project path

claude mcp add Unity-MCP "<unityProjectPath>/Library/mcp-server/linux-x64/unity-mcp-server" client-transport=stdio
Add Unity-MCP to Claude Code (Linux arm64)

Replace unityProjectPath with your real project path

claude mcp add Unity-MCP "<unityProjectPath>/Library/mcp-server/linux-arm64/unity-mcp-server" client-transport=stdio

Use AI

Talk with AI (LLM) in your MCP Client. Ask it to do anything you want. As better you describe your task / idea - as better it will do the job.

Some MCP Clients allow to chose different LLM models. Take an eye on it, some model may work much better.

Explain my scene hierarchy
Create 3 cubes in a circle with radius 2
Create metallic golden material and attach it to a sphere gameObject

Make sure Agent mode is turned on in MCP client


How it works

Unity-MCP is a bridge between LLM and Unity. It exposes and explains to LLM Unity's tools. LLM understands the interface and utilizes the tools in the way a user asks.

Connect Unity-MCP to LLM client such as Claude or Cursor using integrated AI Connector window. Custom clients are supported as well.

The project is designed to let developers to add custom tools soon. After that the next goal is to enable the same features in player's build. For not it works only in Unity Editor.

The system is extensible: you can define custom tools directly in your Unity project codebase, exposing new capabilities to the AI or automation clients. This makes Unity-MCP a flexible foundation for building advanced workflows, rapid prototyping, or integrating AI-driven features into your development process.


Advanced MCP server setup

Unity-MCP server supports many different launch options and docker docker deployment. Both transport protocol are supported http and stdio. Read more...

Add custom tool

⚠️ It only works with MCP client that supports dynamic tool list update.

Unity-MCP is designed to support custom tool development by project owner. MCP server takes data from Unity plugin and exposes it to a Client. So anyone in the MCP communication chain would receive the information about a new tool. Which LLM may decide to call at some point.

To add a custom tool you need:

  1. To have a class with attribute McpPluginToolType.
  2. To have a method in the class with attribute McpPluginTool.
  3. [optional] Add Description attribute to each method argument to let LLM to understand it.
  4. [optional] Use string? optional = null properties with ? and default value to mark them as optional for LLM.

Take a look that the line MainThread.Instance.Run(() => it allows to run the code in Main thread which is needed to interact with Unity API. If you don't need it and running the tool in background thread is fine for the tool, don't use Main thread for efficiency purpose.

[McpPluginToolType]
public class Tool_GameObject
{
    [McpPluginTool
    (
        "MyCustomTask",
        Title = "Create a new GameObject"
    )]
    [Description("Explain here to LLM what is this, when it should be called.")]
    public string CustomTask
    (
        [Description("Explain to LLM what is this.")]
        string inputData
    )
    {
        // do anything in background thread

        return MainThread.Instance.Run(() =>
        {
            // do something in main thread if needed

            return $"[Success] Operation completed.";
        });
    }
}

Add custom in-game tool

⚠️ Not yet supported. The work is in progress


Contribution 💙💛

Contribution is highly appreciated. Brings your ideas and lets make the game development as simple as never before! Do you have an idea of a new tool, feature or did you spot a bug and know how to fix it.

  1. 👉 Fork the project
  2. Clone the fork and open the ./Unity-MCP-Plugin folder in Unity
  3. Implement new things in the project, commit, push it to GitHub
  4. Create Pull Request targeting original Unity-MCP repository, main branch.

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for Unity-MCP

Similar Open Source Tools

For similar tasks

For similar jobs