# Unity-MCP

Connects Claude, Claude, Cursor and other MCP clients to Unity: the agent drives the editor, writes code, and runs inside your compiled game.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 4523
- Author: IvanMurzak
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/IvanMurzak/Unity-MCP/tree/HEAD/unity-mcp-server
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/unity-mcp

## What it does

The server links an MCP client to Unity Editor and to the runtime of a built game. From the agent you call editor tools, generate mechanics and tests, and in runtime you can wire an LLM straight into the game for NPC behaviour or debugging. Skills are generated for your OS, Unity version and the plugins in the project.

Two pieces are involved: the MCP server and a Unity plugin. The server runs in Docker (`docker.io/ivanmurzakdev/unity-mcp-server:0.17.1`) over stdio locally or http remotely. The plugin goes into the project via the `.unitypackage` installer or the CLI: `npm install -g unity-mcp-cli`, then `unity-mcp-cli install-plugin ./MyUnityProject` and `unity-mcp-cli login`, which opens the browser for an OAuth device flow.

You need Docker and three environment variables: `UNITY_MCP_PORT`, `UNITY_MCP_PLUGIN_TIMEOUT`, `UNITY_MCP_CLIENT_TRANSPORT`. If Docker is not running the server never starts, so check that first when a connection fails. Custom tools can be written in your own project code.

## Requirements
- Needs: Docker
- Environment variables: `UNITY_MCP_PORT`, `UNITY_MCP_PLUGIN_TIMEOUT`, `UNITY_MCP_CLIENT_TRANSPORT` — keys and tokens: ask the human for the values, never commit them or put them in shared files.
- Works with: Unity

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env UNITY_MCP_PORT=<UNITY_MCP_PORT> --env UNITY_MCP_PLUGIN_TIMEOUT=<UNITY_MCP_PLUGIN_TIMEOUT> --env UNITY_MCP_CLIENT_TRANSPORT=<UNITY_MCP_CLIENT_TRANSPORT> --transport stdio unity-mcp-server -- docker run -i --rm -e UNITY_MCP_PORT -e UNITY_MCP_PLUGIN_TIMEOUT -e UNITY_MCP_CLIENT_TRANSPORT docker.io/ivanmurzakdev/unity-mcp-server:0.17.1
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add unity-mcp-server --env UNITY_MCP_PORT=<UNITY_MCP_PORT> --env UNITY_MCP_PLUGIN_TIMEOUT=<UNITY_MCP_PLUGIN_TIMEOUT> --env UNITY_MCP_CLIENT_TRANSPORT=<UNITY_MCP_CLIENT_TRANSPORT> -- docker run -i --rm -e UNITY_MCP_PORT -e UNITY_MCP_PLUGIN_TIMEOUT -e UNITY_MCP_CLIENT_TRANSPORT docker.io/ivanmurzakdev/unity-mcp-server:0.17.1
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "unity-mcp-server": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "UNITY_MCP_PORT",
                "-e",
                "UNITY_MCP_PLUGIN_TIMEOUT",
                "-e",
                "UNITY_MCP_CLIENT_TRANSPORT",
                "docker.io/ivanmurzakdev/unity-mcp-server:0.17.1"
            ],
            "env": {
                "UNITY_MCP_PORT": "<UNITY_MCP_PORT>",
                "UNITY_MCP_PLUGIN_TIMEOUT": "<UNITY_MCP_PLUGIN_TIMEOUT>",
                "UNITY_MCP_CLIENT_TRANSPORT": "<UNITY_MCP_CLIENT_TRANSPORT>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "unity-mcp-server": {
            "type": "stdio",
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "UNITY_MCP_PORT",
                "-e",
                "UNITY_MCP_PLUGIN_TIMEOUT",
                "-e",
                "UNITY_MCP_CLIENT_TRANSPORT",
                "docker.io/ivanmurzakdev/unity-mcp-server:0.17.1"
            ],
            "env": {
                "UNITY_MCP_PORT": "<UNITY_MCP_PORT>",
                "UNITY_MCP_PLUGIN_TIMEOUT": "<UNITY_MCP_PLUGIN_TIMEOUT>",
                "UNITY_MCP_CLIENT_TRANSPORT": "<UNITY_MCP_CLIENT_TRANSPORT>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e UNITY_MCP_PORT=<UNITY_MCP_PORT> -e UNITY_MCP_PLUGIN_TIMEOUT=<UNITY_MCP_PLUGIN_TIMEOUT> -e UNITY_MCP_CLIENT_TRANSPORT=<UNITY_MCP_CLIENT_TRANSPORT> unity-mcp-server docker run -i --rm -e UNITY_MCP_PORT -e UNITY_MCP_PLUGIN_TIMEOUT -e UNITY_MCP_CLIENT_TRANSPORT docker.io/ivanmurzakdev/unity-mcp-server:0.17.1
```
Replace <…> with your own values

## When to use it
- drive Unity scenes and objects from an agent chat
- generate a game mechanic together with its tests
- run an LLM inside the compiled game for NPCs
- let an agent find and fix a bug in the project
- build a skill set matching the Unity version and project plugins

## Example prompts
- connect to Unity and list the objects in the current scene
- create a player movement script and attach it to the Player object
- switch to runtime mode and hook an LLM into the NPC behaviour

## Similar
- [Pascal 3D Editor](https://affpapa.org/en/nevibecode/mcp/pascal-3d-editor.md) — MCP server · ★ 25085

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
