Unity MCP

Visit Repo
95
MCP Server for Unity Editor and for a game made with Unity
Author:@IvanMurzak
Updated at:

Gaming

Unity MCP (Server + Plugin)

openupm License Stand With Ukraine

image

Unity VersionEditmodePlaymodeStandalone
2022.3.61f12022.3.61f12022.3.61f12022.3.61f1
2023.2.20f12023.2.20f12023.2.20f12023.2.20f1
6000.0.46f16000.0.46f16000.0.46f16000.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

  2. Open Unity project, go πŸ‘‰ Window/AI Connector (Unity-MCP).

Unity_WaSRb5FIAR

  1. Install MCP client > - Install Cursor (recommended) > - Install Claude

  2. Sign-in into MCP client

  3. 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.
MCP Index is your go-to directory for Model Context Protocol servers. Discover and integrate powerful MCP solutions to enhance AI applications like Claude, Cursor, and Cline. Find official and community servers with integration guides and compatibility details.
Copyright Β© 2025