@avclabs.ai/media-mcp 0.2.1 → 0.4.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 +250 -35
- package/README_CN.md +250 -35
- package/config.json +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +25 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +5 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +32 -80
- package/dist/server.js.map +1 -1
- package/package.json +22 -25
- package/dist/sam3.d.ts +0 -3
- package/dist/sam3.d.ts.map +0 -1
- package/dist/sam3.js +0 -167
- package/dist/sam3.js.map +0 -1
- package/dist/video-enhancement.d.ts +0 -3
- package/dist/video-enhancement.d.ts.map +0 -1
- package/dist/video-enhancement.js +0 -236
- package/dist/video-enhancement.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
# media-mcp (Node.js)
|
|
1
|
+
# media-mcp (Node.js, legacy all-in-one)
|
|
2
2
|
|
|
3
|
-
English | [中文](https://github.com/avclabs/media-mcp/blob/main/README_CN.md)
|
|
3
|
+
English | [中文](https://github.com/avclabs/media-mcp/blob/main/packages/media-mcp/README_CN.md)
|
|
4
|
+
|
|
5
|
+
> **Maintenance note:** this package bundles all 9 tools in one server. New integrations should prefer the per-function packages — [@avclabs.ai/video-mcp](../video-mcp), [@avclabs.ai/image-mcp](../image-mcp), and [@avclabs.ai/sam3-mcp](../sam3-mcp) — so each MCP client session only loads the tool definitions it needs. This all-in-one server stays available and configuration-compatible; see the [repo README](https://github.com/avclabs/media-mcp#readme) for the migration matrix.
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/@avclabs.ai/media-mcp)
|
|
6
8
|
[](https://nodejs.org/)
|
|
7
9
|
[](https://opensource.org/licenses/MIT)
|
|
8
10
|
|
|
9
|
-
A video enhancement and image segmentation service based on the MCP protocol, acting as an MCP Client-Server to interact with
|
|
11
|
+
A video enhancement, image enhancement/colorization/denoising, and image segmentation service based on the MCP protocol, acting as an MCP Client-Server to interact with the hosted AVCLabs media services.
|
|
12
|
+
|
|
13
|
+
> **Release status:** the published npm package (`latest` = `0.3.0`) includes 9 tools — 3 video, 4 image, and 2 SAM3 — all production-ready.
|
|
10
14
|
|
|
11
15
|
## Features
|
|
12
16
|
|
|
@@ -15,10 +19,17 @@ Provides the following MCP Tools:
|
|
|
15
19
|
**Video Enhancement**
|
|
16
20
|
- `create_task` - Create a video enhancement task (supports URL or local file upload)
|
|
17
21
|
- `get_task_status` - Query task status
|
|
18
|
-
- `enhance_video_sync` - Synchronously enhance video (blocking wait, truncated at ~
|
|
22
|
+
- `enhance_video_sync` - Synchronously enhance video (blocking wait, truncated at ~45s by default)
|
|
23
|
+
|
|
24
|
+
**Image Enhancement**
|
|
25
|
+
- `enhance_image_sync` - Enhance image quality and optimize faces (supports URL or local file upload)
|
|
26
|
+
- `colorize_image_sync` - Colorize black-and-white photos (supports URL or local file upload)
|
|
27
|
+
- `denoise_image_sync` - Remove noise from images (supports URL or local file upload)
|
|
28
|
+
- `get_image_task_status` - Query image task status (for polling after sync timeout)
|
|
19
29
|
|
|
20
30
|
**Image Segmentation (SAM3)**
|
|
21
31
|
- `sam3_predict` - SAM3 image segmentation (supports local path, URL, or Base64 image)
|
|
32
|
+
- `get_sam3_task_status` - Query SAM3 task status (for polling after sync timeout)
|
|
22
33
|
|
|
23
34
|
## Prerequisites
|
|
24
35
|
|
|
@@ -109,24 +120,27 @@ Or edit `~/.cursor/mcp.json`:
|
|
|
109
120
|
After restarting your client, check if the tools are available:
|
|
110
121
|
|
|
111
122
|
1. Or ask: "What tools do you have available?"
|
|
112
|
-
2.
|
|
123
|
+
2. With the current npm `latest=0.3.0`, you should see all 9 tools: `create_task`, `get_task_status`, `enhance_video_sync`, `enhance_image_sync`, `colorize_image_sync`, `denoise_image_sync`, `get_image_task_status`, `sam3_predict`, and `get_sam3_task_status`.
|
|
113
124
|
|
|
114
125
|
## Configuration Options
|
|
115
126
|
|
|
116
127
|
| Variable | Required | Default | Description |
|
|
117
128
|
|---|---|---|---|
|
|
118
|
-
| `API_KEY` | **Yes** | - | API authentication key (shared by video
|
|
119
|
-
| `HTTP_API_BASE_URL` | No | `https://mcp.avc.ai/enhance` |
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
129
|
+
| `API_KEY` | **Yes** | - | API authentication key (shared by video, image, and SAM3 services) |
|
|
130
|
+
| `HTTP_API_BASE_URL` | No | `https://mcp.avc.ai/enhance` | Shared video and image enhancement host address |
|
|
131
|
+
| `IMAGE_API_BASE_URL` | No | Same as `HTTP_API_BASE_URL` | Optional image host override; omit for the shared production host |
|
|
132
|
+
| `SAM3_API_BASE_URL` | No | `https://mcp.avc.ai/sam` | SAM3 host address |
|
|
133
|
+
| `SAM3_POLL_INTERVAL_MS` | No | `2000` | SAM3 polling interval in milliseconds (`SAM3_POLL_INTERVAL` is a deprecated alias) |
|
|
134
|
+
| `SAM3_POLL_MAX_ATTEMPTS` | No | `25` | SAM3 maximum status queries; the time budget is interval × attempts, and whichever limit is hit first truncates the wait |
|
|
123
135
|
|
|
124
|
-
|
|
136
|
+
`IMAGE_API_BASE_URL` is an optional override for pointing image calls at a custom image host. When omitted, image and video calls share the `HTTP_API_BASE_URL` service — the recommended setup for the production server.
|
|
137
|
+
|
|
138
|
+
### Custom Host
|
|
125
139
|
|
|
126
140
|
```json
|
|
127
141
|
{
|
|
128
142
|
"env": {
|
|
129
|
-
"HTTP_API_BASE_URL": "https://your-endpoint.com",
|
|
143
|
+
"HTTP_API_BASE_URL": "https://your-media-endpoint.com",
|
|
130
144
|
"API_KEY": "your-api-key",
|
|
131
145
|
"SAM3_API_BASE_URL": "https://your-sam3-endpoint.com"
|
|
132
146
|
}
|
|
@@ -135,9 +149,11 @@ After restarting your client, check if the tools are available:
|
|
|
135
149
|
|
|
136
150
|
Or via CLI args:
|
|
137
151
|
```bash
|
|
138
|
-
npx -y @avclabs.ai/media-mcp@latest --base-url https://your-endpoint.com --api-key your-api-key --sam3-base-url https://your-sam3-endpoint.com
|
|
152
|
+
npx -y @avclabs.ai/media-mcp@latest --base-url https://your-media-endpoint.com --api-key your-api-key --sam3-base-url https://your-sam3-endpoint.com
|
|
139
153
|
```
|
|
140
154
|
|
|
155
|
+
The optional `--image-base-url` flag is available for deployments that intentionally split the public image host; the current npm `latest` release does not use it (image calls share the main host).
|
|
156
|
+
|
|
141
157
|
## Recommended Workflow
|
|
142
158
|
|
|
143
159
|
This project provides both **synchronous** and **asynchronous** modes.
|
|
@@ -157,15 +173,15 @@ This project provides both **synchronous** and **asynchronous** modes.
|
|
|
157
173
|
|
|
158
174
|
**Video Enhancement:**
|
|
159
175
|
- Call `enhance_video_sync` → the server polls internally
|
|
160
|
-
- Defaults to a maximum wait of
|
|
161
|
-
- If completed within
|
|
162
|
-
- If not completed within
|
|
176
|
+
- Defaults to a maximum wait of 45 seconds
|
|
177
|
+
- If completed within 45 seconds, returns the result directly
|
|
178
|
+
- If not completed within 45 seconds, returns `task_id` and instructions for the Agent to switch to `get_task_status`
|
|
163
179
|
|
|
164
180
|
**Image Segmentation (SAM3):**
|
|
165
181
|
- Call `sam3_predict` → the server polls internally
|
|
166
|
-
- Defaults to
|
|
167
|
-
- If
|
|
168
|
-
- If not completed within
|
|
182
|
+
- Defaults to at most 25 status queries within a ~50-second budget (25 × 2-second interval; whichever limit is reached first ends the wait)
|
|
183
|
+
- If the task completes within the budget, returns the segmentation result directly
|
|
184
|
+
- If not completed within the budget, returns a truncation notice (with `task_id`) indicating the task is still processing
|
|
169
185
|
|
|
170
186
|
## Usage Examples
|
|
171
187
|
|
|
@@ -175,6 +191,12 @@ Once configured, ask your AI agent naturally:
|
|
|
175
191
|
|
|
176
192
|
> "Improve the quality of /Users/me/Desktop/video.mp4 to 2k"
|
|
177
193
|
|
|
194
|
+
> "Enhance this image: https://example.com/photo.jpg"
|
|
195
|
+
|
|
196
|
+
> "Colorize this black-and-white photo: /Users/me/Desktop/old_photo.png"
|
|
197
|
+
|
|
198
|
+
> "Remove noise from this image: C:\\Users\\xxx\\noisy.jpg"
|
|
199
|
+
|
|
178
200
|
> "Analyze this image and find all objects: C:\\Users\\xxx\\photo.png"
|
|
179
201
|
|
|
180
202
|
> "Use SAM3 to segment this image, prompt: 'find all cars'"
|
|
@@ -234,27 +256,141 @@ The `message` field only appears when `status` is `processing`, prompting the Ag
|
|
|
234
256
|
|
|
235
257
|
Synchronously enhance video (blocks until completion).
|
|
236
258
|
|
|
237
|
-
> **Best for short videos (estimated processing time < 1 minute).** If the task is not completed within
|
|
259
|
+
> **Best for short videos (estimated processing time < 1 minute).** If the task is not completed within the default 45-second wait budget, the tool returns early with a `task_id`, and you need to use `get_task_status` to continue querying.
|
|
238
260
|
|
|
239
261
|
| Parameter | Type | Required | Default | Description |
|
|
240
262
|
|---|---|---|---|---|
|
|
241
263
|
| `video_source` | string | Yes | - | Video URL or local file path |
|
|
242
264
|
| `type` | string | No | `url` | `url` or `local` |
|
|
243
265
|
| `resolution` | string | No | `720p` | Target resolution |
|
|
244
|
-
| `poll_interval` | number | No | `5` | Poll interval (seconds) |
|
|
245
|
-
| `timeout` | number | No | `
|
|
266
|
+
| `poll_interval` | number | No | `5` | Poll interval (seconds, 0.5-30) |
|
|
267
|
+
| `timeout` | number | No | `45` | Sync wait timeout in seconds (1-45), returns early when exceeded |
|
|
246
268
|
|
|
247
|
-
**Truncated return example (not completed within
|
|
269
|
+
**Truncated return example (not completed within the default 45-second budget):**
|
|
248
270
|
```json
|
|
249
271
|
{
|
|
250
272
|
"success": true,
|
|
251
273
|
"status": "processing",
|
|
252
274
|
"task_id": "xxx",
|
|
253
|
-
"message": "Task is still processing (waited
|
|
275
|
+
"message": "Task is still processing (waited 45 seconds, 9 status queries). Please use get_task_status to continue polling.",
|
|
254
276
|
"note": "The synchronous wait for this long-running task has been truncated. Switch to get_task_status polling."
|
|
255
277
|
}
|
|
256
278
|
```
|
|
257
279
|
|
|
280
|
+
### Image Enhancement
|
|
281
|
+
|
|
282
|
+
Three image processing tools are provided, each targeting a specific use case:
|
|
283
|
+
|
|
284
|
+
| Tool | Function | Use Case |
|
|
285
|
+
|---|---|---|
|
|
286
|
+
| `enhance_image_sync` | Image quality enhancement & face optimization | Blurry, low-resolution, or degraded photos |
|
|
287
|
+
| `colorize_image_sync` | Black-and-white photo colorization | Restoring old B&W photos with realistic colors |
|
|
288
|
+
| `denoise_image_sync` | Image noise removal | Noisy/grainy photos taken in low light |
|
|
289
|
+
|
|
290
|
+
All three tools share the same parameters and behavior pattern. They are **synchronous** — the tool blocks until the image is processed or the timeout is reached.
|
|
291
|
+
|
|
292
|
+
**Supported image formats**: PNG, JPG, JPEG, BMP, WebP, etc.
|
|
293
|
+
|
|
294
|
+
**Two upload methods**:
|
|
295
|
+
1. **URL upload**: provide a publicly accessible image URL (`type: "url"`)
|
|
296
|
+
2. **Local upload**: provide a local file path, the MCP Server auto-uploads to TOS object storage (`type: "local"`, max file size: 100MB)
|
|
297
|
+
|
|
298
|
+
#### enhance_image_sync
|
|
299
|
+
|
|
300
|
+
Synchronously enhance an image to improve quality and optimize faces.
|
|
301
|
+
|
|
302
|
+
> The tool internally creates a task and polls for the result. If processing completes within the timeout (default 45s), the result is returned directly. If not, the tool returns early with a `task_id` — use `get_image_task_status` to continue polling.
|
|
303
|
+
|
|
304
|
+
| Parameter | Type | Required | Default | Description |
|
|
305
|
+
|---|---|---|---|---|
|
|
306
|
+
| `image_source` | string | Yes | - | Image URL or local file path (URL must be publicly accessible, links requiring login or signatures are not supported) |
|
|
307
|
+
| `type` | string | No | `url` | `url` or `local` |
|
|
308
|
+
| `scale` | number | No | `2` | Enhancement scale multiplier (e.g. `2` for 2x, `4` for 4x upscaling) |
|
|
309
|
+
| `poll_interval` | number | No | `5` | Poll interval in seconds (0.5-30) |
|
|
310
|
+
| `timeout` | number | No | `45` | Sync wait timeout in seconds (1-45), returns early when exceeded |
|
|
311
|
+
|
|
312
|
+
**Normal completion return:**
|
|
313
|
+
```json
|
|
314
|
+
{
|
|
315
|
+
"success": true,
|
|
316
|
+
"task_id": "xxx",
|
|
317
|
+
"status": "completed",
|
|
318
|
+
"progress": 100,
|
|
319
|
+
"image_url": "https://..."
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**Truncated return (not completed within the default 45-second budget):**
|
|
324
|
+
```json
|
|
325
|
+
{
|
|
326
|
+
"success": true,
|
|
327
|
+
"status": "processing",
|
|
328
|
+
"task_id": "xxx",
|
|
329
|
+
"message": "Task is still processing (waited 45 seconds, 9 status queries). Please use get_image_task_status to continue polling.",
|
|
330
|
+
"note": "The synchronous wait for this long-running task has been truncated. Switch to get_image_task_status polling."
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### colorize_image_sync
|
|
335
|
+
|
|
336
|
+
Synchronously colorize a black-and-white photo with AI.
|
|
337
|
+
|
|
338
|
+
> Best for old black-and-white photos. The AI will add realistic colors to the image. Supports the same parameters and return format as `enhance_image_sync`.
|
|
339
|
+
|
|
340
|
+
| Parameter | Type | Required | Default | Description |
|
|
341
|
+
|---|---|---|---|---|
|
|
342
|
+
| `image_source` | string | Yes | - | Image URL or local file path (URL must be publicly accessible, links requiring login or signatures are not supported) |
|
|
343
|
+
| `type` | string | No | `url` | `url` or `local` |
|
|
344
|
+
| `poll_interval` | number | No | `5` | Poll interval in seconds (0.5-30) |
|
|
345
|
+
| `timeout` | number | No | `45` | Sync wait timeout in seconds (1-45), returns early when exceeded |
|
|
346
|
+
|
|
347
|
+
**Returns:** Same format as `enhance_image_sync`.
|
|
348
|
+
|
|
349
|
+
#### denoise_image_sync
|
|
350
|
+
|
|
351
|
+
Synchronously remove noise from an image.
|
|
352
|
+
|
|
353
|
+
> Best for grainy/noisy photos taken in low-light conditions or with high ISO settings. Supports the same parameters and return format as `enhance_image_sync`.
|
|
354
|
+
|
|
355
|
+
| Parameter | Type | Required | Default | Description |
|
|
356
|
+
|---|---|---|---|---|
|
|
357
|
+
| `image_source` | string | Yes | - | Image URL or local file path (URL must be publicly accessible, links requiring login or signatures are not supported) |
|
|
358
|
+
| `type` | string | No | `url` | `url` or `local` |
|
|
359
|
+
| `poll_interval` | number | No | `5` | Poll interval in seconds (0.5-30) |
|
|
360
|
+
| `timeout` | number | No | `45` | Sync wait timeout in seconds (1-45), returns early when exceeded |
|
|
361
|
+
|
|
362
|
+
**Returns:** Same format as `enhance_image_sync`.
|
|
363
|
+
|
|
364
|
+
#### get_image_task_status
|
|
365
|
+
|
|
366
|
+
Query image processing task status. Used to poll for results when a sync tool times out.
|
|
367
|
+
|
|
368
|
+
> The returned `status` field can be: `processing`, `completed`, or `failed`. If `status` is `processing`, wait a few seconds and call this tool again.
|
|
369
|
+
|
|
370
|
+
| Parameter | Type | Required |
|
|
371
|
+
|---|---|---|
|
|
372
|
+
| `task_id` | string | Yes |
|
|
373
|
+
|
|
374
|
+
**Returns:**
|
|
375
|
+
```json
|
|
376
|
+
{
|
|
377
|
+
"success": true,
|
|
378
|
+
"task_id": "xxx",
|
|
379
|
+
"status": "completed",
|
|
380
|
+
"progress": 100,
|
|
381
|
+
"image_url": "https://...",
|
|
382
|
+
"message": "Task is still processing, please check again later"
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
The `message` field only appears when `status` is `processing`, prompting the Agent to continue waiting.
|
|
387
|
+
|
|
388
|
+
#### Recommended Workflow for Image Tools
|
|
389
|
+
|
|
390
|
+
1. **For most images**: Call `enhance_image_sync` / `colorize_image_sync` / `denoise_image_sync` directly — the tool handles everything and returns the result
|
|
391
|
+
2. **If truncated**: The tool returns a `task_id`, then use `get_image_task_status` to poll until `status` becomes `completed` or `failed`
|
|
392
|
+
3. **If failed**: Check the `error_message` field for details
|
|
393
|
+
|
|
258
394
|
### Image Segmentation (SAM3)
|
|
259
395
|
|
|
260
396
|
#### sam3_predict
|
|
@@ -315,13 +451,85 @@ Example result JSON:
|
|
|
315
451
|
"success": true,
|
|
316
452
|
"status": "processing",
|
|
317
453
|
"task_id": "xxx",
|
|
318
|
-
"message": "Task is still processing (waited
|
|
319
|
-
"note": "The synchronous wait for this long-running task has been truncated."
|
|
454
|
+
"message": "Task is still processing (waited 50 seconds, 25 status queries). Please use get_sam3_task_status to continue polling.",
|
|
455
|
+
"note": "The synchronous wait for this long-running task has been truncated. Switch to task status polling."
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**Result download failure (completed task, missing result):**
|
|
460
|
+
If the task completed but the result file could not be downloaded, the tool returns `success: false` with the `task_id` and `status: "completed"`. Use `get_sam3_task_status` with that `task_id` to recover the result. Do not resubmit the task.
|
|
461
|
+
```json
|
|
462
|
+
{
|
|
463
|
+
"success": false,
|
|
464
|
+
"task_id": "xxx",
|
|
465
|
+
"status": "completed",
|
|
466
|
+
"error": "Failed to download the completed result for task xxx: ...",
|
|
467
|
+
"note": "The task has completed; only the result download failed. Do not resubmit. Use get_sam3_task_status with this task_id to recover the result."
|
|
468
|
+
}
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
#### get_sam3_task_status
|
|
472
|
+
|
|
473
|
+
Query SAM3 segmentation task status. Used to poll for results when `sam3_predict` times out.
|
|
474
|
+
|
|
475
|
+
> The returned `status` field can be: `processing`, `completed`, or `failed`. If `status` is `processing`, wait a few seconds and call this tool again.
|
|
476
|
+
|
|
477
|
+
| Parameter | Type | Required |
|
|
478
|
+
|---|---|---|
|
|
479
|
+
| `task_id` | string | Yes |
|
|
480
|
+
|
|
481
|
+
**Completed return:**
|
|
482
|
+
```json
|
|
483
|
+
{
|
|
484
|
+
"success": true,
|
|
485
|
+
"task_id": "xxx",
|
|
486
|
+
"status": "completed",
|
|
487
|
+
"result_url": "https://..."
|
|
488
|
+
}
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
**Processing return:**
|
|
492
|
+
```json
|
|
493
|
+
{
|
|
494
|
+
"success": true,
|
|
495
|
+
"task_id": "xxx",
|
|
496
|
+
"status": "processing",
|
|
497
|
+
"message": "Task is still processing, please check again later."
|
|
498
|
+
}
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
**Failed return:**
|
|
502
|
+
```json
|
|
503
|
+
{
|
|
504
|
+
"success": false,
|
|
505
|
+
"task_id": "xxx",
|
|
506
|
+
"status": "failed",
|
|
507
|
+
"error": "Task failed"
|
|
320
508
|
}
|
|
321
509
|
```
|
|
322
510
|
|
|
323
511
|
## FAQ
|
|
324
512
|
|
|
513
|
+
### Is AVCLabs Media MCP free to use?
|
|
514
|
+
|
|
515
|
+
You get a free quota when you register — no credit card required. Beyond the free quota, pricing is pay-as-you-go credit packs (from $19.95) and monthly subscriptions (from $9.95/month). See https://mcp.avc.ai/pricing/ for the current plans.
|
|
516
|
+
|
|
517
|
+
### Which AI clients work with it?
|
|
518
|
+
|
|
519
|
+
Any MCP-compatible client. One-command setup guides are available for Claude Code, Cursor, and Windsurf at https://mcp.avc.ai/docs/ (the package speaks standard MCP stdio, so other agents work by adding the same `npx` config).
|
|
520
|
+
|
|
521
|
+
### Does it need a GPU or powerful hardware?
|
|
522
|
+
|
|
523
|
+
No. Video enhancement and SAM3 inference run on AVCLabs' cloud infrastructure. Your machine only runs the lightweight MCP stdio server process (Node.js 18+), so a plain laptop is enough.
|
|
524
|
+
|
|
525
|
+
### Where do I get an API key?
|
|
526
|
+
|
|
527
|
+
Register at https://mcp.avc.ai/ and create a key in the dashboard. The key authenticates video enhancement, image tools, and SAM3 segmentation.
|
|
528
|
+
|
|
529
|
+
### What does `sam3_predict` return?
|
|
530
|
+
|
|
531
|
+
Pixel-level segmentation masks, bounding boxes, and per-instance confidence scores for the objects described by your text prompt — ready to plug into compositing, annotation, or further analysis.
|
|
532
|
+
|
|
325
533
|
### Agent reports timeout when calling tools?
|
|
326
534
|
|
|
327
535
|
This is the primary issue this project addresses. MCP Agents (such as Claude, Cursor) typically enforce a ~60-second timeout per tool call. If task processing exceeds this limit, the Agent will error and disconnect.
|
|
@@ -330,15 +538,11 @@ This is the primary issue this project addresses. MCP Agents (such as Claude, Cu
|
|
|
330
538
|
|
|
331
539
|
1. **Prefer asynchronous tools**: For video enhancement and other time-consuming tasks, always use `create_task` + `get_task_status`. These tools return instantly on each call and will not trigger timeouts.
|
|
332
540
|
|
|
333
|
-
2. **Sync tool truncation mechanism**: `enhance_video_sync` has an internal
|
|
541
|
+
2. **Sync tool truncation mechanism**: `enhance_video_sync` has an internal 45-second truncation limit (default `timeout`). If the task is not completed within the budget, the tool proactively returns a `task_id` and instructs the Agent to use `get_task_status` to follow up.
|
|
334
542
|
|
|
335
|
-
3. **SAM3 truncation mechanism**: `sam3_predict`
|
|
543
|
+
3. **SAM3 truncation mechanism**: `sam3_predict` is bounded by two independent limits derived from its config: at most `SAM3_POLL_MAX_ATTEMPTS` status queries (default 25) and a time budget of `SAM3_POLL_INTERVAL_MS × attempts` (default 25 × 2 s ≈ 50 s). Whichever runs out first truncates the wait; the returned notice carries the `task_id` and the actual elapsed time and query count, and the task keeps running remotely.
|
|
336
544
|
|
|
337
|
-
4. **Adjust SAM3 polling parameters** (advanced):
|
|
338
|
-
```bash
|
|
339
|
-
SAM3_POLL_MAX_ATTEMPTS=60
|
|
340
|
-
```
|
|
341
|
-
But ensure the total wait time does not exceed your Agent's timeout limit.
|
|
545
|
+
4. **Adjust SAM3 polling parameters** (advanced): The two SAM3 limits are independent, so you can trade interval for attempt count freely (e.g. `SAM3_POLL_INTERVAL_MS=1000` with `SAM3_POLL_MAX_ATTEMPTS=50` still gives a ~50-second budget with twice as many queries). Lower the interval if the task usually finishes in a few seconds and you want quicker completion detection. Invalid explicit values (non-integer or outside the allowed range) abort startup before any task can be submitted. The wait budget covers only status polling after the task is created — source preparation, upload, task submission, and the final result download are not part of it, so the total tool call can take longer than the budget.
|
|
342
546
|
|
|
343
547
|
### Drag-and-drop attachment says file not found?
|
|
344
548
|
|
|
@@ -389,7 +593,7 @@ When `type` is `"local"`:
|
|
|
389
593
|
|
|
390
594
|
Install Node.js >= 18: https://nodejs.org/
|
|
391
595
|
|
|
392
|
-
### "
|
|
596
|
+
### "API key is required: pass --api-key or set the API_KEY environment variable"
|
|
393
597
|
|
|
394
598
|
Your API Key is missing. Double-check the `env.API_KEY` in your config.
|
|
395
599
|
|
|
@@ -402,7 +606,7 @@ Check logs:
|
|
|
402
606
|
|
|
403
607
|
### "TOS upload failed"
|
|
404
608
|
|
|
405
|
-
Usually a signature mismatch. Ensure your `HTTP_API_BASE_URL` and `API_KEY` are correct and active.
|
|
609
|
+
Usually a signature mismatch. Ensure your `IMAGE_API_BASE_URL` (or its `HTTP_API_BASE_URL` fallback) and `API_KEY` are correct and active.
|
|
406
610
|
|
|
407
611
|
## Global Install (Alternative)
|
|
408
612
|
|
|
@@ -414,6 +618,17 @@ npm install -g @avclabs.ai/media-mcp
|
|
|
414
618
|
|
|
415
619
|
Then use `"command": "media-mcp"` with `"args": ["--api-key", "your-api-key"]` in your config.
|
|
416
620
|
|
|
621
|
+
## Development and Release
|
|
622
|
+
|
|
623
|
+
This package runs locally in the MCP client and is released through npm; it is not a remote Node daemon. To verify a working tree before publishing:
|
|
624
|
+
|
|
625
|
+
```bash
|
|
626
|
+
npm ci
|
|
627
|
+
npm run release:verify
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
Maintainers: see the [release guide](https://github.com/avclabs/media-mcp/blob/main/docs/RELEASE.md) for the current release status, version synchronization, publish order, smoke tests, and the relationship with the portal and host-service deployment.
|
|
631
|
+
|
|
417
632
|
## License
|
|
418
633
|
|
|
419
634
|
MIT License - See [LICENSE](LICENSE) file for details
|