# mcp-unity

> MCP Server

This repository provides an MCP (Model Context Protocol) server implementation for Unity, facilitating communication and integration between Unity projects and other systems, licensed under the MIT license. This repository provides

## Overview

- **Category:** Developer Tools
- **Language:** C#
- **Stars:** 1865
- **Forks:** 22
- **Owner:** CoderGamester
- **GitHub:** https://github.com/CoderGamester/mcp-unity
- **Created:** 2025-03-13T20:41:25+00:00
- **Updated:** 2025-03-28T17:57:42+00:00
- **Source:** https://model-context-protocol.com/servers/unity-ai-model-integration-server

## Setup

## Setup

Installing this MCP Unity Server is a multi-step process:

### Step 1: Install Unity MCP Server package via Unity Package Manager
1. Open the Unity Package Manager (Window > Package Manager)
2. Click the "+" button in the top-left corner
3. Select "Add package from git URL..."
4. Enter: `https://github.com/CoderGamester/mcp-unity.git`
5. Click "Add"

### Step 2: Install Node.js
> To run MCP Unity server, you'll need to have Node.js 18 or later installed on your computer:

<details>
<summary><span style="font-size: 1.1em; font-weight: bold;">Windows</span></summary>

1. Visit the [Node.js download page](https://nodejs.org/en/download/)
2. Download the Windows Installer (.msi) for the LTS version (recommended)
3. Run the installer and follow the installation wizard
4. Verify the installation by opening PowerShell and running:
   ```bash
   node --version
   npm --version
   ```
</details>

<details>
<summary><span style="font-size: 1.1em; font-weight: bold;">macOS</span></summary>

1. Visit the [Node.js download page](https://nodejs.org/en/download/)
2. Download the macOS Installer (.pkg) for the LTS version (recommended)
3. Run the installer and follow the installation wizard
4. Alternatively, if you have Homebrew installed, you can run:
   ```bash
   brew install node@18
   ```
5. Verify the installation by opening Terminal and running:
   ```bash
   node --version
   npm --version
   ```
</details>

### Step 3: Configure AI LLM Client

<details open>
<summary><span style="font-size: 1.1em; font-weight: bold;">Option 1: Configure using Unity Editor</span></summary>

> Replace `ABSOLUTE/PATH/TO` with the absolute path to your MCP Unity installation.

The right configuration can be accessed in the Unity Editor MCP Server window (Tools > MCP Unity > Server Window)

</details>

<details>
<summary><span style="font-size: 1.1em; font-weight: bold;">Option 2: Configure via Smithery</span></summary>

To install MCP Unity via [Smithery](https://smithery.ai/server/@CoderGamester/mcp-unity):

```
Currently not available
```
</details>

<details open>
<summary><span style="font-size: 1.1em; font-weight: bold;">Option 3: Configure Manually</span></summary>

Open the MCP configuration file of your AI client (e.g. claude_desktop_config.json in Claude Desktop) and copy the following text:

> Replace `ABSOLUTE/PATH/TO` with the absolute path to your MCP Unity installation.

```json
{
   "mcpServers": {
   "mcp-unity": {
      "command": "node",
      "args": [
         "ABSOLUTE/PATH/TO/mcp-unity/Server/build/index.js"
      ],
      "env": {
         "UNITY_PORT": "8090"
      }
   }
   }
}
```

</details>

## Tools

## Available Tools

1.  **execute_menu_item** (Executes Unity menu items tagged with the MenuItem attribute)
2.  **select_object** (Selects game objects in the Unity hierarchy)
3.  **package_manager** (Installs, removes, and updates packages in the Unity Package Manager)
4.  **run_tests** (Runs tests using the Unity Test Runner)
5.  **notify_message** (Displays messages in the Unity Editor)
6.  **get_menu_items** (Retrieves a list of all available menu items in the Unity Editor to facilitate **execute_menu_item** tool)
7.  **get_hierarchy** (Retrieves a list of all game objects in the Unity hierarchy)
8.  **get_console_logs** (Retrieves a list of all logs from the Unity console)
9.  **get_packages** (Retrieves information about installed and available packages from the Unity Package Manager)
10. **get_assets** (Retrieves information about assets in the Unity Asset Database)
11. **get_tests** (Retrieves information about tests in the Unity Test Runner)
