Home / MCP / Unity MCP Server

Unity MCP Server

Bridges MCP Client and Unity, enabling AI-driven tasks, code generation, and real-time in-engine actions via HTTP or STDIO transports.

typescript
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "unity_http": {
            "url": "http://localhost:8080"
        }
    }
}

Unity MCP is a powerful bridge that connects your MCP Client to the Unity Engine, enabling AI-driven gameplay development, automation of tasks, and dynamic content creation. You can chat with an LLM to perform Unity operations, access project data, and run code with instant feedback, all through configurable MCP Tools, Resources, and Prompts.

How to use

Interact with the AI through your MCP Client by sending natural language requests like “explain my scene hierarchy” or “create 3 cubes in a circle with radius 2.” The AI uses executable MCP Tools to perform actions in Unity, reads data via MCP Resources to inform decisions, and follows MCP Prompts to guide behavior. Turn on Agent mode to let the AI autonomously propose and execute tasks within the project.

How to install

Prerequisites: ensure you have Unity installed and access to a networked or local development environment. The installation flow covers installing the Unity MCP Plugin, selecting an MCP Client, and configuring the client for smooth operation.

Step 1 — Install Unity MCP Plugin: you have two options.

Option 1 — Installer: download the installer, then import it into your Unity project by double-clicking the file or via Unity: Assets/Import Package/Custom Package and choosing the installer.

Option 2 — OpenUPM-CLI: install OpenUPM-CLI, then run the following in your Unity project folder.

openupm add com.ivanmurzak.unity.mcp

How to install (continued)

Step 2 — Install MCP Client: choose one MCP Client you prefer as your main chat window to communicate with the LLM. Options include Claude Code, Claude Desktop, GitHub Copilot in VS Code, Cursor, Windsurf, or any other supported client. The MCP protocol is universal, so you can swap clients as needed.

Step 3 — Configure MCP Client: set up automatic or manual configuration so the client can reach the Unity MCP Server.

Automatic configuration: Open Unity project, go to Window/AI Game Developer (Unity-MCP), and click Configure in your MCP client to auto-inject server details.

Manual configuration: If automatic setup doesn’t work, copy the JSON structure from the Unity-MCP window and paste it into your MCP Client to configure the server manually.

Command line for launching the server: use the appropriate command for your platform, ensuring you replace placeholder paths and ports with your actual setup.

Additional setup and commands

Unity MCP Server supports both HTTP (remote) and STDIO (local) transport. You can run the server via Docker or as a binary. The server port and client transport can be customized via environment variables or command line arguments.

Runtime usage (in-game)

Use the Unity MCP Plugin in your game or app to build and start the plug-in, connect to the MCP Server, and manage connections as needed. The runtime flow enables you to perform AI-powered decisions, access project data, and apply changes in real time.

How it works

Unity MCP acts as a bridge between LLMs and Unity. It exposes Unity’s tools to the LLM, which can then call those tools to perform actions. You can connect MCP Clients to Unity MCP Server, and extend functionality by adding custom MCP Tools, MCP Resources, and MCP Prompts directly in your Unity project.

Unity MCP Server setup

The server supports HTTP and STDIO transports and can be deployed via Docker or run as a binary. You can adjust the port and client transport using environment variables or command line arguments.

Environment variables available for server configuration include port, plugin timeout, and client transport type.

Docker deployment examples:

docker run -p 8080:8080 ivanmurzakdev/unity-mcp-server

Configuration snippets

HTTP transport MCP Client config example (endpoint at localhost:8080):

{
  "mcpServers": {
    "Unity-MCP": {
      "url": "http://localhost:8080"
    }
  }
}

What to run for STDIO transport

To use STDIO, run the server in Docker with a transport override and expose port 8080.

docker run -t -e UNITY_MCP_CLIENT_TRANSPORT=stdio -p 8080:8080 ivanmurzakdev/unity-mcp-server

Binary executable

You can launch the Unity MCP Server directly from a compiled binary suitable for your CPU architecture. Use the provided command with the correct paths and port.

./unity-mcp-server --port 8080 --plugin-timeout 10000 --client-transport stdio

What it provides

MCP Tools enable the LLM to perform Unity operations, MCP Resources provide read-only project data for context, and MCP Prompts inject guidance and domain knowledge into conversations. Tools are executable, return feedback, and can run on main or background threads as needed.

Examples of MCP Tools and Prompts

- Create and configure GameObjects with specific components - Batch process assets like textures or materials - Set up lighting and post-processing effects - Generate level geometry or place objects procedurally - Expose core game logic to AI for dynamic content creation

Contribution

If you have ideas for new MCP Tools or features, or you identified a bug, contribute by creating a pull request with clear changes and explanations. Follow established workflows for forking, developing, and proposing changes.

Available tools

MyCustomTask

A custom MCP Tool that creates a Unity operation from a script, returning a success message after running on the main thread.

chess-do-turn

Do the turn in a chess game by validating the move and applying it to the game state; returns true if the turn is accepted.

chess-get-board

Fetch the current board state from the chess game to inform AI decisions.

add-event-system

Injects a UnityEvent-based communication system between game objects for decoupled interactions.