ultralytics-mcp 0.1.5 → 0.1.6

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 CHANGED
@@ -23,7 +23,7 @@ dataset uploads.
23
23
  - [Codex](#codex)
24
24
  - [Verify Setup](#verify-setup)
25
25
  - [What You Can Do](#what-you-can-do)
26
- - [Tools](#tools-27)
26
+ - [Tools](#tools)
27
27
  - [Safety](#safety)
28
28
  - [Troubleshooting](#troubleshooting)
29
29
  - [Development](#development)
@@ -141,65 +141,19 @@ You should see `ultralytics` in configured MCP servers.
141
141
  - Run model prediction from image URL or base64 input
142
142
  - Download model weights to local path
143
143
  - Create exports and training jobs with explicit cost confirmation
144
+ - Pass advanced YOLO training settings through `training_start.train_args`
145
+ - Start training from existing project models or official YOLO base checkpoints
144
146
 
145
- ## Tools (27)
146
-
147
- ### Projects (5 tools)
148
-
149
- | Tool | Description |
150
- | --- | --- |
151
- | `projects_list` | List projects in your Ultralytics workspace |
152
- | `projects_get` | Get one project by id, slug, `username/slug`, or `ul://` |
153
- | `projects_create` | Create a new project |
154
- | `projects_delete` | Soft-delete a project |
155
- | `explore_projects` | Search public projects on Ultralytics Explore |
156
-
157
- ### Datasets (12 tools)
158
-
159
- | Tool | Description |
160
- | --- | --- |
161
- | `datasets_list` | List datasets in your Ultralytics workspace |
162
- | `datasets_get` | Get one dataset by id, slug, `username/slug`, or `ul://` |
163
- | `datasets_create` | Create a new dataset |
164
- | `datasets_delete` | Soft-delete a dataset |
165
- | `dataset_images_list` | List images in a dataset with optional filters |
166
- | `dataset_ingest` | Start a remote ingest job from a source URL |
167
- | `dataset_upload_file` | Upload a local archive file for dataset ingest |
168
- | `dataset_upload_folder` | Upload a local image folder for dataset ingest |
169
- | `dataset_upload_video` | Upload a local video by extracting frames for dataset ingest |
170
- | `dataset_export` | Get an export link for latest or frozen dataset version |
171
- | `dataset_version_create` | Create a frozen dataset version snapshot |
172
- | `explore_datasets` | Search public datasets on Ultralytics Explore |
173
-
174
- ### Models (4 tools)
175
-
176
- | Tool | Description |
177
- | --- | --- |
178
- | `models_list` | List trained models and summary metrics |
179
- | `models_get` | Get one model and its details |
180
- | `model_predict` | Run inference from an image URL or base64 input |
181
- | `model_download` | Download a model weight file to a local path |
182
-
183
- ### Training (2 tools)
184
-
185
- | Tool | Description |
186
- | --- | --- |
187
- | `training_monitor` | Inspect status, progress, latest metrics, and optional history |
188
- | `training_start` | Start a cloud training job with explicit cost confirmation |
189
-
190
- ### Exports (3 tools)
191
-
192
- | Tool | Description |
193
- | --- | --- |
194
- | `exports_list` | List export jobs |
195
- | `export_status` | Check export job status |
196
- | `export_create` | Create an export job with explicit cost confirmation |
197
-
198
- ### Infrastructure (1 tool)
199
-
200
- | Tool | Description |
201
- | --- | --- |
202
- | `gpu_availability` | Check cloud GPU availability |
147
+ ## Tools
148
+
149
+ See [TOOLS.md](./TOOLS.md) for full parameter reference, safety notes, local-path behavior, and examples for tricky tools.
150
+
151
+ - Projects: 5 tools
152
+ - Datasets: 12 tools
153
+ - Models: 4 tools
154
+ - Training: 2 tools
155
+ - Exports: 3 tools
156
+ - Infrastructure: 1 tool
203
157
 
204
158
  ## Safety
205
159
 
@@ -243,4 +197,5 @@ npm install
243
197
  npm run check
244
198
  npm test
245
199
  npm run build
200
+ npm run generate:tools
246
201
  ```
package/TOOLS.md ADDED
@@ -0,0 +1,486 @@
1
+ # Tools Reference
2
+
3
+ Auto-generated reference for Ultralytics Platform MCP tools.
4
+
5
+ > Auto-generated. Do not edit by hand. Run `npm run generate:tools`. Edit tool definitions in `src/tools/index.ts`.
6
+
7
+ ## Conventions
8
+
9
+ - Many project, dataset, and model lookup tools accept ids, slugs, `username/slug`, or `ul://` refs.
10
+ - Local-path tools operate on files or folders available to the MCP client host.
11
+ - Exact accepted ref variants are documented in tool descriptions and notes when behavior differs.
12
+
13
+ ## Local Path Tools
14
+
15
+ - `dataset_upload_file` uploads a local archive file.
16
+ - `dataset_upload_folder` uploads a local image folder.
17
+ - `dataset_upload_video` extracts frames from a local video file with `ffmpeg`.
18
+ - `model_download` writes model weights to a local destination path.
19
+
20
+ ## Cost and Safety
21
+
22
+ - `training_start` requires `confirm_cost=true` and may create a model when checkpoint mode is used.
23
+ - `export_create` requires `confirm_cost=true` and starts a credit-costing export job.
24
+ - `projects_delete` and `datasets_delete` are soft-delete operations.
25
+
26
+ ## Projects
27
+
28
+ 5 tools.
29
+
30
+ ### projects_list
31
+
32
+ List computer-vision projects in your Ultralytics workspace.
33
+
34
+ Metadata: read-only
35
+
36
+ | Parameter | Type | Required | Description |
37
+ | --- | --- | --- | --- |
38
+ | `username` | string | No | |
39
+
40
+ ### projects_get
41
+
42
+ Get details for one project by id, slug, username/slug, or project ul:// URI.
43
+
44
+ Metadata: read-only
45
+
46
+ | Parameter | Type | Required | Description |
47
+ | --- | --- | --- | --- |
48
+ | `project` | string | Yes | Project ref by id, slug, username/slug, or ul:// URI. |
49
+
50
+ ### explore_projects
51
+
52
+ Search public projects on Ultralytics Explore.
53
+
54
+ Metadata: read-only, external/live
55
+
56
+ | Parameter | Type | Required | Description |
57
+ | --- | --- | --- | --- |
58
+ | `q` | string | Yes | |
59
+ | `sort` | string | No | |
60
+ | `offset` | number | No | |
61
+
62
+ ### projects_create
63
+
64
+ Create a project in your Ultralytics workspace.
65
+
66
+ Metadata: state-changing, non-idempotent
67
+
68
+ | Parameter | Type | Required | Description |
69
+ | --- | --- | --- | --- |
70
+ | `name` | string | Yes | |
71
+ | `slug` | string | No | |
72
+ | `description` | string | No | |
73
+
74
+ ### projects_delete
75
+
76
+ Soft-delete a project by id, slug, username/slug, or project ul:// URI.
77
+
78
+ Metadata: state-changing, destructive, non-idempotent
79
+
80
+ | Parameter | Type | Required | Description |
81
+ | --- | --- | --- | --- |
82
+ | `project` | string | Yes | Project ref by id, slug, username/slug, or ul:// URI. |
83
+
84
+ ## Datasets
85
+
86
+ 12 tools.
87
+
88
+ ### datasets_list
89
+
90
+ List datasets in your Ultralytics workspace.
91
+
92
+ Metadata: read-only
93
+
94
+ | Parameter | Type | Required | Description |
95
+ | --- | --- | --- | --- |
96
+ | `username` | string | No | |
97
+
98
+ ### datasets_get
99
+
100
+ Get details for one dataset by id, slug, username/slug, or dataset ul:// URI.
101
+
102
+ Metadata: read-only
103
+
104
+ | Parameter | Type | Required | Description |
105
+ | --- | --- | --- | --- |
106
+ | `dataset` | string | Yes | Dataset ref by id, slug, username/slug, or ul:// URI. |
107
+
108
+ ### explore_datasets
109
+
110
+ Search public datasets on Ultralytics Explore.
111
+
112
+ Metadata: read-only, external/live
113
+
114
+ | Parameter | Type | Required | Description |
115
+ | --- | --- | --- | --- |
116
+ | `q` | string | Yes | |
117
+ | `sort` | string | No | |
118
+ | `offset` | number | No | |
119
+ | `task` | array<string> | No | |
120
+
121
+ ### datasets_create
122
+
123
+ Create a dataset in your Ultralytics workspace.
124
+
125
+ Metadata: state-changing, non-idempotent
126
+
127
+ | Parameter | Type | Required | Description |
128
+ | --- | --- | --- | --- |
129
+ | `name` | string | Yes | |
130
+ | `task` | string | Yes | Dataset task such as detect, segment, semantic, pose, obb, or classify. |
131
+ | `slug` | string | Yes | |
132
+ | `description` | string | No | |
133
+ | `visibility` | string | No | |
134
+ | `classNames` | array<string> | No | |
135
+
136
+ ### dataset_images_list
137
+
138
+ List images in a dataset with optional filtering.
139
+
140
+ Metadata: read-only
141
+
142
+ | Parameter | Type | Required | Description |
143
+ | --- | --- | --- | --- |
144
+ | `dataset` | string | Yes | Dataset ref by id, slug, username/slug, or ul:// URI. |
145
+ | `split` | string | No | |
146
+ | `search` | string | No | |
147
+ | `hasLabel` | boolean | No | |
148
+ | `classIds` | array<string> | No | |
149
+ | `limit` | number | No | |
150
+ | `offset` | number | No | |
151
+ | `includeImageUrls` | boolean | No | |
152
+
153
+ ### dataset_export
154
+
155
+ Get export link for latest or one frozen dataset version.
156
+
157
+ Metadata: read-only
158
+
159
+ | Parameter | Type | Required | Description |
160
+ | --- | --- | --- | --- |
161
+ | `dataset` | string | Yes | Dataset ref by id, slug, username/slug, or ul:// URI. |
162
+ | `version` | number | No | |
163
+
164
+ ### dataset_version_create
165
+
166
+ Create a frozen dataset version snapshot.
167
+
168
+ Metadata: state-changing, non-idempotent
169
+
170
+ | Parameter | Type | Required | Description |
171
+ | --- | --- | --- | --- |
172
+ | `dataset` | string | Yes | Dataset ref by id, slug, username/slug, or ul:// URI. |
173
+ | `description` | string | No | |
174
+
175
+ ### datasets_delete
176
+
177
+ Soft-delete a dataset by id, slug, username/slug, or dataset ul:// URI.
178
+
179
+ Metadata: state-changing, destructive, non-idempotent
180
+
181
+ | Parameter | Type | Required | Description |
182
+ | --- | --- | --- | --- |
183
+ | `dataset` | string | Yes | Dataset ref by id, slug, username/slug, or ul:// URI. |
184
+
185
+ ### dataset_ingest
186
+
187
+ Start a remote URL ingest job for an existing dataset.
188
+
189
+ Metadata: state-changing, non-idempotent, external/live
190
+
191
+ | Parameter | Type | Required | Description |
192
+ | --- | --- | --- | --- |
193
+ | `dataset` | string | Yes | Dataset ref by id, slug, username/slug, or ul:// URI. |
194
+ | `sourceUrl` | string | Yes | |
195
+ | `targetSplit` | string | No | |
196
+
197
+ ### dataset_upload_file
198
+
199
+ Upload a local dataset archive file and start ingest for an existing dataset.
200
+
201
+ Metadata: state-changing, non-idempotent
202
+
203
+ | Parameter | Type | Required | Description |
204
+ | --- | --- | --- | --- |
205
+ | `dataset` | string | Yes | Dataset ref by id, slug, username/slug, or ul:// URI. |
206
+ | `file_path` | string | Yes | Local path to dataset archive file. |
207
+ | `targetSplit` | string | No | |
208
+
209
+ Notes: Uses a local archive file path and starts ingest into an existing dataset.
210
+
211
+ #### Upload dataset archive
212
+
213
+ ```json
214
+ {
215
+ "dataset": "team/datasets/warehouse-items",
216
+ "file_path": "/data/warehouse-items.zip",
217
+ "targetSplit": "train"
218
+ }
219
+ ```
220
+
221
+ ### dataset_upload_folder
222
+
223
+ Upload a local image folder as a zip and start ingest for an existing dataset.
224
+
225
+ Metadata: state-changing, non-idempotent
226
+
227
+ | Parameter | Type | Required | Description |
228
+ | --- | --- | --- | --- |
229
+ | `dataset` | string | Yes | Dataset ref by id, slug, username/slug, or ul:// URI. |
230
+ | `folder_path` | string | Yes | Local path to image folder. |
231
+ | `targetSplit` | string | No | |
232
+
233
+ Notes: Uses a local image folder path, zips it client-side, and starts ingest into an existing dataset.
234
+
235
+ #### Upload image folder
236
+
237
+ ```json
238
+ {
239
+ "dataset": "team/datasets/warehouse-items",
240
+ "folder_path": "/data/warehouse-items",
241
+ "targetSplit": "train"
242
+ }
243
+ ```
244
+
245
+ ### dataset_upload_video
246
+
247
+ Upload a local video by extracting JPEG frames with ffmpeg, then start dataset ingest for an existing dataset.
248
+
249
+ Metadata: state-changing, non-idempotent
250
+
251
+ | Parameter | Type | Required | Description |
252
+ | --- | --- | --- | --- |
253
+ | `dataset` | string | Yes | Dataset ref by id, slug, username/slug, or ul:// URI. |
254
+ | `video_path` | string | Yes | Local path to source video file. |
255
+ | `fps` | number | No | |
256
+ | `max_frames` | number | No | |
257
+ | `targetSplit` | string | No | |
258
+
259
+ Notes: Uses a local video path, extracts JPEG frames with ffmpeg, and starts ingest into an existing dataset.
260
+
261
+ #### Upload video for frame extraction
262
+
263
+ ```json
264
+ {
265
+ "dataset": "team/datasets/factory-lines",
266
+ "video_path": "/videos/factory-shift.mp4",
267
+ "fps": 2,
268
+ "max_frames": 500,
269
+ "targetSplit": "train"
270
+ }
271
+ ```
272
+
273
+ ## Models
274
+
275
+ 4 tools.
276
+
277
+ ### models_list
278
+
279
+ List models in a project by project id, slug, username/slug, or project ul:// URI.
280
+
281
+ Metadata: read-only
282
+
283
+ | Parameter | Type | Required | Description |
284
+ | --- | --- | --- | --- |
285
+ | `project` | string | Yes | Project ref by id, slug, username/slug, or ul:// URI. |
286
+
287
+ ### models_get
288
+
289
+ Get one model by id, or by slug plus project.
290
+
291
+ Metadata: read-only
292
+
293
+ | Parameter | Type | Required | Description |
294
+ | --- | --- | --- | --- |
295
+ | `model` | string | Yes | Model id, or slug when project is also provided. |
296
+ | `project` | string | No | Project ref required when model is given by slug. |
297
+
298
+ ### model_predict
299
+
300
+ Run inference with a trained model on an image URL or base64 source (no local file paths).
301
+
302
+ Metadata: read-only, external/live
303
+
304
+ | Parameter | Type | Required | Description |
305
+ | --- | --- | --- | --- |
306
+ | `model` | string | Yes | Model id, or slug when project is also provided. |
307
+ | `source` | string | Yes | Image URL or base64 input string. Local file paths are not supported. |
308
+ | `project` | string | No | |
309
+ | `conf` | number | No | |
310
+ | `iou` | number | No | |
311
+ | `imgsz` | number | No | |
312
+
313
+ #### Predict from image URL
314
+
315
+ ```json
316
+ {
317
+ "model": "team/project/my-model",
318
+ "source": "https://images.example.com/example.jpg",
319
+ "conf": 0.25
320
+ }
321
+ ```
322
+
323
+ #### Predict from base64 input
324
+
325
+ ```json
326
+ {
327
+ "model": "team/project/my-model",
328
+ "source": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD..."
329
+ }
330
+ ```
331
+
332
+ ### model_download
333
+
334
+ Download one trained model weight file to an explicit local path.
335
+
336
+ Metadata: state-changing, non-idempotent
337
+
338
+ | Parameter | Type | Required | Description |
339
+ | --- | --- | --- | --- |
340
+ | `model` | string | Yes | Model id, or slug when project is also provided. |
341
+ | `output_path` | string | Yes | Local destination path for downloaded model weights. |
342
+ | `project` | string | No | |
343
+ | `filename` | string | No | |
344
+ | `overwrite` | boolean | No | |
345
+
346
+ Notes: Writes model weights to a local filesystem path.
347
+
348
+ #### Download model weights
349
+
350
+ ```json
351
+ {
352
+ "model": "team/project/my-model",
353
+ "output_path": "/tmp/model.pt",
354
+ "overwrite": true
355
+ }
356
+ ```
357
+
358
+ ## Training
359
+
360
+ 2 tools.
361
+
362
+ ### training_monitor
363
+
364
+ Report a model's training status and progress (works for private and public projects).
365
+
366
+ Metadata: read-only, external/live
367
+
368
+ | Parameter | Type | Required | Description |
369
+ | --- | --- | --- | --- |
370
+ | `model` | string | Yes | Model id, or slug when project is also provided. |
371
+ | `project` | string | No | |
372
+ | `include_metrics` | boolean | No | |
373
+ | `include_history` | boolean | No | |
374
+ | `history_last_n` | number | No | |
375
+
376
+ ### training_start
377
+
378
+ Start a cloud training job from an existing model or official YOLO base checkpoint (state-changing, may cost credits). Requires confirm_cost=true.
379
+
380
+ Metadata: state-changing, non-idempotent, external/live
381
+
382
+ | Parameter | Type | Required | Description |
383
+ | --- | --- | --- | --- |
384
+ | `model` | string | Yes | Existing model ref, or official YOLO base checkpoint such as yolo11n.pt or yolo11n-seg.pt. Checkpoint mode auto-creates a project model. |
385
+ | `project` | string | Yes | Project ref that owns the training job and resolved model. |
386
+ | `dataset` | string | Yes | Dataset ref used as training data for the job. |
387
+ | `gpu_type` | string | Yes | Cloud GPU type to allocate for training. |
388
+ | `train_args` | record<string, unknown> | No | |
389
+ | `epochs` | number | No | |
390
+ | `imgsz` | number | No | |
391
+ | `batch` | number | No | |
392
+ | `name` | string | No | |
393
+ | `confirm_cost` | boolean | No | Must be true to allow a credit-costing training run. |
394
+
395
+ Notes: Checkpoint-pattern model values such as `yolo11n.pt` and `yolo11n-seg.pt` trigger checkpoint mode, auto-create a project model, and require dataset-task compatibility.
396
+
397
+ #### Train from existing model
398
+
399
+ ```json
400
+ {
401
+ "model": "team/project/my-model",
402
+ "project": "team/project",
403
+ "dataset": "team/datasets/warehouse-items",
404
+ "gpu_type": "rtx-4090",
405
+ "confirm_cost": true
406
+ }
407
+ ```
408
+
409
+ #### Train from official YOLO checkpoint
410
+
411
+ ```json
412
+ {
413
+ "model": "yolo11n-seg.pt",
414
+ "project": "team/project",
415
+ "dataset": "team/datasets/road-segments",
416
+ "gpu_type": "rtx-4090",
417
+ "confirm_cost": true
418
+ }
419
+ ```
420
+
421
+ ## Exports
422
+
423
+ 3 tools.
424
+
425
+ ### exports_list
426
+
427
+ List export jobs for a model.
428
+
429
+ Metadata: read-only
430
+
431
+ | Parameter | Type | Required | Description |
432
+ | --- | --- | --- | --- |
433
+ | `model` | string | Yes | Model id, or slug when project is also provided. |
434
+ | `project` | string | No | |
435
+
436
+ ### export_status
437
+
438
+ Get status for one export job by 24-character export id.
439
+
440
+ Metadata: read-only
441
+
442
+ | Parameter | Type | Required | Description |
443
+ | --- | --- | --- | --- |
444
+ | `export_id` | string | Yes | 24-character export job id. |
445
+
446
+ ### export_create
447
+
448
+ Create a model export job (state-changing, may cost credits). Requires confirm_cost=true.
449
+
450
+ Metadata: state-changing, non-idempotent, external/live
451
+
452
+ | Parameter | Type | Required | Description |
453
+ | --- | --- | --- | --- |
454
+ | `model` | string | Yes | Model id, or slug when project is also provided. |
455
+ | `format` | string | Yes | Requested export format. |
456
+ | `project` | string | No | |
457
+ | `gpu_type` | string | No | |
458
+ | `imgsz` | number | No | |
459
+ | `half` | boolean | No | |
460
+ | `dynamic` | boolean | No | |
461
+ | `confirm_cost` | boolean | No | Must be true to allow a credit-costing export job. |
462
+
463
+ Notes: State-changing export job that may cost credits. Set `confirm_cost` to `true` explicitly.
464
+
465
+ #### Create export job
466
+
467
+ ```json
468
+ {
469
+ "model": "team/project/my-model",
470
+ "format": "onnx",
471
+ "confirm_cost": true
472
+ }
473
+ ```
474
+
475
+ ## Infrastructure
476
+
477
+ 1 tools.
478
+
479
+ ### gpu_availability
480
+
481
+ Get current cloud-GPU stock status by GPU type.
482
+
483
+ Metadata: read-only, external/live
484
+
485
+ | Parameter | Type | Required | Description |
486
+ | --- | --- | --- | --- |
package/dist/resolve.js CHANGED
@@ -43,6 +43,15 @@ function listField(data, field) {
43
43
  }
44
44
  return [];
45
45
  }
46
+ function recordField(data, field) {
47
+ if (data && typeof data === "object") {
48
+ const value = data[field];
49
+ if (value && typeof value === "object") {
50
+ return value;
51
+ }
52
+ }
53
+ return {};
54
+ }
46
55
  function select(matches, kind, ref) {
47
56
  if (matches.length === 0) {
48
57
  throw new ResolutionError(`No ${kind} found matching '${ref}'. Check the slug/username, or pass the ` +
@@ -112,6 +121,22 @@ export async function resolveDataset(client, ref) {
112
121
  (username === null || dataset.username === username));
113
122
  return select(matches, "dataset", ref)._id;
114
123
  }
124
+ /** Resolve a dataset ref and return its id plus task metadata. */
125
+ export async function resolveDatasetDetails(client, ref) {
126
+ const id = await resolveDataset(client, ref);
127
+ const data = await client.get(`/datasets/${id}`);
128
+ const dataset = data &&
129
+ typeof data === "object" &&
130
+ "dataset" in data
131
+ ? recordField(data, "dataset")
132
+ : (data ?? {});
133
+ return {
134
+ id,
135
+ task: typeof dataset.task === "string" ? dataset.task : null,
136
+ name: typeof dataset.name === "string" ? dataset.name : null,
137
+ slug: typeof dataset.slug === "string" ? dataset.slug : null,
138
+ };
139
+ }
115
140
  /** Resolve a model id, slug plus project, or model ul:// URI. */
116
141
  export async function resolveModel(client, ref, projectRef) {
117
142
  if (looksLikeId(ref)) {