unity-mcp-cli 0.51.6 → 0.53.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +333 -0
  2. package/bin/{unity-mcp.js → unity-mcp-cli.js} +2 -2
  3. package/dist/commands/configure.js +22 -15
  4. package/dist/commands/configure.js.map +1 -1
  5. package/dist/commands/connect.js +37 -14
  6. package/dist/commands/connect.js.map +1 -1
  7. package/dist/commands/create-project.js +25 -13
  8. package/dist/commands/create-project.js.map +1 -1
  9. package/dist/commands/install-plugin.js +15 -6
  10. package/dist/commands/install-plugin.js.map +1 -1
  11. package/dist/commands/install-unity.d.ts +2 -0
  12. package/dist/commands/install-unity.js +59 -0
  13. package/dist/commands/install-unity.js.map +1 -0
  14. package/dist/commands/open.js +21 -11
  15. package/dist/commands/open.js.map +1 -1
  16. package/dist/commands/remove-plugin.d.ts +2 -0
  17. package/dist/commands/remove-plugin.js +27 -0
  18. package/dist/commands/remove-plugin.js.map +1 -0
  19. package/dist/index.js +26 -10
  20. package/dist/index.js.map +1 -1
  21. package/dist/utils/config.js +5 -5
  22. package/dist/utils/config.js.map +1 -1
  23. package/dist/utils/manifest.d.ts +6 -0
  24. package/dist/utils/manifest.js +40 -13
  25. package/dist/utils/manifest.js.map +1 -1
  26. package/dist/utils/ui.d.ts +50 -0
  27. package/dist/utils/ui.js +136 -0
  28. package/dist/utils/ui.js.map +1 -0
  29. package/dist/utils/unity-editor.d.ts +2 -2
  30. package/dist/utils/unity-editor.js +26 -8
  31. package/dist/utils/unity-editor.js.map +1 -1
  32. package/dist/utils/unity-hub.d.ts +16 -1
  33. package/dist/utils/unity-hub.js +244 -13
  34. package/dist/utils/unity-hub.js.map +1 -1
  35. package/docs/README.es.md +333 -0
  36. package/docs/README.ja.md +333 -0
  37. package/docs/README.zh-CN.md +333 -0
  38. package/package.json +50 -44
  39. package/dist/commands/install-editor.d.ts +0 -2
  40. package/dist/commands/install-editor.js +0 -46
  41. package/dist/commands/install-editor.js.map +0 -1
