unity-mcp-cli 0.53.1 → 0.55.0
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.
- package/README.md +168 -114
- package/dist/commands/configure.js +3 -0
- package/dist/commands/configure.js.map +1 -1
- package/dist/commands/create-project.js +6 -3
- package/dist/commands/create-project.js.map +1 -1
- package/dist/commands/install-plugin.js +14 -3
- package/dist/commands/install-plugin.js.map +1 -1
- package/dist/commands/install-unity.js +27 -14
- package/dist/commands/install-unity.js.map +1 -1
- package/dist/commands/open.js +75 -7
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/remove-plugin.js +2 -0
- package/dist/commands/remove-plugin.js.map +1 -1
- package/dist/commands/run-tool.d.ts +2 -0
- package/dist/commands/run-tool.js +180 -0
- package/dist/commands/run-tool.js.map +1 -0
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/utils/config.d.ts +17 -1
- package/dist/utils/config.js +26 -0
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/manifest.d.ts +6 -3
- package/dist/utils/manifest.js +30 -27
- package/dist/utils/manifest.js.map +1 -1
- package/dist/utils/ui.d.ts +23 -3
- package/dist/utils/ui.js +170 -18
- package/dist/utils/ui.js.map +1 -1
- package/dist/utils/unity-editor.d.ts +5 -0
- package/dist/utils/unity-editor.js +42 -2
- package/dist/utils/unity-editor.js.map +1 -1
- package/dist/utils/unity-hub.d.ts +29 -1
- package/dist/utils/unity-hub.js +260 -17
- package/dist/utils/unity-hub.js.map +1 -1
- package/docs/README.es.md +128 -113
- package/docs/README.ja.md +128 -113
- package/docs/README.zh-CN.md +128 -113
- package/package.json +2 -5
- package/dist/commands/connect.d.ts +0 -2
- package/dist/commands/connect.js +0 -87
- package/dist/commands/connect.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,6 +8,21 @@
|
|
|
8
8
|
|
|
9
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
10
|
|
|
11
|
+
<p>
|
|
12
|
+
<a href="https://claude.ai/download"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/claude-64.png" alt="Claude" title="Claude" height="36"></a>
|
|
13
|
+
<a href="https://openai.com/index/introducing-codex/"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/codex-64.png" alt="Codex" title="Codex" height="36"></a>
|
|
14
|
+
<a href="https://www.cursor.com/"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/cursor-64.png" alt="Cursor" title="Cursor" height="36"></a>
|
|
15
|
+
<a href="https://code.visualstudio.com/docs/copilot/overview"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/github-copilot-64.png" alt="GitHub Copilot" title="GitHub Copilot" height="36"></a>
|
|
16
|
+
<a href="https://gemini.google.com/"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/gemini-64.png" alt="Gemini" title="Gemini" height="36"></a>
|
|
17
|
+
<a href="https://antigravity.google/"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/antigravity-64.png" alt="Antigravity" title="Antigravity" height="36"></a>
|
|
18
|
+
<a href="https://code.visualstudio.com/"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/vs-code-64.png" alt="VS Code" title="VS Code" height="36"></a>
|
|
19
|
+
<a href="https://www.jetbrains.com/rider/"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/rider-64.png" alt="Rider" title="Rider" height="36"></a>
|
|
20
|
+
<a href="https://visualstudio.microsoft.com/"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/visual-studio-64.png" alt="Visual Studio" title="Visual Studio" height="36"></a>
|
|
21
|
+
<a href="https://github.com/anthropics/claude-code"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/open-code-64.png" alt="Open Code" title="Open Code" height="36"></a>
|
|
22
|
+
<a href="https://github.com/cline/cline"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/cline-64.png" alt="Cline" title="Cline" height="36"></a>
|
|
23
|
+
<a href="https://github.com/kilocode/kilo-code"><img src="https://github.com/IvanMurzak/Unity-MCP/raw/main/docs/img/mcp-clients/kilo-code-64.png" alt="Kilo Code" title="Kilo Code" height="36"></a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
11
26
|
</div>
|
|
12
27
|
|
|
13
28
|
<b>[中文](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) | [Español](https://github.com/IvanMurzak/Unity-MCP/blob/main/cli/docs/README.es.md)</b>
|
|
@@ -21,8 +36,11 @@ Cross-platform CLI tool for **[Unity MCP](https://github.com/IvanMurzak/Unity-MC
|
|
|
21
36
|
- :white_check_mark: **Install plugin** — add Unity-MCP plugin to `manifest.json` with all required scoped registries
|
|
22
37
|
- :white_check_mark: **Remove plugin** — remove Unity-MCP plugin from `manifest.json`
|
|
23
38
|
- :white_check_mark: **Configure** — enable/disable MCP tools, prompts, and resources
|
|
24
|
-
- :white_check_mark: **
|
|
39
|
+
- :white_check_mark: **Run tools** — execute MCP tools directly from the command line
|
|
40
|
+
- :white_check_mark: **Open & Connect** — launch Unity with optional MCP environment variables for automated server connection
|
|
25
41
|
- :white_check_mark: **Cross-platform** — Windows, macOS, and Linux
|
|
42
|
+
- :white_check_mark: **CI-friendly** — auto-detects non-interactive terminals and disables spinners/colors
|
|
43
|
+
- :white_check_mark: **Verbose mode** — use `--verbose` on any command for detailed diagnostic output
|
|
26
44
|
- :white_check_mark: **Version-aware** — never downgrades plugin versions, resolves latest from OpenUPM
|
|
27
45
|
|
|
28
46
|

|
|
@@ -50,13 +68,14 @@ unity-mcp-cli install-plugin /path/to/unity/project
|
|
|
50
68
|
|
|
51
69
|
- [Quick Start](#quick-start)
|
|
52
70
|
- [Commands](#commands)
|
|
71
|
+
- [`configure`](#configure) — Configure MCP tools, prompts, and resources
|
|
53
72
|
- [`create-project`](#create-project) — Create a new Unity project
|
|
73
|
+
- [`install-plugin`](#install-plugin) — Install Unity-MCP plugin into a project
|
|
54
74
|
- [`install-unity`](#install-unity) — Install Unity Editor via Unity Hub
|
|
55
75
|
- [`open`](#open) — Open a Unity project in the Editor
|
|
56
|
-
- [`install-plugin`](#install-plugin) — Install Unity-MCP plugin into a project
|
|
57
76
|
- [`remove-plugin`](#remove-plugin) — Remove Unity-MCP plugin from a project
|
|
58
|
-
- [`
|
|
59
|
-
|
|
77
|
+
- [`run-tool`](#run-tool) — Execute an MCP tool via the HTTP API
|
|
78
|
+
- [Global Options](#global-options)
|
|
60
79
|
- [Full Automation Example](#full-automation-example)
|
|
61
80
|
- [How It Works](#how-it-works)
|
|
62
81
|
|
|
@@ -64,64 +83,68 @@ unity-mcp-cli install-plugin /path/to/unity/project
|
|
|
64
83
|
|
|
65
84
|
# Commands
|
|
66
85
|
|
|
67
|
-
## `
|
|
86
|
+
## `configure`
|
|
68
87
|
|
|
69
|
-
|
|
88
|
+
Configure MCP tools, prompts, and resources in `UserSettings/AI-Game-Developer-Config.json`.
|
|
70
89
|
|
|
71
90
|
```bash
|
|
72
|
-
npx unity-mcp-cli
|
|
91
|
+
npx unity-mcp-cli configure ./MyGame --list
|
|
73
92
|
```
|
|
74
93
|
|
|
75
94
|
| Option | Required | Description |
|
|
76
95
|
|---|---|---|
|
|
77
|
-
| `[path]` | Yes | Path
|
|
78
|
-
| `--
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
96
|
+
| `[path]` | Yes | Path to the Unity project (positional or `--path`) |
|
|
97
|
+
| `--list` | No | List current configuration and exit |
|
|
98
|
+
| `--enable-tools <names>` | No | Enable specific tools (comma-separated) |
|
|
99
|
+
| `--disable-tools <names>` | No | Disable specific tools (comma-separated) |
|
|
100
|
+
| `--enable-all-tools` | No | Enable all tools |
|
|
101
|
+
| `--disable-all-tools` | No | Disable all tools |
|
|
102
|
+
| `--enable-prompts <names>` | No | Enable specific prompts (comma-separated) |
|
|
103
|
+
| `--disable-prompts <names>` | No | Disable specific prompts (comma-separated) |
|
|
104
|
+
| `--enable-all-prompts` | No | Enable all prompts |
|
|
105
|
+
| `--disable-all-prompts` | No | Disable all prompts |
|
|
106
|
+
| `--enable-resources <names>` | No | Enable specific resources (comma-separated) |
|
|
107
|
+
| `--disable-resources <names>` | No | Disable specific resources (comma-separated) |
|
|
108
|
+
| `--enable-all-resources` | No | Enable all resources |
|
|
109
|
+
| `--disable-all-resources` | No | Disable all resources |
|
|
89
110
|
|
|
90
|
-
|
|
111
|
+
**Example — enable specific tools and disable all prompts:**
|
|
91
112
|
|
|
92
113
|
```bash
|
|
93
|
-
npx unity-mcp-cli
|
|
114
|
+
npx unity-mcp-cli configure ./MyGame \
|
|
115
|
+
--enable-tools gameobject-create,gameobject-find \
|
|
116
|
+
--disable-all-prompts
|
|
94
117
|
```
|
|
95
118
|
|
|
96
|
-
|
|
97
|
-
|---|---|---|
|
|
98
|
-
| `--version <version>` | No | Unity Editor version to install |
|
|
99
|
-
| `--path <path>` | No | Read the required version from an existing project |
|
|
100
|
-
|
|
101
|
-
If neither option is provided, the command lists currently installed editors.
|
|
102
|
-
|
|
103
|
-
**Example — install the editor version that a project needs:**
|
|
119
|
+
**Example — enable everything:**
|
|
104
120
|
|
|
105
121
|
```bash
|
|
106
|
-
npx unity-mcp-cli
|
|
122
|
+
npx unity-mcp-cli configure ./MyGame \
|
|
123
|
+
--enable-all-tools \
|
|
124
|
+
--enable-all-prompts \
|
|
125
|
+
--enable-all-resources
|
|
107
126
|
```
|
|
108
127
|
|
|
109
128
|

|
|
110
129
|
|
|
111
|
-
## `
|
|
130
|
+
## `create-project`
|
|
112
131
|
|
|
113
|
-
|
|
132
|
+
Create a new Unity project using the Unity Editor.
|
|
114
133
|
|
|
115
134
|
```bash
|
|
116
|
-
npx unity-mcp-cli
|
|
135
|
+
npx unity-mcp-cli create-project /path/to/new/project
|
|
117
136
|
```
|
|
118
137
|
|
|
119
138
|
| Option | Required | Description |
|
|
120
139
|
|---|---|---|
|
|
121
|
-
| `[path]` | Yes | Path
|
|
122
|
-
| `--unity <version>` | No |
|
|
140
|
+
| `[path]` | Yes | Path where the project will be created (positional or `--path`) |
|
|
141
|
+
| `--unity <version>` | No | Unity Editor version to use (defaults to highest installed) |
|
|
123
142
|
|
|
124
|
-
|
|
143
|
+
**Example — create a project with a specific editor version:**
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npx unity-mcp-cli create-project ./MyGame --unity 2022.3.62f1
|
|
147
|
+
```
|
|
125
148
|
|
|
126
149
|

|
|
127
150
|
|
|
@@ -153,126 +176,158 @@ npx unity-mcp-cli install-plugin ./MyGame --plugin-version 0.51.6
|
|
|
153
176
|
|
|
154
177
|

|
|
155
178
|
|
|
156
|
-
## `
|
|
179
|
+
## `install-unity`
|
|
157
180
|
|
|
158
|
-
|
|
181
|
+
Install a Unity Editor version via Unity Hub CLI.
|
|
159
182
|
|
|
160
183
|
```bash
|
|
161
|
-
npx unity-mcp-cli
|
|
184
|
+
npx unity-mcp-cli install-unity 6000.3.1f1
|
|
162
185
|
```
|
|
163
186
|
|
|
164
|
-
| Option | Required | Description |
|
|
187
|
+
| Argument / Option | Required | Description |
|
|
165
188
|
|---|---|---|
|
|
166
|
-
| `[
|
|
189
|
+
| `[version]` | No | Unity Editor version to install (e.g. `6000.3.1f1`) |
|
|
190
|
+
| `--path <path>` | No | Read the required version from an existing project |
|
|
167
191
|
|
|
168
|
-
|
|
169
|
-
1. Removes `com.ivanmurzak.unity.mcp` from `dependencies`
|
|
170
|
-
2. **Preserves scoped registries and scopes** — other packages may depend on them
|
|
171
|
-
3. **No-op** if the plugin is not installed
|
|
192
|
+
If neither argument nor option is provided, the command installs the latest stable release from Unity Hub's releases list.
|
|
172
193
|
|
|
173
|
-
|
|
194
|
+
**Example — install the editor version that a project needs:**
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
npx unity-mcp-cli install-unity --path ./MyGame
|
|
198
|
+
```
|
|
174
199
|
|
|
175
200
|

|
|
176
201
|
|
|
177
|
-
## `
|
|
202
|
+
## `open`
|
|
178
203
|
|
|
179
|
-
|
|
204
|
+
Open a Unity project in the Unity Editor. By default, sets MCP connection environment variables if connection options are provided. Use `--no-connect` to open without MCP connection.
|
|
180
205
|
|
|
181
206
|
```bash
|
|
182
|
-
npx unity-mcp-cli
|
|
207
|
+
npx unity-mcp-cli open ./MyGame
|
|
183
208
|
```
|
|
184
209
|
|
|
185
|
-
| Option | Required | Description |
|
|
186
|
-
|
|
187
|
-
| `[path]` | Yes | Path to the Unity project (positional or `--path`) |
|
|
188
|
-
| `--
|
|
189
|
-
| `--
|
|
190
|
-
| `--
|
|
191
|
-
| `--
|
|
192
|
-
| `--
|
|
193
|
-
| `--
|
|
194
|
-
| `--
|
|
195
|
-
| `--
|
|
196
|
-
| `--
|
|
197
|
-
| `--enable-resources <names>` | No | Enable specific resources (comma-separated) |
|
|
198
|
-
| `--disable-resources <names>` | No | Disable specific resources (comma-separated) |
|
|
199
|
-
| `--enable-all-resources` | No | Enable all resources |
|
|
200
|
-
| `--disable-all-resources` | No | Disable all resources |
|
|
210
|
+
| Option | Env Variable | Required | Description |
|
|
211
|
+
|---|---|---|---|
|
|
212
|
+
| `[path]` | — | Yes | Path to the Unity project (positional or `--path`) |
|
|
213
|
+
| `--unity <version>` | — | No | Specific Unity Editor version to use (defaults to version from project settings, falls back to highest installed) |
|
|
214
|
+
| `--no-connect` | — | No | Open without MCP connection environment variables |
|
|
215
|
+
| `--url <url>` | `UNITY_MCP_HOST` | No | MCP server URL to connect to |
|
|
216
|
+
| `--keep-connected` | `UNITY_MCP_KEEP_CONNECTED` | No | Force keep the connection alive |
|
|
217
|
+
| `--token <token>` | `UNITY_MCP_TOKEN` | No | Authentication token |
|
|
218
|
+
| `--auth <option>` | `UNITY_MCP_AUTH_OPTION` | No | Auth mode: `none` or `required` |
|
|
219
|
+
| `--tools <names>` | `UNITY_MCP_TOOLS` | No | Comma-separated list of tools to enable |
|
|
220
|
+
| `--transport <method>` | `UNITY_MCP_TRANSPORT` | No | Transport method: `streamableHttp` or `stdio` |
|
|
221
|
+
| `--start-server <value>` | `UNITY_MCP_START_SERVER` | No | Set to `true` or `false` to control MCP server auto-start |
|
|
201
222
|
|
|
202
|
-
|
|
223
|
+
The editor process is spawned in detached mode — the CLI returns immediately.
|
|
224
|
+
|
|
225
|
+
**Example — open with MCP connection:**
|
|
203
226
|
|
|
204
227
|
```bash
|
|
205
|
-
npx unity-mcp-cli
|
|
206
|
-
--
|
|
207
|
-
--
|
|
228
|
+
npx unity-mcp-cli open ./MyGame \
|
|
229
|
+
--url http://localhost:8080 \
|
|
230
|
+
--keep-connected
|
|
208
231
|
```
|
|
209
232
|
|
|
210
|
-
**Example —
|
|
233
|
+
**Example — open without MCP connection (simple open):**
|
|
211
234
|
|
|
212
235
|
```bash
|
|
213
|
-
npx unity-mcp-cli
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
236
|
+
npx unity-mcp-cli open ./MyGame --no-connect
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Example — open with authentication and specific tools:**
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
npx unity-mcp-cli open ./MyGame \
|
|
243
|
+
--url http://my-server:8080 \
|
|
244
|
+
--token my-secret-token \
|
|
245
|
+
--auth required \
|
|
246
|
+
--tools gameobject-create,gameobject-find
|
|
217
247
|
```
|
|
218
248
|
|
|
219
249
|

|
|
220
250
|
|
|
221
|
-
## `
|
|
251
|
+
## `run-tool`
|
|
222
252
|
|
|
223
|
-
|
|
253
|
+
Execute an MCP tool directly via the HTTP API. The server URL and authorization token are **automatically resolved** from the project's config file (`UserSettings/AI-Game-Developer-Config.json`), based on the current connection mode (Custom or Cloud).
|
|
224
254
|
|
|
225
255
|
```bash
|
|
226
|
-
npx unity-mcp-cli
|
|
227
|
-
--path ./MyGame \
|
|
228
|
-
--url http://localhost:8080
|
|
256
|
+
npx unity-mcp-cli run-tool gameobject-create ./MyGame --input '{"name":"Cube"}'
|
|
229
257
|
```
|
|
230
258
|
|
|
231
|
-
| Option |
|
|
232
|
-
|
|
233
|
-
|
|
|
234
|
-
|
|
|
235
|
-
| `--
|
|
236
|
-
| `--token <token>` |
|
|
237
|
-
| `--
|
|
238
|
-
| `--
|
|
239
|
-
| `--
|
|
240
|
-
|
|
241
|
-
|
|
259
|
+
| Option | Required | Description |
|
|
260
|
+
|---|---|---|
|
|
261
|
+
| `<tool-name>` | Yes | Name of the MCP tool to execute |
|
|
262
|
+
| `[path]` | No | Unity project path (positional or `--path`) — used to read config and detect port |
|
|
263
|
+
| `--url <url>` | No | Direct server URL override (bypasses config) |
|
|
264
|
+
| `--token <token>` | No | Bearer token override (bypasses config) |
|
|
265
|
+
| `--input <json>` | No | JSON string of tool arguments (defaults to `{}`) |
|
|
266
|
+
| `--input-file <file>` | No | Read JSON arguments from a file |
|
|
267
|
+
| `--raw` | No | Output raw JSON (no formatting, no spinner) |
|
|
268
|
+
|
|
269
|
+
**URL resolution priority:**
|
|
270
|
+
1. `--url` → use directly
|
|
271
|
+
2. Config file → `host` (Custom mode) or `cloudServerUrl` (Cloud mode)
|
|
272
|
+
3. Deterministic port from project path
|
|
242
273
|
|
|
243
|
-
|
|
274
|
+
**Authorization** is read automatically from the project config (`token` in Custom mode, `cloudToken` in Cloud mode). Use `--token` to override the config-derived token explicitly.
|
|
244
275
|
|
|
245
|
-
**Example —
|
|
276
|
+
**Example — call a tool (URL and auth from config):**
|
|
246
277
|
|
|
247
278
|
```bash
|
|
248
|
-
npx unity-mcp-cli
|
|
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
|
|
279
|
+
npx unity-mcp-cli run-tool gameobject-find ./MyGame --input '{"query":"Player"}'
|
|
255
280
|
```
|
|
256
281
|
|
|
257
|
-
**Example —
|
|
282
|
+
**Example — explicit URL override:**
|
|
258
283
|
|
|
259
284
|
```bash
|
|
260
|
-
npx unity-mcp-cli
|
|
261
|
-
--path ./MyGame \
|
|
262
|
-
--url http://localhost:8080 \
|
|
263
|
-
--transport stdio \
|
|
264
|
-
--start-server false
|
|
285
|
+
npx unity-mcp-cli run-tool scene-save --url http://localhost:8080
|
|
265
286
|
```
|
|
266
287
|
|
|
267
|
-
**Example —
|
|
288
|
+
**Example — pipe raw JSON output:**
|
|
268
289
|
|
|
269
290
|
```bash
|
|
270
|
-
npx unity-mcp-cli
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
291
|
+
npx unity-mcp-cli run-tool assets-list ./MyGame --raw | jq '.results'
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+

|
|
295
|
+
|
|
296
|
+
## `remove-plugin`
|
|
297
|
+
|
|
298
|
+
Remove the Unity-MCP plugin from a Unity project's `Packages/manifest.json`.
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
npx unity-mcp-cli remove-plugin ./MyGame
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
| Option | Required | Description |
|
|
305
|
+
|---|---|---|
|
|
306
|
+
| `[path]` | Yes | Path to the Unity project (positional or `--path`) |
|
|
307
|
+
|
|
308
|
+
This command:
|
|
309
|
+
1. Removes `com.ivanmurzak.unity.mcp` from `dependencies`
|
|
310
|
+
2. **Preserves scoped registries and scopes** — other packages may depend on them
|
|
311
|
+
3. **No-op** if the plugin is not installed
|
|
312
|
+
|
|
313
|
+
> After running this command, open the project in Unity Editor to apply the change.
|
|
314
|
+
|
|
315
|
+

|
|
316
|
+
|
|
317
|
+
## Global Options
|
|
318
|
+
|
|
319
|
+
These options are available on all commands:
|
|
320
|
+
|
|
321
|
+
| Option | Description |
|
|
322
|
+
|---|---|
|
|
323
|
+
| `-v, --verbose` | Enable verbose diagnostic output for troubleshooting |
|
|
324
|
+
| `--version` | Display CLI version |
|
|
325
|
+
| `--help` | Display help for the command |
|
|
326
|
+
|
|
327
|
+
**Example — run any command with verbose output:**
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
npx unity-mcp-cli install-plugin ./MyGame --verbose
|
|
276
331
|
```
|
|
277
332
|
|
|
278
333
|

|
|
@@ -292,8 +347,7 @@ npx unity-mcp-cli install-plugin ./MyAIGame
|
|
|
292
347
|
npx unity-mcp-cli configure ./MyAIGame --enable-all-tools
|
|
293
348
|
|
|
294
349
|
# 4. Open the project with MCP connection
|
|
295
|
-
npx unity-mcp-cli
|
|
296
|
-
--path ./MyAIGame \
|
|
350
|
+
npx unity-mcp-cli open ./MyAIGame \
|
|
297
351
|
--url http://localhost:8080 \
|
|
298
352
|
--keep-connected
|
|
299
353
|
```
|
|
@@ -3,6 +3,7 @@ import * as path from 'path';
|
|
|
3
3
|
import * as fs from 'fs';
|
|
4
4
|
import { getOrCreateConfig, writeConfig, updateFeatures } from '../utils/config.js';
|
|
5
5
|
import * as ui from '../utils/ui.js';
|
|
6
|
+
import { verbose } from '../utils/ui.js';
|
|
6
7
|
function parseCommaSeparated(value) {
|
|
7
8
|
return value.split(',').map((s) => s.trim()).filter(Boolean);
|
|
8
9
|
}
|
|
@@ -34,6 +35,7 @@ export const configureCommand = new Command('configure')
|
|
|
34
35
|
ui.error(`Project path does not exist: ${projectPath}`);
|
|
35
36
|
process.exit(1);
|
|
36
37
|
}
|
|
38
|
+
verbose(`Loading config for project: ${projectPath}`);
|
|
37
39
|
const config = getOrCreateConfig(projectPath);
|
|
38
40
|
if (options.list) {
|
|
39
41
|
ui.heading('Current configuration');
|
|
@@ -84,6 +86,7 @@ export const configureCommand = new Command('configure')
|
|
|
84
86
|
disableAll: options.disableAllResources,
|
|
85
87
|
});
|
|
86
88
|
}
|
|
89
|
+
verbose('Writing updated configuration');
|
|
87
90
|
writeConfig(projectPath, config);
|
|
88
91
|
ui.success('Configuration updated successfully.');
|
|
89
92
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/commands/configure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/commands/configure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,G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AA+B,CAAC,CAAC;IACzC,WAAW,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACjC,EAAE,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { Command } from 'commander';
|
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { ensureUnityHub, createProject, listInstalledEditors, findHighestEditor } from '../utils/unity-hub.js';
|
|
4
4
|
import * as ui from '../utils/ui.js';
|
|
5
|
+
import { verbose } from '../utils/ui.js';
|
|
5
6
|
export const createProjectCommand = new Command('create-project')
|
|
6
7
|
.description('Create a new Unity project')
|
|
7
8
|
.argument('[path]', 'Path where the project will be created')
|
|
@@ -19,15 +20,15 @@ export const createProjectCommand = new Command('create-project')
|
|
|
19
20
|
hubPath = await ensureUnityHub();
|
|
20
21
|
}
|
|
21
22
|
catch (err) {
|
|
22
|
-
spinner.
|
|
23
|
+
spinner.error('Failed to locate Unity Hub');
|
|
23
24
|
throw err;
|
|
24
25
|
}
|
|
25
|
-
spinner.
|
|
26
|
+
spinner.success('Unity Hub located');
|
|
26
27
|
let editorVersion = options.unity;
|
|
27
28
|
if (!editorVersion) {
|
|
28
29
|
const editors = listInstalledEditors(hubPath);
|
|
29
30
|
if (editors.length === 0) {
|
|
30
|
-
ui.error('No Unity editors installed. Install one with: unity-mcp-cli install-unity
|
|
31
|
+
ui.error('No Unity editors installed. Install one with: unity-mcp-cli install-unity [version]');
|
|
31
32
|
process.exit(1);
|
|
32
33
|
}
|
|
33
34
|
const highest = findHighestEditor(editors);
|
|
@@ -35,6 +36,8 @@ export const createProjectCommand = new Command('create-project')
|
|
|
35
36
|
ui.info(`No Unity version specified, using highest installed: ${editorVersion}`);
|
|
36
37
|
}
|
|
37
38
|
const projectPath = path.resolve(resolvedPath);
|
|
39
|
+
verbose(`Creating project at: ${projectPath} with editor version: ${editorVersion}`);
|
|
40
|
+
verbose(`Unity Hub path: ${hubPath}`);
|
|
38
41
|
createProject(hubPath, projectPath, editorVersion);
|
|
39
42
|
});
|
|
40
43
|
//# sourceMappingURL=create-project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-project.js","sourceRoot":"","sources":["../../src/commands/create-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/G,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-project.js","sourceRoot":"","sources":["../../src/commands/create-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/G,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,OAAO,CAAC,gBAAgB,CAAC;KAC9D,WAAW,CAAC,4BAA4B,CAAC;KACzC,QAAQ,CAAC,QAAQ,EAAE,wCAAwC,CAAC;KAC5D,MAAM,CAAC,eAAe,EAAE,wCAAwC,CAAC;KACjE,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC;KAC1D,MAAM,CAAC,KAAK,EAAE,cAAkC,EAAE,OAA0C,EAAE,EAAE;IAC/F,MAAM,YAAY,GAAG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IACpD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,EAAE,CAAC,KAAK,CAAC,+EAA+E,CAAC,CAAC;QAC1F,OA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'../utils/manifest.js';
|
|
5
5
|
import * as ui from '../utils/ui.js';
|
|
6
|
+
import { verbose } from '../utils/ui.js';
|
|
6
7
|
export const installPluginCommand = new Command('install-plugin')
|
|
7
8
|
.description('Install Unity-MCP plugin into a Unity project')
|
|
8
9
|
.argument('[path]', 'Path to the Unity project')
|
|
@@ -23,13 +24,23 @@ export const installPluginCommand = new Command('install-plugin')
|
|
|
23
24
|
}
|
|
24
25
|
// Resolve version
|
|
25
26
|
let version = options.pluginVersion;
|
|
27
|
+
const isExplicitVersion = !!version;
|
|
26
28
|
if (!version) {
|
|
27
29
|
const spinner = ui.startSpinner('Resolving latest plugin version...');
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
try {
|
|
31
|
+
version = await resolveLatestVersion();
|
|
32
|
+
spinner.success(`Resolved plugin version: ${version}`);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
spinner.error('Failed to resolve plugin version');
|
|
36
|
+
ui.error(err.message);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
30
39
|
}
|
|
40
|
+
verbose(`Plugin version: ${version} (explicit: ${isExplicitVersion})`);
|
|
41
|
+
verbose(`Manifest path: ${manifestPath}`);
|
|
31
42
|
ui.info(`Installing Unity-MCP plugin v${version} into: ${projectPath}`);
|
|
32
|
-
addPluginToManifest(projectPath, version);
|
|
43
|
+
addPluginToManifest(projectPath, version, isExplicitVersion);
|
|
33
44
|
ui.success('Done! Open the project in Unity Editor to complete installation.');
|
|
34
45
|
});
|
|
35
46
|
//# sourceMappingURL=install-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-plugin.js","sourceRoot":"","sources":["../../src/commands/install-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,mB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,EAAE,CAAC,KAAK,CAAC,+DAA+D,WAAW,EAAE,CAAC,CAAC;QACvF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,kBAAkB;IAClB,IAAI,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IACpC,MAAM,iBAAiB,GAAG,CAAC,CAAC,OAAO,CAAC;IACpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,oCAAoC,CAAC,CAAC;QACtE,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,oBAAoB,EAAE,CAAC;YACvC,OAAO,CAAC,OAAO,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;YAClD,EAAE,CAAC,KAAK,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,mBAAmB,OAAO,eAAe,iBAAiB,GAAG,CAAC,CAAC;IACvE,OAAO,CAAC,kBAAkB,YAAY,EAAE,CAAC,CAAC;IAC1C,EAAE,CAAC,IAAI,CAAC,gCAAgC,OAAO,UAAU,WAAW,EAAE,CAAC,CAAC;IACxE,mBAAmB,CAAC,WAAW,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;IAC7D,EAAE,CAAC,OAAO,CAAC,kEAAkE,CAAC,CAAC;AACjF,CAAC,CAAC,CAAC"}
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
|
-
import { ensureUnityHub, installEditor, listInstalledEditors } from '../utils/unity-hub.js';
|
|
4
|
+
import { ensureUnityHub, installEditor, listInstalledEditors, listAvailableReleases, findLatestStableRelease } from '../utils/unity-hub.js';
|
|
5
5
|
import { getProjectEditorVersion } from '../utils/unity-editor.js';
|
|
6
6
|
import * as ui from '../utils/ui.js';
|
|
7
|
+
import { verbose } from '../utils/ui.js';
|
|
7
8
|
export const installUnityCommand = new Command('install-unity')
|
|
8
9
|
.description('Install Unity Editor via Unity Hub')
|
|
9
|
-
.
|
|
10
|
+
.argument('[version]', 'Unity Editor version to install (e.g. 6000.3.1f1). Omit to install latest stable release.')
|
|
10
11
|
.option('--path <path>', 'Read version from an existing Unity project')
|
|
11
|
-
.action(async (options) => {
|
|
12
|
+
.action(async (positionalVersion, options) => {
|
|
13
|
+
verbose(`install-unity invoked with version=${positionalVersion ?? '(auto)'}, path=${options.path ?? '(none)'}`);
|
|
12
14
|
const spinner = ui.startSpinner('Locating Unity Hub...');
|
|
13
15
|
let hubPath;
|
|
14
16
|
try {
|
|
15
17
|
hubPath = await ensureUnityHub();
|
|
16
18
|
}
|
|
17
19
|
catch (err) {
|
|
18
|
-
spinner.
|
|
20
|
+
spinner.error('Failed to locate Unity Hub');
|
|
19
21
|
throw err;
|
|
20
22
|
}
|
|
21
|
-
spinner.
|
|
22
|
-
|
|
23
|
+
spinner.success('Unity Hub located');
|
|
24
|
+
verbose(`Unity Hub path: ${hubPath}`);
|
|
25
|
+
let version = positionalVersion;
|
|
23
26
|
if (!version && options.path) {
|
|
24
27
|
const projectPath = path.resolve(options.path);
|
|
25
28
|
if (!fs.existsSync(projectPath)) {
|
|
@@ -35,16 +38,25 @@ export const installUnityCommand = new Command('install-unity')
|
|
|
35
38
|
process.exit(1);
|
|
36
39
|
}
|
|
37
40
|
}
|
|
41
|
+
// Fetch available releases once — reused for latest-stable lookup and install
|
|
42
|
+
let releases;
|
|
43
|
+
// No version specified — resolve latest stable release from Unity Hub
|
|
38
44
|
if (!version) {
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
ui.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
releases = listAvailableReleases(hubPath);
|
|
46
|
+
const latest = findLatestStableRelease(releases);
|
|
47
|
+
if (!latest) {
|
|
48
|
+
ui.error('No stable releases found');
|
|
49
|
+
const editors = listInstalledEditors(hubPath);
|
|
50
|
+
if (editors.length > 0) {
|
|
51
|
+
ui.heading('Currently installed editors:');
|
|
52
|
+
for (const editor of editors) {
|
|
53
|
+
ui.label(editor.version, editor.path);
|
|
54
|
+
}
|
|
45
55
|
}
|
|
56
|
+
process.exit(1);
|
|
46
57
|
}
|
|
47
|
-
|
|
58
|
+
ui.success(`Latest stable release: ${latest.version}`);
|
|
59
|
+
version = latest.version;
|
|
48
60
|
}
|
|
49
61
|
// Check if already installed
|
|
50
62
|
const editors = listInstalledEditors(hubPath);
|
|
@@ -53,7 +65,8 @@ export const installUnityCommand = new Command('install-unity')
|
|
|
53
65
|
ui.success(`Unity Editor ${version} is already installed at: ${alreadyInstalled.path}`);
|
|
54
66
|
return;
|
|
55
67
|
}
|
|
56
|
-
|
|
68
|
+
verbose(`Installing Unity Editor version: ${version}`);
|
|
69
|
+
await installEditor(hubPath, version, releases);
|
|
57
70
|
ui.success(`Unity Editor ${version} installed successfully`);
|
|
58
71
|
});
|
|
59
72
|
//# sourceMappingURL=install-unity.js.map
|