Skip to main content
Glama
yangfch3

Unity MCP Server

by yangfch3

Unity MCP Server

Chinese | English

A Unity Editor plugin that exposes Unity Editor capabilities to external AI agents via the MCP (Model Context Protocol).

Agents (such as Kiro, Cursor, or Claude Code) can connect to the Unity Editor via the standard MCP protocol to invoke editor functions.

Philosophy

This plugin is positioned as a Unity perception layer + diagnostic toolchain for AI Agents:

  • Perception First — Prioritizes high-frequency scenarios such as "reading scene state, obtaining context, and assisting with diagnostics," allowing Agents to fully understand the current project state and assist in development decisions.

  • Structured Writing — Provides safe, auditable write capabilities (e.g., modifying properties, adding/removing nodes), but does not aim to cover all interactions of the Unity Editor GUI.

  • Not a Replacement for the Editor — The goal is to enhance the efficiency of collaboration between engineers and Agents, rather than moving all Editor operations into a dialog box.

Related MCP server: MCP Unity

Features

  • Streamable HTTP Transport — Based on the MCP 2025-03-26 specification, single HTTP endpoint

  • In-Process Execution — No external Node.js/Python processes required; starts directly within the Editor

  • Extensible Tool System — Implement the IMcpTool interface to register new tools with zero modifications to core code

  • Domain Reload Auto-Recovery — Service automatically restarts after entering/exiting PlayMode

Built-in Tools

For full parameter descriptions and usage examples, see Tool Documentation.

Debug Tools

Tool

Function

console_getLogs

Get Unity Console logs (supports filtering)

console_clearLogs

Clear log buffer

debug_getStackTrace

Get full stack trace of the most recent Error/Exception

debug_getPerformanceStats

Get performance metrics like FPS, DrawCalls, memory, etc.

debug_screenshot

Take a screenshot of the Game/Scene view

Editor Tools

Query

Tool

Function

editor_getHierarchy

Get GameObject tree structure

editor_getInspector

Get serialized field values in Inspector

editor_getSelection

Get information about currently selected objects

editor_findGameObjects

Search for GameObjects by name/component

editor_getProjectPath

Get project root directory path

editor_getProjectStructure

Get Assets directory structure

Mutation

Tool

Function

editor_addGameObject

Add a GameObject

editor_deleteGameObject

Delete a GameObject

editor_setField

Modify serialized field values

editor_setTransform

Modify Transform properties

editor_setActive

Modify active state

editor_reparentGameObject

Modify parent node

editor_addComponent

Add a component

editor_removeComponent

Remove a component

editor_setComponentEnabled

Enable/disable a component

editor_selectGameObject

Select a specific GameObject

Project

Tool

Function

menu_execute

Execute Unity menu items by path

playmode_control

Control PlayMode state

Asset

Tool

Function

asset_deleteFolder

Delete Assets subdirectory

Build Tools

Tool

Function

build_compile

Trigger script compilation

build_getCompileErrors

Get list of compilation errors

build_runTests

Run Test Runner tests

Code Tools (Experimental, Unity 2022 Mono only)

Tool

Function

code_executeImmediate

Dynamically compile and execute C# code (supports both main thread/background modes)

Must be manually enabled in the Window → MCP Server panel. See Tool Documentation for details.

Installation

  1. Unity Editor → Window → Package Manager → + → Add package from git URL

  2. Enter the following URL:

https://github.com/yangfch3/Unity-MCP-Server.git

Or edit the host project's Packages/manifest.json directly:

{
  "dependencies": {
    "com.yangfch3.unity-mcp": "https://github.com/yangfch3/Unity-MCP-Server.git"
  }
}

Local Path Installation

  1. Clone this repository

  2. Unity Editor → Window → Package Manager → + → Add package from disk

  3. Select the package.json in the root of this repository

Or add to Packages/manifest.json:

{
  "dependencies": {
    "com.yangfch3.unity-mcp": "file:../../path/to/unity-mcp"
  }
}

Version Updates

After installing via Git URL, UPM locks the current commit hash in the host project's packages-lock.json. It will not update automatically.

To lock a specific version, append a Git Tag to the end of the URL:

https://github.com/yangfch3/Unity-MCP-Server.git#v0.3.0

Corresponding Packages/manifest.json configuration:

{
  "dependencies": {
    "com.yangfch3.unity-mcp": "https://github.com/yangfch3/Unity-MCP-Server.git#v0.3.0"
  }
}

Without a tag, it tracks the latest commit of the default branch:

{
  "dependencies": {
    "com.yangfch3.unity-mcp": "https://github.com/yangfch3/Unity-MCP-Server.git"
  }
}

When updating versions, modify the #tag suffix in manifest.json to the new version number, or re-add the package from the git URL with the new tag in the UPM GUI.

Usage

Start Service

  1. Unity Editor → Window → MCP Server

  2. Set the port (default 8090) and click Start

  3. Copy the configuration JSON from the panel

Configure Agent

Add the following content to your Agent's MCP configuration file (e.g., mcp.json):

{
  "mcpServers": {
    "unity-mcp": {
      "url": "http://localhost:8090/"
    }
  }
}

Extension: Adding Custom Tools

Implement the IMcpTool interface and place it in any Editor assembly; the service will automatically discover and register it upon startup:

using System.Collections.Generic;
using System.Threading.Tasks;
using UnityMcp.Editor;

public class MyCustomTool : IMcpTool
{
    public string Name => "my_custom_tool";
    public string Category => "custom";
    public string Description => "我的自定义工具";
    public string InputSchema => "{\"type\":\"object\",\"properties\":{}}";

    public Task<ToolResult> Execute(Dictionary<string, object> parameters)
    {
        return Task.FromResult(ToolResult.Success("Hello from custom tool!"));
    }
}

Requirements

  • Unity 2022.3+

  • Editor environment only; does not affect runtime builds

Contributing

Contributions to this project are welcome. See CONTRIBUTING.md for details.

License

MIT

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    A bridge enabling seamless communication between Unity and Large Language Models via the Model Context Protocol, allowing developers to automate workflows, manipulate assets, and control the Unity Editor programmatically.
    13,457
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Implementation of the Model Context Protocol for Unity Editor, allowing AI assistants to interact with Unity projects through a Node.js server bridge.
    11
    2
    MIT
  • A
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables AI assistants to interact with Unity Editor through the Model Context Protocol, allowing natural language control of Unity projects including scene manipulation, GameObject creation, component updates, package management, and test execution.
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that integrates AI assistants like Claude and Cursor directly into the Unity Editor to automate game development workflows. It provides over 40 built-in tools for scene manipulation and project management, while offering a simple C# API for creating custom extensions.
    9
    GPL 3.0

View all related MCP servers

Related MCP Connectors

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…

  • A Model Context Protocol server for Wix AI tools

View all MCP Connectors

Latest Blog Posts

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

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