@@ -0,0 +1,333 @@
1
+ <div align="center" width="100%">
2
+ <h1>Unity MCP — <i>CLI</i></h1>
3
+
4
+ [![npm](https://img.shields.io/npm/v/unity-mcp-cli?label=npm&labelColor=333A41 'npm package')](https://www.npmjs.com/package/unity-mcp-cli)
5
+ [![Node.js](https://img.shields.io/badge/Node.js-%5E20.19.0%20%7C%7C%20%3E%3D22.12.0-5FA04E?logo=nodedotjs&labelColor=333A41 'Node.js')](https://nodejs.org/)
6
+ [![License](https://img.shields.io/github/license/IvanMurzak/Unity-MCP?label=License&labelColor=333A41)](https://github.com/IvanMurzak/Unity-MCP/blob/main/LICENSE)
7
+ [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
8
+
9
+ <img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/promo/ai-developer-banner-glitch.gif" alt="AI Game Developer" title="Unity MCP CLI" width="100%">
10
+
11
+ </div>
12
+
13
+ <b>[English](https://github.com/IvanMurzak/Unity-MCP/blob/main/cli/README.md) | [中文](https://github.com/IvanMurzak/Unity-MCP/blob/main/cli/docs/README.zh-CN.md) | [日本語](https://github.com/IvanMurzak/Unity-MCP/blob/main/cli/docs/README.ja.md)</b>
14
+
15
+ Herramienta CLI multiplataforma para **[Unity MCP](https://github.com/IvanMurzak/Unity-MCP)** — crea proyectos, instala plugins, configura herramientas MCP e inicia Unity con conexiones MCP activas. Todo desde una sola línea de comandos.
16
+
17
+ ## ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-features.svg?raw=true)
18
+
19
+ - :white_check_mark: **Create projects** — crea nuevos proyectos de Unity mediante el Editor de Unity
20
+ - :white_check_mark: **Install editors** — instala cualquier versión del Editor de Unity desde la línea de comandos
21
+ - :white_check_mark: **Install plugin** — añade el plugin Unity-MCP a `manifest.json` con todos los registros de ámbito requeridos
22
+ - :white_check_mark: **Remove plugin** — elimina el plugin Unity-MCP de `manifest.json`
23
+ - :white_check_mark: **Configure** — activa/desactiva herramientas, prompts y recursos MCP
24
+ - :white_check_mark: **Connect** — inicia Unity con variables de entorno MCP para la conexión automática al servidor
25
+ - :white_check_mark: **Cross-platform** — Windows, macOS y Linux
26
+ - :white_check_mark: **Version-aware** — nunca degrada versiones del plugin; resuelve la última versión desde OpenUPM
27
+
28
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
29
+
30
+ # Inicio Rápido
31
+
32
+ Ejecuta cualquier comando al instante con `npx` — sin necesidad de instalación:
33
+
34
+ ```bash
35
+ npx unity-mcp-cli install-plugin /path/to/unity/project
36
+ ```
37
+
38
+ O instala globalmente:
39
+
40
+ ```bash
41
+ npm install -g unity-mcp-cli
42
+ unity-mcp-cli install-plugin /path/to/unity/project
43
+ ```
44
+
45
+ > **Requisitos:** [Node.js](https://nodejs.org/) ^20.19.0 || >=22.12.0. [Unity Hub](https://unity.com/download) se instala automáticamente si no se encuentra.
46
+
47
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
48
+
49
+ # Contenidos
50
+
51
+ - [Inicio Rápido](#inicio-rápido)
52
+ - [Comandos](#comandos)
53
+ - [`create-project`](#create-project) — Crear un nuevo proyecto de Unity
54
+ - [`install-unity`](#install-unity) — Instalar el Editor de Unity mediante Unity Hub
55
+ - [`open`](#open) — Abrir un proyecto de Unity en el Editor
56
+ - [`install-plugin`](#install-plugin) — Instalar el plugin Unity-MCP en un proyecto
57
+ - [`remove-plugin`](#remove-plugin) — Eliminar el plugin Unity-MCP de un proyecto
58
+ - [`configure`](#configure) — Configurar herramientas, prompts y recursos MCP
59
+ - [`connect`](#connect) — Iniciar Unity con conexión MCP
60
+ - [Ejemplo de Automatización Completa](#ejemplo-de-automatización-completa)
61
+ - [Cómo Funciona](#cómo-funciona)
62
+
63
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
64
+
65
+ # Comandos
66
+
67
+ ## `create-project`
68
+
69
+ Crea un nuevo proyecto de Unity utilizando el Editor de Unity.
70
+
71
+ ```bash
72
+ npx unity-mcp-cli create-project /path/to/new/project
73
+ ```
74
+
75
+ | Opción | Requerido | Descripción |
76
+ |---|---|---|
77
+ | `[path]` | Sí | Ruta donde se creará el proyecto (posicional o `--path`) |
78
+ | `--unity <version>` | No | Versión del Editor de Unity a utilizar (por defecto, la más alta instalada) |
79
+
80
+ **Ejemplo — crear un proyecto con una versión específica del editor:**
81
+
82
+ ```bash
83
+ npx unity-mcp-cli create-project ./MyGame --unity 2022.3.62f1
84
+ ```
85
+
86
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
87
+
88
+ ## `install-unity`
89
+
90
+ Instala una versión del Editor de Unity mediante la CLI de Unity Hub.
91
+
92
+ ```bash
93
+ npx unity-mcp-cli install-unity --version 6000.3.1f1
94
+ ```
95
+
96
+ | Opción | Requerido | Descripción |
97
+ |---|---|---|
98
+ | `--version <version>` | No | Versión del Editor de Unity a instalar |
99
+ | `--path <path>` | No | Lee la versión requerida desde un proyecto existente |
100
+
101
+ Si no se proporciona ninguna opción, el comando lista los editores instalados actualmente.
102
+
103
+ **Ejemplo — instalar la versión del editor que necesita un proyecto:**
104
+
105
+ ```bash
106
+ npx unity-mcp-cli install-unity --path ./MyGame
107
+ ```
108
+
109
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
110
+
111
+ ## `open`
112
+
113
+ Abre un proyecto de Unity en el Editor de Unity.
114
+
115
+ ```bash
116
+ npx unity-mcp-cli open ./MyGame
117
+ ```
118
+
119
+ | Opción | Requerido | Descripción |
120
+ |---|---|---|
121
+ | `[path]` | Sí | Ruta al proyecto de Unity (posicional o `--path`) |
122
+ | `--unity <version>` | No | Versión específica del Editor de Unity a utilizar (por defecto, la versión de la configuración del proyecto; si no está disponible, la más alta instalada) |
123
+
124
+ El proceso del editor se lanza en modo desacoplado — la CLI regresa inmediatamente.
125
+
126
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
127
+
128
+ ## `install-plugin`
129
+
130
+ Instala el plugin Unity-MCP en el archivo `Packages/manifest.json` de un proyecto de Unity.
131
+
132
+ ```bash
133
+ npx unity-mcp-cli install-plugin ./MyGame
134
+ ```
135
+
136
+ | Opción | Requerido | Descripción |
137
+ |---|---|---|
138
+ | `[path]` | Sí | Ruta al proyecto de Unity (posicional o `--path`) |
139
+ | `--plugin-version <version>` | No | Versión del plugin a instalar (por defecto, la última desde [OpenUPM](https://openupm.com/packages/com.ivanmurzak.unity.mcp/)) |
140
+
141
+ Este comando:
142
+ 1. Añade el **registro de ámbito de OpenUPM** con todos los ámbitos requeridos
143
+ 2. Añade `com.ivanmurzak.unity.mcp` a `dependencies`
144
+ 3. **Nunca degrada** — si ya hay instalada una versión superior, se conserva
145
+
146
+ **Ejemplo — instalar una versión específica del plugin:**
147
+
148
+ ```bash
149
+ npx unity-mcp-cli install-plugin ./MyGame --plugin-version 0.52.0
150
+ ```
151
+
152
+ > Después de ejecutar este comando, abre el proyecto en el Editor de Unity para completar la instalación del paquete.
153
+
154
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
155
+
156
+ ## `remove-plugin`
157
+
158
+ Elimina el plugin Unity-MCP del archivo `Packages/manifest.json` de un proyecto de Unity.
159
+
160
+ ```bash
161
+ npx unity-mcp-cli remove-plugin ./MyGame
162
+ ```
163
+
164
+ | Opción | Requerido | Descripción |
165
+ |---|---|---|
166
+ | `[path]` | Sí | Ruta al proyecto de Unity (posicional o `--path`) |
167
+
168
+ Este comando:
169
+ 1. Elimina `com.ivanmurzak.unity.mcp` de `dependencies`
170
+ 2. **Conserva los registros de ámbito y sus ámbitos** — otros paquetes pueden depender de ellos
171
+ 3. **No realiza ninguna acción** si el plugin no está instalado
172
+
173
+ > Después de ejecutar este comando, abre el proyecto en el Editor de Unity para aplicar el cambio.
174
+
175
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
176
+
177
+ ## `configure`
178
+
179
+ Configura herramientas, prompts y recursos MCP en `UserSettings/AI-Game-Developer-Config.json`.
180
+
181
+ ```bash
182
+ npx unity-mcp-cli configure ./MyGame --list
183
+ ```
184
+
185
+ | Opción | Requerido | Descripción |
186
+ |---|---|---|
187
+ | `[path]` | Sí | Ruta al proyecto de Unity (posicional o `--path`) |
188
+ | `--list` | No | Muestra la configuración actual y termina |
189
+ | `--enable-tools <names>` | No | Activa herramientas específicas (separadas por comas) |
190
+ | `--disable-tools <names>` | No | Desactiva herramientas específicas (separadas por comas) |
191
+ | `--enable-all-tools` | No | Activa todas las herramientas |
192
+ | `--disable-all-tools` | No | Desactiva todas las herramientas |
193
+ | `--enable-prompts <names>` | No | Activa prompts específicos (separados por comas) |
194
+ | `--disable-prompts <names>` | No | Desactiva prompts específicos (separados por comas) |
195
+ | `--enable-all-prompts` | No | Activa todos los prompts |
196
+ | `--disable-all-prompts` | No | Desactiva todos los prompts |
197
+ | `--enable-resources <names>` | No | Activa recursos específicos (separados por comas) |
198
+ | `--disable-resources <names>` | No | Desactiva recursos específicos (separados por comas) |
199
+ | `--enable-all-resources` | No | Activa todos los recursos |
200
+ | `--disable-all-resources` | No | Desactiva todos los recursos |
201
+
202
+ **Ejemplo — activar herramientas específicas y desactivar todos los prompts:**
203
+
204
+ ```bash
205
+ npx unity-mcp-cli configure ./MyGame \
206
+ --enable-tools gameobject-create,gameobject-find \
207
+ --disable-all-prompts
208
+ ```
209
+
210
+ **Ejemplo — activar todo:**
211
+
212
+ ```bash
213
+ npx unity-mcp-cli configure ./MyGame \
214
+ --enable-all-tools \
215
+ --enable-all-prompts \
216
+ --enable-all-resources
217
+ ```
218
+
219
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
220
+
221
+ ## `connect`
222
+
223
+ Abre un proyecto de Unity y lo conecta a un servidor MCP específico mediante variables de entorno. Cada opción se corresponde con una variable de entorno `UNITY_MCP_*` que el plugin de Unity lee al arrancar.
224
+
225
+ ```bash
226
+ npx unity-mcp-cli connect \
227
+ --path ./MyGame \
228
+ --url http://localhost:8080
229
+ ```
230
+
231
+ | Opción | Variable de Entorno | Requerido | Descripción |
232
+ |---|---|---|---|
233
+ | `--url <url>` | `UNITY_MCP_HOST` | Sí | URL del servidor MCP al que conectarse |
234
+ | `--path <path>` | — | Sí | Ruta al proyecto de Unity |
235
+ | `--keep-connected` | `UNITY_MCP_KEEP_CONNECTED` | No | Fuerza mantener la conexión activa |
236
+ | `--token <token>` | `UNITY_MCP_TOKEN` | No | Token de autenticación |
237
+ | `--auth <option>` | `UNITY_MCP_AUTH_OPTION` | No | Modo de autenticación: `none` o `required` |
238
+ | `--tools <names>` | `UNITY_MCP_TOOLS` | No | Lista de herramientas a activar, separadas por comas |
239
+ | `--transport <method>` | `UNITY_MCP_TRANSPORT` | No | Método de transporte: `streamableHttp` o `stdio` |
240
+ | `--start-server <value>` | `UNITY_MCP_START_SERVER` | No | Establece `true` o `false` para controlar el inicio automático del servidor MCP en el Editor de Unity (solo aplica al transporte `streamableHttp`) |
241
+ | `--unity <version>` | — | No | Versión específica del Editor de Unity a utilizar (por defecto, la versión de la configuración del proyecto; si no está disponible, la más alta instalada) |
242
+
243
+ Este comando inicia el Editor de Unity con las variables de entorno `UNITY_MCP_*` correspondientes para que el plugin las recoja automáticamente al arrancar. Las variables de entorno anulan los valores del archivo de configuración `UserSettings/AI-Game-Developer-Config.json` del proyecto en tiempo de ejecución.
244
+
245
+ **Ejemplo — conectar con autenticación y herramientas específicas:**
246
+
247
+ ```bash
248
+ npx unity-mcp-cli connect \
249
+ --path ./MyGame \
250
+ --url http://my-server:8080 \
251
+ --token my-secret-token \
252
+ --auth required \
253
+ --keep-connected \
254
+ --tools gameobject-create,gameobject-find,script-execute
255
+ ```
256
+
257
+ **Ejemplo — conectar con transporte stdio (servidor gestionado por el agente de IA):**
258
+
259
+ ```bash
260
+ npx unity-mcp-cli connect \
261
+ --path ./MyGame \
262
+ --url http://localhost:8080 \
263
+ --transport stdio \
264
+ --start-server false
265
+ ```
266
+
267
+ **Ejemplo — conectar con streamableHttp e inicio automático del servidor:**
268
+
269
+ ```bash
270
+ npx unity-mcp-cli connect \
271
+ --path ./MyGame \
272
+ --url http://localhost:8080 \
273
+ --transport streamableHttp \
274
+ --start-server true \
275
+ --keep-connected
276
+ ```
277
+
278
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
279
+
280
+ # Ejemplo de Automatización Completa
281
+
282
+ Configura un proyecto Unity MCP completo desde cero con un solo script:
283
+
284
+ ```bash
285
+ # 1. Crear un nuevo proyecto de Unity
286
+ npx unity-mcp-cli create-project ./MyAIGame --unity 6000.3.1f1
287
+
288
+ # 2. Instalar el plugin Unity-MCP
289
+ npx unity-mcp-cli install-plugin ./MyAIGame
290
+
291
+ # 3. Activar todas las herramientas MCP
292
+ npx unity-mcp-cli configure ./MyAIGame --enable-all-tools
293
+
294
+ # 4. Abrir el proyecto con conexión MCP
295
+ npx unity-mcp-cli connect \
296
+ --path ./MyAIGame \
297
+ --url http://localhost:8080 \
298
+ --keep-connected
299
+ ```
300
+
301
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
302
+
303
+ # Cómo Funciona
304
+
305
+ ### Puerto Determinista
306
+
307
+ La CLI genera un **puerto determinista** para cada proyecto de Unity basándose en la ruta de su directorio (hash SHA256 mapeado al rango de puertos 50000–59999). Esto coincide con la generación de puertos del plugin de Unity, garantizando que el servidor y el plugin acuerden automáticamente el mismo puerto sin necesidad de configuración manual.
308
+
309
+ ### Instalación del Plugin
310
+
311
+ El comando `install-plugin` modifica `Packages/manifest.json` directamente:
312
+ - Añade el registro de ámbito de [OpenUPM](https://openupm.com/) (`package.openupm.com`)
313
+ - Registra todos los ámbitos requeridos (`com.ivanmurzak`, `extensions.unity`, `org.nuget.*`)
314
+ - Añade la dependencia `com.ivanmurzak.unity.mcp` con actualizaciones que respetan la versión (nunca degrada)
315
+
316
+ ### Archivo de Configuración
317
+
318
+ El comando `configure` lee y escribe `UserSettings/AI-Game-Developer-Config.json`, que controla:
319
+ - **Tools** — herramientas MCP disponibles para los agentes de IA
320
+ - **Prompts** — prompts predefinidos inyectados en las conversaciones con el LLM
321
+ - **Resources** — datos de solo lectura expuestos a los agentes de IA
322
+ - **Connection settings** — URL del host, token de autenticación, método de transporte, tiempos de espera
323
+
324
+ ### Integración con Unity Hub
325
+
326
+ Los comandos que gestionan editores o crean proyectos usan la **CLI de Unity Hub** (modo `--headless`). Si Unity Hub no está instalado, la CLI **lo descarga e instala automáticamente**:
327
+ - **Windows** — instalación silenciosa mediante `UnityHubSetup.exe /S` (puede requerir privilegios de administrador)
328
+ - **macOS** — descarga el DMG, lo monta y copia `Unity Hub.app` en `/Applications`
329
+ - **Linux** — descarga `UnityHub.AppImage` en `~/Applications/`
330
+
331
+ > Para la documentación completa del proyecto Unity-MCP, consulta el [README principal](https://github.com/IvanMurzak/Unity-MCP/blob/main/README.md).
332
+
333
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
@@ -0,0 +1,333 @@
1
+ <div align="center" width="100%">
2
+ <h1>Unity MCP — <i>CLI</i></h1>
3
+
4
+ [![npm](https://img.shields.io/npm/v/unity-mcp-cli?label=npm&labelColor=333A41 'npm package')](https://www.npmjs.com/package/unity-mcp-cli)
5
+ [![Node.js](https://img.shields.io/badge/Node.js-%5E20.19.0%20%7C%7C%20%3E%3D22.12.0-5FA04E?logo=nodedotjs&labelColor=333A41 'Node.js')](https://nodejs.org/)
6
+ [![License](https://img.shields.io/github/license/IvanMurzak/Unity-MCP?label=License&labelColor=333A41)](https://github.com/IvanMurzak/Unity-MCP/blob/main/LICENSE)
7
+ [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
8
+
9
+ <img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/promo/ai-developer-banner-glitch.gif" alt="AI Game Developer" title="Unity MCP CLI" width="100%">
10
+
11
+ </div>
12
+
13
+ <b>[English](https://github.com/IvanMurzak/Unity-MCP/blob/main/cli/README.md) | [中文](https://github.com/IvanMurzak/Unity-MCP/blob/main/cli/docs/README.zh-CN.md) | [Español](https://github.com/IvanMurzak/Unity-MCP/blob/main/cli/docs/README.es.md)</b>
14
+
15
+ **[Unity MCP](https://github.com/IvanMurzak/Unity-MCP)** 向けのクロスプラットフォーム CLI ツールです — プロジェクトの作成、プラグインのインストール、MCP ツールの設定、アクティブな MCP 接続で Unity を起動するまで、すべてを単一のコマンドラインから実行できます。
16
+
17
+ ## ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-features.svg?raw=true)
18
+
19
+ - :white_check_mark: **プロジェクトの作成** — Unity Editor を通じて新しい Unity プロジェクトをスキャフォールドする
20
+ - :white_check_mark: **エディターのインストール** — コマンドラインから任意の Unity Editor バージョンをインストールする
21
+ - :white_check_mark: **プラグインのインストール** — 必要なすべてのスコープ付きレジストリとともに Unity-MCP プラグインを `manifest.json` に追加する
22
+ - :white_check_mark: **プラグインの削除** — Unity-MCP プラグインを `manifest.json` から削除する
23
+ - :white_check_mark: **設定** — MCP ツール、プロンプト、リソースの有効化・無効化を行う
24
+ - :white_check_mark: **接続** — 自動サーバー接続のための MCP 環境変数を設定して Unity を起動する
25
+ - :white_check_mark: **クロスプラットフォーム** — Windows、macOS、Linux に対応
26
+ - :white_check_mark: **バージョン対応** — プラグインのバージョンをダウングレードせず、OpenUPM から最新バージョンを解決する
27
+
28
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
29
+
30
+ # クイックスタート
31
+
32
+ インストール不要で `npx` を使って任意のコマンドをすぐに実行できます:
33
+
34
+ ```bash
35
+ npx unity-mcp-cli install-plugin /path/to/unity/project
36
+ ```
37
+
38
+ またはグローバルにインストール:
39
+
40
+ ```bash
41
+ npm install -g unity-mcp-cli
42
+ unity-mcp-cli install-plugin /path/to/unity/project
43
+ ```
44
+
45
+ > **動作要件:** [Node.js](https://nodejs.org/) ^20.19.0 または >=22.12.0。[Unity Hub](https://unity.com/download) は見つからない場合に自動的にインストールされます。
46
+
47
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
48
+
49
+ # 目次
50
+
51
+ - [クイックスタート](#クイックスタート)
52
+ - [コマンド](#コマンド)
53
+ - [`create-project`](#create-project) — 新しい Unity プロジェクトを作成する
54
+ - [`install-unity`](#install-unity) — Unity Hub 経由で Unity Editor をインストールする
55
+ - [`open`](#open) — Unity プロジェクトをエディターで開く
56
+ - [`install-plugin`](#install-plugin) — Unity-MCP プラグインをプロジェクトにインストールする
57
+ - [`remove-plugin`](#remove-plugin) — Unity-MCP プラグインをプロジェクトから削除する
58
+ - [`configure`](#configure) — MCP ツール、プロンプト、リソースを設定する
59
+ - [`connect`](#connect) — MCP 接続を確立して Unity を起動する
60
+ - [完全自動化の例](#完全自動化の例)
61
+ - [仕組み](#仕組み)
62
+
63
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
64
+
65
+ # コマンド
66
+
67
+ ## `create-project`
68
+
69
+ Unity Editor を使用して新しい Unity プロジェクトを作成します。
70
+
71
+ ```bash
72
+ npx unity-mcp-cli create-project /path/to/new/project
73
+ ```
74
+
75
+ | オプション | 必須 | 説明 |
76
+ |---|---|---|
77
+ | `[path]` | はい | プロジェクトの作成先パス(位置引数または `--path`) |
78
+ | `--unity <version>` | いいえ | 使用する Unity Editor バージョン(デフォルトは最も高いバージョン) |
79
+
80
+ **例 — 特定のエディターバージョンでプロジェクトを作成:**
81
+
82
+ ```bash
83
+ npx unity-mcp-cli create-project ./MyGame --unity 2022.3.62f1
84
+ ```
85
+
86
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
87
+
88
+ ## `install-unity`
89
+
90
+ Unity Hub CLI を通じて Unity Editor のバージョンをインストールします。
91
+
92
+ ```bash
93
+ npx unity-mcp-cli install-unity --version 6000.3.1f1
94
+ ```
95
+
96
+ | オプション | 必須 | 説明 |
97
+ |---|---|---|
98
+ | `--version <version>` | いいえ | インストールする Unity Editor のバージョン |
99
+ | `--path <path>` | いいえ | 既存のプロジェクトから必要なバージョンを読み取る |
100
+
101
+ どちらのオプションも指定しない場合、コマンドは現在インストールされているエディターの一覧を表示します。
102
+
103
+ **例 — プロジェクトが必要とするエディターバージョンをインストール:**
104
+
105
+ ```bash
106
+ npx unity-mcp-cli install-unity --path ./MyGame
107
+ ```
108
+
109
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
110
+
111
+ ## `open`
112
+
113
+ Unity プロジェクトを Unity Editor で開きます。
114
+
115
+ ```bash
116
+ npx unity-mcp-cli open ./MyGame
117
+ ```
118
+
119
+ | オプション | 必須 | 説明 |
120
+ |---|---|---|
121
+ | `[path]` | はい | Unity プロジェクトへのパス(位置引数または `--path`) |
122
+ | `--unity <version>` | いいえ | 使用する Unity Editor の特定バージョン(デフォルトはプロジェクト設定のバージョン、次に最も高いインストール済みバージョン) |
123
+
124
+ エディターのプロセスはデタッチモードで起動されるため、CLI はすぐに制御を返します。
125
+
126
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
127
+
128
+ ## `install-plugin`
129
+
130
+ Unity-MCP プラグインを Unity プロジェクトの `Packages/manifest.json` にインストールします。
131
+
132
+ ```bash
133
+ npx unity-mcp-cli install-plugin ./MyGame
134
+ ```
135
+
136
+ | オプション | 必須 | 説明 |
137
+ |---|---|---|
138
+ | `[path]` | はい | Unity プロジェクトへのパス(位置引数または `--path`) |
139
+ | `--plugin-version <version>` | いいえ | インストールするプラグインバージョン(デフォルトは [OpenUPM](https://openupm.com/packages/com.ivanmurzak.unity.mcp/) の最新バージョン) |
140
+
141
+ このコマンドは以下を実行します:
142
+ 1. 必要なすべてのスコープを含む **OpenUPM スコープ付きレジストリ** を追加する
143
+ 2. `com.ivanmurzak.unity.mcp` を `dependencies` に追加する
144
+ 3. **ダウングレードしない** — より高いバージョンがすでにインストールされている場合はそれを保持する
145
+
146
+ **例 — 特定のプラグインバージョンをインストール:**
147
+
148
+ ```bash
149
+ npx unity-mcp-cli install-plugin ./MyGame --plugin-version 0.52.0
150
+ ```
151
+
152
+ > このコマンドを実行した後、Unity Editor でプロジェクトを開いてパッケージのインストールを完了してください。
153
+
154
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
155
+
156
+ ## `remove-plugin`
157
+
158
+ Unity-MCP プラグインを Unity プロジェクトの `Packages/manifest.json` から削除します。
159
+
160
+ ```bash
161
+ npx unity-mcp-cli remove-plugin ./MyGame
162
+ ```
163
+
164
+ | オプション | 必須 | 説明 |
165
+ |---|---|---|
166
+ | `[path]` | はい | Unity プロジェクトへのパス(位置引数または `--path`) |
167
+
168
+ このコマンドは以下を実行します:
169
+ 1. `com.ivanmurzak.unity.mcp` を `dependencies` から削除する
170
+ 2. **スコープ付きレジストリとスコープを保持する** — 他のパッケージがそれらに依存している可能性があるため
171
+ 3. プラグインがインストールされていない場合は **何もしない**
172
+
173
+ > このコマンドを実行した後、Unity Editor でプロジェクトを開いて変更を適用してください。
174
+
175
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
176
+
177
+ ## `configure`
178
+
179
+ `UserSettings/AI-Game-Developer-Config.json` 内の MCP ツール、プロンプト、リソースを設定します。
180
+
181
+ ```bash
182
+ npx unity-mcp-cli configure ./MyGame --list
183
+ ```
184
+
185
+ | オプション | 必須 | 説明 |
186
+ |---|---|---|
187
+ | `[path]` | はい | Unity プロジェクトへのパス(位置引数または `--path`) |
188
+ | `--list` | いいえ | 現在の設定を一覧表示して終了する |
189
+ | `--enable-tools <names>` | いいえ | 特定のツールを有効化する(カンマ区切り) |
190
+ | `--disable-tools <names>` | いいえ | 特定のツールを無効化する(カンマ区切り) |
191
+ | `--enable-all-tools` | いいえ | すべてのツールを有効化する |
192
+ | `--disable-all-tools` | いいえ | すべてのツールを無効化する |
193
+ | `--enable-prompts <names>` | いいえ | 特定のプロンプトを有効化する(カンマ区切り) |
194
+ | `--disable-prompts <names>` | いいえ | 特定のプロンプトを無効化する(カンマ区切り) |
195
+ | `--enable-all-prompts` | いいえ | すべてのプロンプトを有効化する |
196
+ | `--disable-all-prompts` | いいえ | すべてのプロンプトを無効化する |
197
+ | `--enable-resources <names>` | いいえ | 特定のリソースを有効化する(カンマ区切り) |
198
+ | `--disable-resources <names>` | いいえ | 特定のリソースを無効化する(カンマ区切り) |
199
+ | `--enable-all-resources` | いいえ | すべてのリソースを有効化する |
200
+ | `--disable-all-resources` | いいえ | すべてのリソースを無効化する |
201
+
202
+ **例 — 特定のツールを有効化してすべてのプロンプトを無効化:**
203
+
204
+ ```bash
205
+ npx unity-mcp-cli configure ./MyGame \
206
+ --enable-tools gameobject-create,gameobject-find \
207
+ --disable-all-prompts
208
+ ```
209
+
210
+ **例 — すべてを有効化:**
211
+
212
+ ```bash
213
+ npx unity-mcp-cli configure ./MyGame \
214
+ --enable-all-tools \
215
+ --enable-all-prompts \
216
+ --enable-all-resources
217
+ ```
218
+
219
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
220
+
221
+ ## `connect`
222
+
223
+ 環境変数を通じて特定の MCP サーバーに接続した状態で Unity プロジェクトを開きます。各オプションは、Unity プラグインが起動時に読み取る `UNITY_MCP_*` 環境変数に対応しています。
224
+
225
+ ```bash
226
+ npx unity-mcp-cli connect \
227
+ --path ./MyGame \
228
+ --url http://localhost:8080
229
+ ```
230
+
231
+ | オプション | 環境変数 | 必須 | 説明 |
232
+ |---|---|---|---|
233
+ | `--url <url>` | `UNITY_MCP_HOST` | はい | 接続先の MCP サーバー URL |
234
+ | `--path <path>` | — | はい | Unity プロジェクトへのパス |
235
+ | `--keep-connected` | `UNITY_MCP_KEEP_CONNECTED` | いいえ | 接続を強制的に維持する |
236
+ | `--token <token>` | `UNITY_MCP_TOKEN` | いいえ | 認証トークン |
237
+ | `--auth <option>` | `UNITY_MCP_AUTH_OPTION` | いいえ | 認証モード: `none` または `required` |
238
+ | `--tools <names>` | `UNITY_MCP_TOOLS` | いいえ | 有効にするツールのカンマ区切りリスト |
239
+ | `--transport <method>` | `UNITY_MCP_TRANSPORT` | いいえ | トランスポートメソッド: `streamableHttp` または `stdio` |
240
+ | `--start-server <value>` | `UNITY_MCP_START_SERVER` | いいえ | `true` または `false` を指定して Unity Editor での MCP サーバー自動起動を制御する(`streamableHttp` トランスポートにのみ適用) |
241
+ | `--unity <version>` | — | いいえ | 使用する Unity Editor の特定バージョン(デフォルトはプロジェクト設定のバージョン、次に最も高いインストール済みバージョン) |
242
+
243
+ このコマンドは対応する `UNITY_MCP_*` 環境変数を設定した状態で Unity Editor を起動し、プラグインが起動時に自動的にそれらを読み取れるようにします。環境変数は実行時にプロジェクトの `UserSettings/AI-Game-Developer-Config.json` 設定ファイルの値を上書きします。
244
+
245
+ **例 — 認証と特定ツールを指定して接続:**
246
+
247
+ ```bash
248
+ npx unity-mcp-cli connect \
249
+ --path ./MyGame \
250
+ --url http://my-server:8080 \
251
+ --token my-secret-token \
252
+ --auth required \
253
+ --keep-connected \
254
+ --tools gameobject-create,gameobject-find,script-execute
255
+ ```
256
+
257
+ **例 — stdio トランスポートで接続(サーバーは AI エージェントが管理):**
258
+
259
+ ```bash
260
+ npx unity-mcp-cli connect \
261
+ --path ./MyGame \
262
+ --url http://localhost:8080 \
263
+ --transport stdio \
264
+ --start-server false
265
+ ```
266
+
267
+ **例 — streamableHttp とサーバー自動起動で接続:**
268
+
269
+ ```bash
270
+ npx unity-mcp-cli connect \
271
+ --path ./MyGame \
272
+ --url http://localhost:8080 \
273
+ --transport streamableHttp \
274
+ --start-server true \
275
+ --keep-connected
276
+ ```
277
+
278
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
279
+
280
+ # 完全自動化の例
281
+
282
+ 1つのスクリプトで Unity MCP プロジェクトをゼロから完全セットアップします:
283
+
284
+ ```bash
285
+ # 1. 新しい Unity プロジェクトを作成する
286
+ npx unity-mcp-cli create-project ./MyAIGame --unity 6000.3.1f1
287
+
288
+ # 2. Unity-MCP プラグインをインストールする
289
+ npx unity-mcp-cli install-plugin ./MyAIGame
290
+
291
+ # 3. すべての MCP ツールを有効化する
292
+ npx unity-mcp-cli configure ./MyAIGame --enable-all-tools
293
+
294
+ # 4. MCP 接続でプロジェクトを開く
295
+ npx unity-mcp-cli connect \
296
+ --path ./MyAIGame \
297
+ --url http://localhost:8080 \
298
+ --keep-connected
299
+ ```
300
+
301
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
302
+
303
+ # 仕組み
304
+
305
+ ### 決定論的ポート
306
+
307
+ CLI は各 Unity プロジェクトのディレクトリパスに基づいて**決定論的なポート**を生成します(SHA256 ハッシュをポート範囲 50000–59999 にマッピング)。これは Unity プラグイン内のポート生成と一致しており、手動設定なしでサーバーとプラグインが自動的に同じポートに合意できます。
308
+
309
+ ### プラグインインストール
310
+
311
+ `install-plugin` コマンドは `Packages/manifest.json` を直接変更します:
312
+ - [OpenUPM](https://openupm.com/) スコープ付きレジストリ(`package.openupm.com`)を追加する
313
+ - 必要なすべてのスコープ(`com.ivanmurzak`、`extensions.unity`、`org.nuget.*`)を登録する
314
+ - バージョン対応の更新(ダウングレードなし)で `com.ivanmurzak.unity.mcp` 依存関係を追加する
315
+
316
+ ### 設定ファイル
317
+
318
+ `configure` コマンドは `UserSettings/AI-Game-Developer-Config.json` を読み書きし、以下を制御します:
319
+ - **Tools** — AI エージェントが利用できる MCP ツール
320
+ - **Prompts** — LLM の会話に注入される事前定義プロンプト
321
+ - **Resources** — AI エージェントに公開される読み取り専用データ
322
+ - **接続設定** — ホスト URL、認証トークン、トランスポートメソッド、タイムアウト
323
+
324
+ ### Unity Hub 統合
325
+
326
+ エディターを管理したりプロジェクトを作成するコマンドは **Unity Hub CLI**(`--headless` モード)を使用します。Unity Hub がインストールされていない場合、CLI は**自動的にダウンロードしてインストール**します:
327
+ - **Windows** — `UnityHubSetup.exe /S` によるサイレントインストール(管理者権限が必要な場合があります)
328
+ - **macOS** — DMG をダウンロードしてマウントし、`Unity Hub.app` を `/Applications` にコピーする
329
+ - **Linux** — `UnityHub.AppImage` を `~/Applications/` にダウンロードする
330
+
331
+ > Unity-MCP プロジェクトの完全なドキュメントについては、[メイン README](https://github.com/IvanMurzak/Unity-MCP/blob/main/README.md) を参照してください。
332
+
333
+ ![AI Game Developer — Unity MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)