Labsco
MCP SERVER

Unity-MCP

by TSavo

Execute C# in a running Unity project and query the scene with dot notation — `Scene['Player'].transform.position` — with results stored in AILogger for later retrieval.

3D, CAD & Game Engines
Summary
Arbitrary C# in your running game — that is the power and the warning.

The two real tools are code execution and a query shorthand that compiles down to the same thing, which means the assistant's reach inside the project is whatever C# can reach. Persistence goes through AILogger rather than a separate server component, so results survive the call. Several distribution paths in the docs — npm, Docker, npx, the Unity package — are marked coming soon, so the working route today is building from source.

What it is

A bridge between Unity and an AI assistant. The MCP stdio client forwards commands to a Unity client that runs them inside the editor or game, and stores results in AILogger so an assistant can fetch them afterwards rather than holding them in the conversation.

What you get
  • C# executed in Unity at runtime, with a `timeout` in milliseconds (default 1000) — `execute_code`
  • The scene queried by dot notation over objects, properties and methods — `query`, which wraps the expression in a `return` statement and runs it the same way
  • Results and logs retrieved afterwards from AILogger — `get_result`, `get_logs`, `get_log_details`, `get_log_by_name`, `unity_get_logs_by_name`
  • Built-in guidance on the available tools — `help`
  • Game objects and their components inspected, scene hierarchies analysed, tests run, methods invoked, and game state modified during runtime
Requirements

Node.js 16.x or later, npm 7.x or later, TypeScript 4.x or later, and Unity 2020.3 or later. Clone the repository, `npm install`, `npm run build`, then run it. Configuration is by environment variable or a `.env` file: `MCP_PORT` (default 8080), `MCP_NAME`, `MCP_DESCRIPTION`, `MCP_ADVERTISE`, `NODE_ENV`. Verify a running server by opening `http://localhost:8080/manifest`. The Unity side needs the MCP component on a GameObject in your scene, pointed at the server URL.

Setup effort

One command — npx -y unity-mcp