Unity-MCP

MCP.Pizza Chef: IvanMurzak

Unity-MCP is an MCP server and plugin designed for the Unity Editor and Unity games. It enables seamless connection and interaction with MCP clients such as Claude Desktop, allowing real-time context sharing and control between Unity environments and LLM-powered tools. This integration supports Unity versions 2022.3.61f1 and facilitates enhanced AI-driven workflows within game development and editing processes.

Use This MCP server To

Connect Unity Editor to MCP clients like Claude Desktop Enable real-time context sharing between Unity and LLMs Control Unity game environments via MCP clients Integrate AI-driven workflows into Unity game development Automate Unity Editor tasks using LLM commands Monitor and manipulate Unity playmode states remotely Facilitate collaborative AI-assisted game design in Unity

README

Unity MCP (Server + Plugin)

openupm License Stand With Ukraine

image

Unity Version Editmode Playmode Standalone
2022.3.61f1 2022.3.61f1 2022.3.61f1 2022.3.61f1
2023.2.20f1 2023.2.20f1 2023.2.20f1 2023.2.20f1
6000.0.46f1 6000.0.46f1 6000.0.46f1 6000.0.46f1

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.

AI Tools

GameObject

  • ✅ Create
  • ✅ Destroy
  • ✅ Find
  • ✅ Modify (tag, layer, name, static)
  • ✅ Set parent
  • ✅ Duplicate
GameObject.Components
  • ✅ Add Component
  • ✅ Get Components
  • ✅ Modify Component
    • Field set value
    • Property set value
    • Reference link set
  • ✅ Destroy Component
  • 🔲 Remove missing components

Editor

  • ✅ State (Playmode)
    • ✅ Get
    • ✅ Set
  • 🔲 Get Windows
  • 🔲 Layer
    • 🔲 Get All
    • 🔲 Add
    • 🔲 Remove
  • 🔲 Tag
    • 🔲 Get All
    • 🔲 Add
    • 🔲 Remove
  • 🔲 Execute MenuItem
  • 🔲 Run Tests

Editor.Selection

  • ✅ Get selection
  • ✅ Set selection

Prefabs

  • ✅ Instantiate
  • 🔲 Create
  • ✅ Open
  • ✅ Modify (GameObject.Modify)
  • ✅ Save
  • ✅ Close

Package

  • 🔲 Get installed
  • 🔲 Install
  • 🔲 Remove
  • 🔲 Update

Assets

  • ✅ Create
  • ✅ Find
  • ✅ Refresh
  • ✅ Read
  • ✅ Modify
  • ✅ Rename
  • ✅ Delete
  • ✅ Move
  • ✅ Create folder

Scene

  • ✅ Create
  • ✅ Save
  • ✅ Load
  • ✅ Unload
  • ✅ Get Loaded
  • ✅ Get hierarchy
  • 🔲 Search (editor)
  • 🔲 Raycast (understand volume)

Materials

  • ✅ Create
  • ✅ Modify (Assets.Modify)
  • ✅ Read (Assets.Read)
  • ✅ Assign to a Component on a GameObject

Shader

  • ✅ List All

Scripts

  • ✅ Read
  • ✅ Update or Create
  • ✅ Delete

Scriptable Object

  • 🔲 Create
  • 🔲 Read
  • 🔲 Modify
  • 🔲 Remove

Debug

  • 🔲 Read logs (console)

Component

  • ✅ Get All

Legend: ✅ = Implemented & available, 🔲 = Planned / Not yet implemented

Installation

  1. Install .NET 9.0
  2. Install OpenUPM-CLI
  • Open command line in Unity project folder
  • Run the command
openupm add com.ivanmurzak.unity.mcp

Usage

  1. Make sure your project path doesn't have a space symbol " ".
  • C:/MyProjects/Project
  • C:/My Projects/Project
  1. Open Unity project, go 👉 Window/AI Connector (Unity-MCP).

Unity_WaSRb5FIAR

  1. Install MCP client
  1. Sign-in into MCP client
  2. Click Configure at your MCP client.

image

  1. Restart your MCP client.
  2. Make sure AI Connector is "Connected" or "Connecting..." after restart.
  3. Test AI connection in your Client (Cursor, Claude Desktop). Type any question or task into the chat. Something like:
Explain my scene hierarchy

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

Feel free to add new tool into the project.

  1. Fork the project.
  2. Implement new tool in your forked repository.
  3. Create Pull Request into original Unity-MCP repository.

Unity-MCP FAQ

How do I install Unity-MCP in my Unity project?
You can install Unity-MCP via OpenUPM package manager or by importing the package from GitHub releases compatible with Unity 2022.3.61f1.
Can Unity-MCP connect to multiple MCP clients simultaneously?
Yes, Unity-MCP supports connections to various MCP clients like Claude Desktop and others concurrently.
Does Unity-MCP support both Editmode and Playmode in Unity?
Yes, Unity-MCP works in both Editmode and Playmode, enabling context sharing and control in both states.
Is Unity-MCP compatible with standalone Unity builds?
Yes, Unity-MCP supports standalone builds, allowing MCP client interaction with deployed games.
What LLM providers can I use with Unity-MCP?
Unity-MCP is provider-agnostic and works with OpenAI, Anthropic Claude, and Google Gemini models.
How secure is the communication between Unity-MCP and MCP clients?
Unity-MCP follows MCP protocol principles ensuring scoped, secure, and observable interactions between Unity and clients.
Can I extend Unity-MCP with custom plugins or scripts?
Yes, Unity-MCP is designed to be extensible with custom Unity scripts and plugins to tailor AI workflows.
Where can I find documentation and support for Unity-MCP?
Documentation and support are available on the GitHub repository and OpenUPM package page.