unity-mcp/Server
dsarno ca01fc7610
Server: Robust shutdown on stdio detach (signals, stdin/parent monitor, forced exit) (#363)
* Server: robust shutdown on stdio detach (signals, stdin/parent monitor, forced exit)\nTests: move telemetry tests to tests/ and convert to asserts

* Server: simplify _force_exit to os._exit; guard exit timers to avoid duplicates; fix Windows ValueError in parent monitor; tests: add autouse cwd fixture for telemetry to locate pyproject.toml

* Server: add DEBUG logs for transient stdin checks and monitor thread errors

* Mirror shutdown improvements: signal handlers, stdin/parent monitor, guarded exit timers, and os._exit force-exit in UnityMcpServer~ entry points
2025-10-31 21:38:24 -07:00
..
registry Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
resources Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
tools Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
Dockerfile Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
README.md feat: lower minimum Python requirement to 3.10+ (#362) 2025-10-31 15:44:10 -04:00
__init__.py Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
config.py Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
models.py Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
module_discovery.py Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
port_discovery.py Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
pyproject.toml feat: lower minimum Python requirement to 3.10+ (#362) 2025-10-31 15:44:10 -04:00
pyrightconfig.json Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
reload_sentinel.py Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
server.py Server: Robust shutdown on stdio detach (signals, stdin/parent monitor, forced exit) (#363) 2025-10-31 21:38:24 -07:00
server_version.txt Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
telemetry.py Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
telemetry_decorator.py Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
unity_connection.py Copy the MCP server to the top level (#354) 2025-10-25 00:53:53 -04:00
uv.lock feat: lower minimum Python requirement to 3.10+ (#362) 2025-10-31 15:44:10 -04:00

README.md

MCP for Unity Server

MCP python License Discord

Model Context Protocol server for Unity Editor integration. Control Unity through natural language using AI assistants like Claude, Cursor, and more.

Maintained by Coplay - This project is not affiliated with Unity Technologies.

💬 Join our community: Discord Server

Required: Install the Unity MCP Plugin to connect Unity Editor with this MCP server.


Installation

Run directly from GitHub without installation:

uvx --from git+https://github.com/CoplayDev/unity-mcp@v6.3.0#subdirectory=Server mcp-for-unity

MCP Client Configuration:

{
  "mcpServers": {
    "UnityMCP": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/CoplayDev/unity-mcp@v6.3.0#subdirectory=Server",
        "mcp-for-unity"
      ]
    }
  }
}

Option 2: Using uv (Local Installation)

For local development or custom installations:

# Clone the repository
git clone https://github.com/CoplayDev/unity-mcp.git
cd unity-mcp/Server

# Run with uv
uv run server.py

MCP Client Configuration:

Windows:

{
  "mcpServers": {
    "UnityMCP": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "C:\\path\\to\\unity-mcp\\Server",
        "server.py"
      ]
    }
  }
}

macOS/Linux:

{
  "mcpServers": {
    "UnityMCP": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/unity-mcp/Server",
        "server.py"
      ]
    }
  }
}

Option 3: Using Docker

docker build -t unity-mcp-server .
docker run unity-mcp-server

MCP Client Configuration:

{
  "mcpServers": {
    "UnityMCP": {
      "command": "docker",
      "args": ["run", "-i", "unity-mcp-server"]
    }
  }
}

Configuration

The server connects to Unity Editor automatically when both are running. No additional configuration needed.

Environment Variables:

  • DISABLE_TELEMETRY=true - Opt out of anonymous usage analytics
  • LOG_LEVEL=DEBUG - Enable detailed logging (default: INFO)

Example Prompts

Once connected, try these commands in your AI assistant:

  • "Create a 3D player controller with WASD movement"
  • "Add a rotating cube to the scene with a red material"
  • "Create a simple platformer level with obstacles"
  • "Generate a shader that creates a holographic effect"
  • "List all GameObjects in the current scene"

Documentation

For complete documentation, troubleshooting, and advanced usage:

📖 Full Documentation


Requirements

  • Python: 3.11 or newer
  • Unity Editor: 2021.3 LTS or newer
  • uv: Python package manager (Installation Guide)

License

MIT License - See LICENSE