Get the FREE Ultimate OpenClaw Setup Guide →

unity

Unity MCP acts as a bridge, allowing AI assistants (like Claude, Cursor) to interact directly with your Unity Editor via a local MCP (Model Context Protocol) Client. Give your LLM tools to manage assets, control scenes, edit scripts, and automate tasks within Unity.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio coplaydev-unity-mcp uvx --from mcpforunityserver mcp-for-unity --transport stdio

How to use

MCP for Unity acts as a bridge between large language model assistants and the Unity Editor, exposing a rich set of tools that allow the LM to inspect and modify your Unity project. It provides commands to manage assets, scenes, materials, scripts, and editor functions, as well as utilities for code generation, test execution, and in-editor automation. The server is designed to work with several MCP clients (such as Claude Desktop, Claude Code, Cursor, VS Code Copilot, Windsurf, and others), enabling an interactive AI-driven workflow inside Unity. To start using it, run the server interface via the recommended transport (stdio via uvx in this setup) and connect a client. Once connected, the LM can issue natural language prompts that map to the available tools like create_script, manage_scene, find_gameobjects, apply_text_edits, and many more, enabling tasks such as building scenes, editing scripts, or batch-processing assets with minimal friction.

Typical use cases include: generating or updating Unity scripts from prompts, manipulating scenes or assets in response to design or gameplay prompts, automating repetitive editor tasks, and validating or executing code within the Unity context. The Quick Start section provides a practical workflow for launching the server, configuring a client, and verifying the connection, after which you can start issuing prompts like "Create a red, blue and yellow cube" or "Build a simple player controller". The tooling catalog is extensive, with resources like cameras, gameobject, prefab_info, project_info, and tool groups, as well as specialized tools such as manage_animation, manage_asset, manage_scene, and Roslyn-based script validation when needed.

How to install

Prerequisites:

  • Unity 2021.3 LTS or newer
  • Python 3.10+ and uv (uvx) for running the MCP server wrapper
  • A supported MCP Client (e.g., Claude Desktop, Claude Code, Cursor, VS Code Copilot, Windsurf, or GitHub Copilot CLI)

Install steps:

  1. Install Unity and set up your project as usual. If you haven’t already, add the MCP for Unity package from Git:
In Unity: Window > Package Manager > + > Add package from git URL...
https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#main
  1. Optional: Try the beta branch for bleeding-edge features:
https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#beta
  1. Open the Unity project and ensure the MCP assets are imported. You can also install via OpenUPM:
openupm add com.coplaydev.unity-mcp
  1. Start the MCP server via uvx (stdio transport):
uvx --from mcpforunityserver mcp-for-unity --transport stdio
  1. Connect a client:
  • In Unity: Window > MCP for Unity > Start Server (likely launches HTTP server on localhost:8080/mcp for HTTP clients)
  • In your MCP client, configure the server endpoint as http://localhost:8080/mcp (for HTTP clients) or use the stdio transport if your client supports it.

If you need an HTTP workflow without uvx, you can configure the server as:

{
  "mcpServers": {
    "unityMCP": {
      "url": "http://localhost:8080/mcp"
    }
  }
}

Note: The exact details may vary based on client and platform. The provided uvx command is the canonical way highlighted in the Unity MCP docs for stdio-based transport.

Additional notes

Tips and caveats:

  • The MCP server supports multiple Unity Editor instances. Use set_active_instance with a Name@hash to target a specific instance, then all subsequent tools route to that instance.
  • For strict Roslyn script validation (advanced), install NuGetForUnity and the required Microsoft.CodeAnalysis packages, then enable USE_ROSLYN in scripting define symbols.
  • Roslyn validation setup requires additional tooling and restarts of the Unity editor to take effect.
  • If auto-setup doesn’t work, you can configure manual HTTP or uvx-based connections as shown in the manual configuration examples inside the README.
  • The tooling catalog is extensive. Start with common tasks like manage_scene, manage_asset, create_script, and find_gameobjects to get a sense of how the LM can interact with Unity workflow.
  • When using multiple clients, ensure the transport (HTTP vs stdio) is consistently configured across clients to avoid connection issues.

Related MCP Servers

Sponsor this space

Reach thousands of developers