# UnityMCP

> MCP Client

UnityMCP is a Unity Editor plugin implementing the Model Context Protocol, enabling seamless integration between Unity and AI assistants. It offers real-time editor state monitoring, remote command execution, and logging capabilities.

## Overview

- **Category:** Developer Tools
- **Language:** C#
- **Stars:** 520
- **Forks:** 41
- **Owner:** Arodoid
- **GitHub:** https://github.com/Arodoid/UnityMCP
- **Created:** 2025-01-15T00:19:00+00:00
- **Updated:** 2025-03-28T11:16:05+00:00
- **Source:** https://model-context-protocol.com/clients/unity-editor-ai-assistant-integration

## Setup

## Setup

### Installing via Smithery

To install UnityMCP for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@Arodoid/unitymcp):

```bash
npx -y @smithery/cli install @Arodoid/unitymcp --client claude
```

### Prerequisites
- Unity 2022.3 or later
- Node.js 18 or later
- npm 9 or later

### Unity Plugin Setup

1. Copy the `UnityMCPPlugin` folder to your Unity project's Assets directory
2. Open Unity Editor
3. Access the plugin through Unity's top menu bar > UnityMCP > Debug Window

### MCP Server Setup

```bash
cd unity-mcp-server
npm install
npm run build
```

### Starting the Server

```bash
cd unity-mcp-server
node build/index.js
```

### Connecting from Unity

1. Open your Unity project
2. Open the UnityMCP Debug Window (Window > UnityMCP > Debug Window)
3. The plugin will automatically attempt to connect to the MCP server
4. Monitor connection status and logs in the debug window

## Tools

## Available Tools

1. `get_editor_state` (Retrieves current Unity Editor state including active GameObjects, selection state, play mode status, scene hierarchy and project structure, and supports different output formats.)
2. `execute_editor_command` (Executes C# code directly in the Unity Editor with full access to UnityEngine and UnityEditor APIs, real-time execution with comprehensive error handling, and command timeout protection.)
3. `get_logs` (Retrieves and filters Unity Editor logs, supports filtering by type, content, and timestamp, customizable output fields, and buffer management for optimal performance.)
