ultralytics-mcp 0.1.4 → 0.1.5
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 +225 -17
- package/dist/server.js +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,32 +1,240 @@
|
|
|
1
1
|
# Ultralytics Platform MCP
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/ultralytics-mcp)
|
|
4
|
+
[](https://github.com/amanharshx/ultralytics-mcp/actions/workflows/ci.yml)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
|
|
7
|
+
MCP server for [Ultralytics Platform](https://platform.ultralytics.com)
|
|
8
|
+
workflows: projects, datasets, models, training, prediction, exports, and
|
|
9
|
+
dataset uploads.
|
|
4
10
|
|
|
5
11
|
> [!IMPORTANT]
|
|
6
12
|
> Independent community project. Not affiliated with or endorsed by Ultralytics.
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Table of Contents
|
|
17
|
+
|
|
18
|
+
- [Requirements](#requirements)
|
|
19
|
+
- [Get API Key](#get-api-key)
|
|
20
|
+
- [Environment Variables](#environment-variables)
|
|
21
|
+
- [Installation](#installation)
|
|
22
|
+
- [Claude Code](#claude-code)
|
|
23
|
+
- [Codex](#codex)
|
|
24
|
+
- [Verify Setup](#verify-setup)
|
|
25
|
+
- [What You Can Do](#what-you-can-do)
|
|
26
|
+
- [Tools](#tools-27)
|
|
27
|
+
- [Safety](#safety)
|
|
28
|
+
- [Troubleshooting](#troubleshooting)
|
|
29
|
+
- [Development](#development)
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Requirements
|
|
34
|
+
|
|
35
|
+
- Node.js `>=20`
|
|
36
|
+
- Ultralytics Platform API key
|
|
37
|
+
- `ffmpeg` and `ffprobe` on `PATH` to upload a dataset from a local video file
|
|
38
|
+
- Claude Code, Codex, or another MCP client that can launch stdio servers
|
|
39
|
+
|
|
40
|
+
## Get API Key
|
|
41
|
+
|
|
42
|
+
1. Sign in at [Ultralytics Platform](https://platform.ultralytics.com).
|
|
43
|
+
2. Open `Settings -> API Keys`.
|
|
44
|
+
3. Create or copy an API key.
|
|
45
|
+
|
|
46
|
+
## Environment Variables
|
|
47
|
+
|
|
48
|
+
| Variable | Required | Description |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `ULTRALYTICS_API_KEY` | ✅ | Ultralytics API key. Expected format: `ul_` followed by 40 hex characters |
|
|
51
|
+
| `ULTRALYTICS_API_BASE` | ❌ | Advanced: override API base URL. Default: `https://platform.ultralytics.com/api` |
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
### Standard Config
|
|
56
|
+
|
|
57
|
+
Works in many MCP clients that accept JSON stdio server definitions.
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"mcpServers": {
|
|
62
|
+
"ultralytics": {
|
|
63
|
+
"command": "npx",
|
|
64
|
+
"args": ["-y", "ultralytics-mcp"],
|
|
65
|
+
"env": {
|
|
66
|
+
"ULTRALYTICS_API_KEY": "ul_your_api_key_here"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Claude Code
|
|
74
|
+
|
|
75
|
+
Add server with Claude Code CLI:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
claude mcp add ultralytics --env ULTRALYTICS_API_KEY=ul_your_api_key_here -- npx -y ultralytics-mcp
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Or add a project-scoped server in repo-root `.mcp.json`:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"mcpServers": {
|
|
86
|
+
"ultralytics": {
|
|
87
|
+
"command": "npx",
|
|
88
|
+
"args": ["-y", "ultralytics-mcp"],
|
|
89
|
+
"env": {
|
|
90
|
+
"ULTRALYTICS_API_KEY": "ul_your_api_key_here"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Codex
|
|
98
|
+
|
|
99
|
+
Add server with Codex CLI:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
codex mcp add ultralytics --env ULTRALYTICS_API_KEY=ul_your_api_key_here -- npx -y ultralytics-mcp
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Or add it directly to `~/.codex/config.toml`:
|
|
106
|
+
|
|
107
|
+
```toml
|
|
108
|
+
[mcp_servers.ultralytics]
|
|
109
|
+
command = "npx"
|
|
110
|
+
args = ["-y", "ultralytics-mcp"]
|
|
111
|
+
|
|
112
|
+
[mcp_servers.ultralytics.env]
|
|
113
|
+
ULTRALYTICS_API_KEY = "ul_your_api_key_here"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Verify Setup
|
|
117
|
+
|
|
118
|
+
### Claude Code
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
claude mcp list
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
You should see `ultralytics` in configured MCP servers.
|
|
125
|
+
|
|
126
|
+
### Codex
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
codex mcp list
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
You should see `ultralytics` in configured MCP servers.
|
|
133
|
+
|
|
134
|
+
## What You Can Do
|
|
135
|
+
|
|
136
|
+
- Browse projects, datasets, models, exports, GPU availability
|
|
137
|
+
- Resolve project and dataset refs by id, slug, `username/slug`, or `ul://`
|
|
138
|
+
- Search public projects and datasets on Ultralytics Explore
|
|
139
|
+
- Start dataset ingest jobs and upload archive files, folders, or videos
|
|
140
|
+
- Monitor training progress and inspect latest metrics or recent metric history
|
|
141
|
+
- Run model prediction from image URL or base64 input
|
|
142
|
+
- Download model weights to local path
|
|
143
|
+
- Create exports and training jobs with explicit cost confirmation
|
|
11
144
|
|
|
12
145
|
## Tools (27)
|
|
13
146
|
|
|
147
|
+
### Projects (5 tools)
|
|
148
|
+
|
|
14
149
|
| Tool | Description |
|
|
15
150
|
| --- | --- |
|
|
16
|
-
| `projects_list`
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
|
25
|
-
|
|
|
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 |
|
|
26
171
|
| `dataset_version_create` | Create a frozen dataset version snapshot |
|
|
27
|
-
| `
|
|
28
|
-
|
|
29
|
-
|
|
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 |
|
|
203
|
+
|
|
204
|
+
## Safety
|
|
205
|
+
|
|
206
|
+
- `export_create` requires `confirm_cost: true`
|
|
207
|
+
- `training_start` requires `confirm_cost: true`
|
|
208
|
+
- Ambiguous project or dataset refs fail instead of guessing
|
|
209
|
+
- Signed upload and download URLs do not forward `Authorization`
|
|
210
|
+
|
|
211
|
+
## Troubleshooting
|
|
212
|
+
|
|
213
|
+
### Invalid API key
|
|
214
|
+
|
|
215
|
+
`ULTRALYTICS_API_KEY` must start with `ul_` and contain exactly 40 hex
|
|
216
|
+
characters after prefix.
|
|
217
|
+
|
|
218
|
+
### Server not loading in Claude Code
|
|
219
|
+
|
|
220
|
+
- run `claude mcp list`
|
|
221
|
+
- verify `npx` and Node.js are installed
|
|
222
|
+
- verify `ULTRALYTICS_API_KEY` was passed with `--env` when adding server
|
|
223
|
+
- if needed, inspect server config with `claude mcp get ultralytics`
|
|
224
|
+
|
|
225
|
+
### Server not loading in Codex
|
|
226
|
+
|
|
227
|
+
- run `codex mcp list`
|
|
228
|
+
- verify `npx` and Node.js are installed
|
|
229
|
+
- verify `ULTRALYTICS_API_KEY` value in `~/.codex/config.toml` or `codex mcp add` command
|
|
230
|
+
|
|
231
|
+
### Manual server smoke test
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
ULTRALYTICS_API_KEY=ul_your_api_key_here npx -y ultralytics-mcp
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
If command exits immediately with config error, fix environment first.
|
|
30
238
|
|
|
31
239
|
## Development
|
|
32
240
|
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
1
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
3
|
import { UltralyticsClient } from "./client.js";
|
|
3
4
|
import { registerTools } from "./tools/index.js";
|
|
5
|
+
function readPackageVersion() {
|
|
6
|
+
const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
7
|
+
return packageJson.version;
|
|
8
|
+
}
|
|
9
|
+
export const SERVER_VERSION = readPackageVersion();
|
|
4
10
|
/** Create the MCP server with all tools registered.
|
|
5
11
|
*
|
|
6
12
|
* The client is created lazily on first tool invocation (so it reads the API key
|
|
@@ -8,7 +14,10 @@ import { registerTools } from "./tools/index.js";
|
|
|
8
14
|
* `clientFactory` can be injected for tests.
|
|
9
15
|
*/
|
|
10
16
|
export function createServer(clientFactory = () => new UltralyticsClient()) {
|
|
11
|
-
const server = new McpServer({
|
|
17
|
+
const server = new McpServer({
|
|
18
|
+
name: "ultralytics",
|
|
19
|
+
version: SERVER_VERSION,
|
|
20
|
+
});
|
|
12
21
|
let client;
|
|
13
22
|
const getClient = () => {
|
|
14
23
|
if (!client) {
|