Skip to main content
Glama

Unity-MCP

✨ AI Game Developer — Unity MCP

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.

Features for a human

  • ✅ Few clicks installation
  • ✅ Chat with AI like with a human
  • ✅ 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 VersionEditmodePlaymodeStandalone
2022.3.61f1
2023.2.20f1
6000.0.46f1

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

Option 1: Install .unitypackage installer

  • ⬇️ Download the Installer ⬇️
  • 📂 Open the 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

Option 2: Using OpenUPM

This option is recommended for people well familiar with command line and probably with the NPM package managers.

openupm add com.ivanmurzak.unity.mcp

👉 Configure MCP client

🟢 Step 1 Open AI Connector window

Open Unity project, go 👉 Window/AI Connector (Unity-MCP).

Unity_AI

🟢 Step 2: Click Configure at your MCP client

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.

👉 Talk to LLM

Make sure Agent mode is turned on in MCP client

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

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

Running PlayMode tests

To be able to run Play Mode tests via the TestRunner MCP tool, you should consider configuring Unity to not perform a domain reload when entering Play Mode (Edit -> Project Settings -> Editor -> Enter Play Mode Settings - set to Reload Scene only or Do not reload Domain or Scene). Otherwise, starting the Play Mode tests will interrupt the TestRunner MCP tool, leading to a cycle of tests restarting.


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.
-
security - not tested
A
license - permissive license
-
quality - not tested

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.

  1. AI Tools
    1. GameObject
    2. Editor
    3. Prefabs
    4. Package
    5. Assets
    6. Scene
    7. Materials
    8. Shader
    9. Scripts
    10. Scriptable Object
    11. Debug
    12. Component
  2. Installation
    1. Usage
      1. Add custom tool
        1. Add custom in-game tool
          1. Contribution

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              MCP Unity Server to integrate Unity Editor game engine with different AI Model clients (e.g. Claude Desktop, Windsurf, Cursor)
              Last updated -
              5
              901
              MIT License
              • Apple
            • -
              security
              A
              license
              -
              quality
              A Unity Master Control Protocol implementation that allows AI agents to control and interact with Unity, enabling them to execute code, query editor state, modify GameObjects, and capture screenshots through a WebSocket-based communication system.
              Last updated -
              7
              MIT License
              • Linux
              • Apple
            • -
              security
              F
              license
              -
              quality
              Unreal-Blender MCP is a unified server for controlling both Blender and Unreal Engine via AI agents using the MCP (Machine Control Protocol) approach.
              Last updated -
              5
              Python
              • Linux
              • Apple
            • -
              security
              A
              license
              -
              quality
              An MCP server that bridges AI agents with GUI automation capabilities, allowing them to control mouse, keyboard, windows, and take screenshots to interact with desktop applications.
              Last updated -
              8
              Python
              MIT License
              • Apple
              • Linux

            View all related MCP servers

            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/IvanMurzak/Unity-MCP'

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