@avclabs.ai/media-mcp 0.2.0 → 0.2.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.
- package/README.md +177 -177
- package/README_CN.md +419 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +6 -6
- package/dist/server.js.map +1 -1
- package/dist/video-enhancement.js +37 -37
- package/dist/video-enhancement.js.map +1 -1
- package/package.json +2 -2
- package/README_EN.md +0 -419
package/README.md
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
# media-mcp (Node.js)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
English | [中文](https://github.com/avclabs/media-mcp/blob/main/README_CN.md)
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@avclabs.ai/media-mcp)
|
|
6
6
|
[](https://nodejs.org/)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
A video enhancement and image segmentation service based on the MCP protocol, acting as an MCP Client-Server to interact with backend HTTP Servers.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Features
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Provides the following MCP Tools:
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
- `create_task` -
|
|
17
|
-
- `get_task_status` -
|
|
18
|
-
- `enhance_video_sync` -
|
|
15
|
+
**Video Enhancement**
|
|
16
|
+
- `create_task` - Create a video enhancement task (supports URL or local file upload)
|
|
17
|
+
- `get_task_status` - Query task status
|
|
18
|
+
- `enhance_video_sync` - Synchronously enhance video (blocking wait, truncated at ~50s by default)
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
- `sam3_predict` - SAM3
|
|
20
|
+
**Image Segmentation (SAM3)**
|
|
21
|
+
- `sam3_predict` - SAM3 image segmentation (supports local path, URL, or Base64 image)
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## Prerequisites
|
|
24
24
|
|
|
25
|
-
- **Node.js >= 18**
|
|
26
|
-
- **API Key**
|
|
25
|
+
- **Node.js >= 18** (check: `node --version`)
|
|
26
|
+
- **API Key** (required for authentication)
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Lazy Install (Recommended)
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
If your AI Agent has a known MCP config path, just copy the line below and send it to your AI:
|
|
31
31
|
|
|
32
32
|
```
|
|
33
|
-
|
|
33
|
+
Install the npm package @avclabs.ai/media-mcp as an MCP server. My API Key is: sk-xxxxxxxx.
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
AI
|
|
37
|
-
1.
|
|
38
|
-
2.
|
|
39
|
-
3.
|
|
40
|
-
4.
|
|
36
|
+
The AI will automatically:
|
|
37
|
+
1. Detect your MCP client
|
|
38
|
+
2. Find the config file path
|
|
39
|
+
3. Write the correct configuration
|
|
40
|
+
4. Prompt you to restart the client
|
|
41
41
|
|
|
42
|
-
##
|
|
42
|
+
## Manual Install
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
No installation needed. Use `npx` directly in your MCP client config.
|
|
45
45
|
|
|
46
|
-
### 1. Claude Code
|
|
46
|
+
### 1. Claude Code (CLI)
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
Run in Claude Code:
|
|
49
49
|
|
|
50
50
|
```
|
|
51
51
|
/mcp
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Check the output for the **"User MCPs"** section to find the config file path, then edit that file.
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
Common paths (if `/mcp` is unavailable):
|
|
57
57
|
- **Windows**: `%USERPROFILE%\.claude.json`
|
|
58
58
|
- **macOS**: `~/.claude.json`
|
|
59
59
|
- **Linux**: `~/.claude.json`
|
|
60
|
-
-
|
|
60
|
+
- **Legacy/Alternative**: `~/.claude/mcp.json`
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
Paste this (replace `your-api-key`):
|
|
63
63
|
|
|
64
64
|
```json
|
|
65
65
|
{
|
|
@@ -75,20 +75,20 @@ AI 会自动完成:
|
|
|
75
75
|
}
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Save and run `/mcp` to verify it's loaded.
|
|
79
79
|
|
|
80
80
|
### 2. Cursor
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
Go to **Settings > Tools & MCPs > Add New MCP Server**:
|
|
83
83
|
|
|
84
|
-
- **Name
|
|
85
|
-
- **Type
|
|
86
|
-
- **Command
|
|
84
|
+
- **Name**: `video-enhancement`
|
|
85
|
+
- **Type**: `command`
|
|
86
|
+
- **Command**:
|
|
87
87
|
```bash
|
|
88
88
|
env API_KEY=your-api-key npx -y @avclabs.ai/media-mcp@latest
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
Or edit `~/.cursor/mcp.json`:
|
|
92
92
|
|
|
93
93
|
```json
|
|
94
94
|
{
|
|
@@ -104,24 +104,24 @@ AI 会自动完成:
|
|
|
104
104
|
}
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
##
|
|
107
|
+
## Verify Installation
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
After restarting your client, check if the tools are available:
|
|
110
110
|
|
|
111
|
-
1.
|
|
112
|
-
2.
|
|
111
|
+
1. Or ask: "What tools do you have available?"
|
|
112
|
+
2. You should see: `create_task`, `get_task_status`, `enhance_video_sync`, `sam3_predict`
|
|
113
113
|
|
|
114
|
-
##
|
|
114
|
+
## Configuration Options
|
|
115
115
|
|
|
116
|
-
|
|
|
116
|
+
| Variable | Required | Default | Description |
|
|
117
117
|
|---|---|---|---|
|
|
118
|
-
| `API_KEY` |
|
|
119
|
-
| `HTTP_API_BASE_URL` |
|
|
120
|
-
| `SAM3_API_BASE_URL` |
|
|
121
|
-
| `SAM3_POLL_INTERVAL` |
|
|
122
|
-
| `SAM3_POLL_MAX_ATTEMPTS` |
|
|
118
|
+
| `API_KEY` | **Yes** | - | API authentication key (shared by video enhancement and SAM3) |
|
|
119
|
+
| `HTTP_API_BASE_URL` | No | `https://mcp.avc.ai/enhance` | Video enhancement service endpoint |
|
|
120
|
+
| `SAM3_API_BASE_URL` | No | `https://mcp.avc.ai/sam` | SAM3 service endpoint |
|
|
121
|
+
| `SAM3_POLL_INTERVAL` | No | `2000` | SAM3 polling interval (milliseconds) |
|
|
122
|
+
| `SAM3_POLL_MAX_ATTEMPTS` | No | `25` | SAM3 maximum polling attempts |
|
|
123
123
|
|
|
124
|
-
###
|
|
124
|
+
### Custom Endpoint
|
|
125
125
|
|
|
126
126
|
```json
|
|
127
127
|
{
|
|
@@ -133,71 +133,71 @@ AI 会自动完成:
|
|
|
133
133
|
}
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
Or via CLI args:
|
|
137
137
|
```bash
|
|
138
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
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
##
|
|
141
|
+
## Recommended Workflow
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
This project provides both **synchronous** and **asynchronous** modes.
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
**Because MCP Agents typically enforce a ~60-second timeout per tool call**, tasks with longer processing times (video enhancement) are strongly recommended to use **asynchronous mode**:
|
|
146
146
|
|
|
147
|
-
###
|
|
147
|
+
### Asynchronous Mode (Recommended)
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
1.
|
|
151
|
-
2.
|
|
152
|
-
3.
|
|
153
|
-
4.
|
|
154
|
-
5.
|
|
149
|
+
**Video Enhancement:**
|
|
150
|
+
1. Call `create_task` to create a task → immediately get `task_id`
|
|
151
|
+
2. Wait a few seconds, then call `get_task_status` to query the status
|
|
152
|
+
3. If `status` is `processing`, continue waiting and repeat step 2
|
|
153
|
+
4. If `status` is `completed`, the task is done and the result contains `video_url`
|
|
154
|
+
5. If `status` is `failed`, the task failed and the result contains `error_message`
|
|
155
155
|
|
|
156
|
-
###
|
|
156
|
+
### Synchronous Mode (Simple Scenarios)
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
158
|
+
**Video Enhancement:**
|
|
159
|
+
- Call `enhance_video_sync` → the server polls internally
|
|
160
|
+
- Defaults to a maximum wait of 50 seconds
|
|
161
|
+
- If completed within 50 seconds, returns the result directly
|
|
162
|
+
- If not completed within 50 seconds, returns `task_id` and instructions for the Agent to switch to `get_task_status`
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
164
|
+
**Image Segmentation (SAM3):**
|
|
165
|
+
- Call `sam3_predict` → the server polls internally
|
|
166
|
+
- Defaults to a maximum wait of 50 seconds (25 attempts × 2-second polling interval)
|
|
167
|
+
- If completed within 50 seconds, returns the segmentation result directly
|
|
168
|
+
- If not completed within 50 seconds, returns a truncation notice indicating the task is still processing
|
|
169
169
|
|
|
170
|
-
##
|
|
170
|
+
## Usage Examples
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
Once configured, ask your AI agent naturally:
|
|
173
173
|
|
|
174
|
-
> "
|
|
174
|
+
> "Enhance this video to 1080p: https://example.com/video.mp4"
|
|
175
175
|
|
|
176
|
-
> "
|
|
176
|
+
> "Improve the quality of /Users/me/Desktop/video.mp4 to 2k"
|
|
177
177
|
|
|
178
|
-
> "
|
|
178
|
+
> "Analyze this image and find all objects: C:\\Users\\xxx\\photo.png"
|
|
179
179
|
|
|
180
|
-
> "
|
|
180
|
+
> "Use SAM3 to segment this image, prompt: 'find all cars'"
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
The agent will automatically choose sync or async tools based on task complexity.
|
|
183
183
|
|
|
184
|
-
##
|
|
184
|
+
## Provided Tools
|
|
185
185
|
|
|
186
|
-
###
|
|
186
|
+
### Video Enhancement
|
|
187
187
|
|
|
188
188
|
#### create_task
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
Create an asynchronous video enhancement task.
|
|
191
191
|
|
|
192
|
-
>
|
|
192
|
+
> **Recommended for most use cases.** Ideal for longer videos (over 10 seconds) to avoid timeouts and blocking the connection.
|
|
193
193
|
|
|
194
|
-
|
|
|
194
|
+
| Parameter | Type | Required | Default | Description |
|
|
195
195
|
|---|---|---|---|---|
|
|
196
|
-
| `video_source` | string |
|
|
197
|
-
| `type` | string |
|
|
198
|
-
| `resolution` | string |
|
|
196
|
+
| `video_source` | string | Yes | - | Video URL or local file path (URL must be publicly accessible, links requiring login or signatures are not supported) |
|
|
197
|
+
| `type` | string | No | `url` | `url` or `local` |
|
|
198
|
+
| `resolution` | string | No | `720p` | `480p`, `540p`, `720p`, `1080p`, `2k` |
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
**Returns:**
|
|
201
201
|
```json
|
|
202
202
|
{
|
|
203
203
|
"success": true,
|
|
@@ -208,15 +208,15 @@ AI 会根据任务复杂度自动选择同步或异步工具完成任务。
|
|
|
208
208
|
|
|
209
209
|
#### get_task_status
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
Query video enhancement task status.
|
|
212
212
|
|
|
213
|
-
>
|
|
213
|
+
> The returned `status` field can be: `processing`, `completed`, or `failed`. If `status` is `processing`, you need to wait a few seconds and call this tool again.
|
|
214
214
|
|
|
215
|
-
|
|
|
215
|
+
| Parameter | Type | Required |
|
|
216
216
|
|---|---|---|
|
|
217
|
-
| `task_id` | string |
|
|
217
|
+
| `task_id` | string | Yes |
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
**Returns:**
|
|
220
220
|
```json
|
|
221
221
|
{
|
|
222
222
|
"success": true,
|
|
@@ -224,76 +224,76 @@ AI 会根据任务复杂度自动选择同步或异步工具完成任务。
|
|
|
224
224
|
"status": "completed",
|
|
225
225
|
"progress": 100,
|
|
226
226
|
"video_url": "https://...",
|
|
227
|
-
"message": "
|
|
227
|
+
"message": "Task is still processing, please check again later"
|
|
228
228
|
}
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
-
|
|
231
|
+
The `message` field only appears when `status` is `processing`, prompting the Agent to continue waiting.
|
|
232
232
|
|
|
233
233
|
#### enhance_video_sync
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
Synchronously enhance video (blocks until completion).
|
|
236
236
|
|
|
237
|
-
>
|
|
237
|
+
> **Best for short videos (estimated processing time < 1 minute).** If the task is not completed within 50 seconds, the tool returns early with a `task_id`, and you need to use `get_task_status` to continue querying.
|
|
238
238
|
|
|
239
|
-
|
|
|
239
|
+
| Parameter | Type | Required | Default | Description |
|
|
240
240
|
|---|---|---|---|---|
|
|
241
|
-
| `video_source` | string |
|
|
242
|
-
| `type` | string |
|
|
243
|
-
| `resolution` | string |
|
|
244
|
-
| `poll_interval` | number |
|
|
245
|
-
| `timeout` | number |
|
|
241
|
+
| `video_source` | string | Yes | - | Video URL or local file path |
|
|
242
|
+
| `type` | string | No | `url` | `url` or `local` |
|
|
243
|
+
| `resolution` | string | No | `720p` | Target resolution |
|
|
244
|
+
| `poll_interval` | number | No | `5` | Poll interval (seconds) |
|
|
245
|
+
| `timeout` | number | No | `50` | Sync wait timeout (seconds), returns early when exceeded |
|
|
246
246
|
|
|
247
|
-
|
|
247
|
+
**Truncated return example (not completed within 50s):**
|
|
248
248
|
```json
|
|
249
249
|
{
|
|
250
250
|
"success": true,
|
|
251
251
|
"status": "processing",
|
|
252
252
|
"task_id": "xxx",
|
|
253
|
-
"message": "
|
|
254
|
-
"note": "
|
|
253
|
+
"message": "Task is still processing (waited 50 seconds). Please use get_task_status to continue polling.",
|
|
254
|
+
"note": "The synchronous wait for this long-running task has been truncated. Switch to get_task_status polling."
|
|
255
255
|
}
|
|
256
256
|
```
|
|
257
257
|
|
|
258
|
-
###
|
|
258
|
+
### Image Segmentation (SAM3)
|
|
259
259
|
|
|
260
260
|
#### sam3_predict
|
|
261
261
|
|
|
262
|
-
|
|
262
|
+
Analyze an image using the SAM3 segmentation API to generate inference results (masks, boxes, scores).
|
|
263
263
|
|
|
264
|
-
|
|
264
|
+
**Parameters:**
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
Image input (choose one, must provide exactly one):
|
|
267
267
|
|
|
268
|
-
- `imagePath` (string):
|
|
269
|
-
-
|
|
270
|
-
-
|
|
268
|
+
- `imagePath` (string): Absolute path of a local image file. Supports common formats (PNG, JPG, JPEG).
|
|
269
|
+
- Example: `"C:\\Users\\xxx\\photo.png"`, `"/home/user/images/cat.jpg"`
|
|
270
|
+
- Use when: The user explicitly provides a local file path
|
|
271
271
|
|
|
272
|
-
- `imageUrl` (string):
|
|
273
|
-
-
|
|
274
|
-
-
|
|
275
|
-
-
|
|
272
|
+
- `imageUrl` (string): Publicly accessible URL of the image.
|
|
273
|
+
- Example: `"https://example.com/photo.jpg"`
|
|
274
|
+
- Use when: The image is already online and the user provides a link
|
|
275
|
+
- Note: The URL must be publicly accessible. Links requiring login or signatures are not supported
|
|
276
276
|
|
|
277
|
-
- `imageBase64` (string): Base64
|
|
278
|
-
-
|
|
279
|
-
-
|
|
280
|
-
-
|
|
277
|
+
- `imageBase64` (string): Base64-encoded image data.
|
|
278
|
+
- Example: `"iVBORw0KGgoAAAANSUhEUgAA..."`
|
|
279
|
+
- Use when: The user drags or uploads an image attachment, and the Agent encodes it as base64
|
|
280
|
+
- Note: Large images will produce very large base64 strings, which may slow transmission
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
Other parameters:
|
|
283
283
|
|
|
284
|
-
- `prompt` (string, required):
|
|
284
|
+
- `prompt` (string, required): English text prompt specifying the target object to segment. Since the SAM3 model only accepts English prompts, provide an English description. If the user provides Chinese or other non-English text, the Agent will automatically translate it before calling the tool.
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
**Normal completion return:**
|
|
287
287
|
|
|
288
|
-
|
|
288
|
+
After inference completes, returns a JSON string containing three fields:
|
|
289
289
|
|
|
290
|
-
- **`masks
|
|
291
|
-
- **`boxes
|
|
290
|
+
- **`masks`**: 2D array. Each element is a binary mask (values 0 or 1) with the same dimensions as the input image, marking the pixel-level location of detected objects. The i-th mask corresponds to the i-th detected object instance.
|
|
291
|
+
- **`boxes`**: 2D array. Each element is a bounding box in `[x1, y1, x2, y2]` format, representing the rectangular region of the detected object. `x1`, `y1` are the top-left coordinates; `x2`, `y2` are the bottom-right coordinates.
|
|
292
292
|
|
|
293
|
-
|
|
294
|
-
- **`scores
|
|
293
|
+
Coordinate system: The top-left corner of the image is the origin `(0, 0)`. The x-axis increases to the right, and the y-axis increases downward, in pixels. For example, `[120, 80, 300, 450]` means the region starts 120px from the left edge and 80px from the top edge, extending to 300px from the left and 450px from the top. Width = `x2 - x1 = 180px`, Height = `y2 - y1 = 370px`.
|
|
294
|
+
- **`scores`**: 1D array. Each element is a confidence score for the corresponding detection result, ranging from 0 to 1. Higher scores indicate greater model confidence.
|
|
295
295
|
|
|
296
|
-
|
|
296
|
+
Example result JSON:
|
|
297
297
|
|
|
298
298
|
```json
|
|
299
299
|
{
|
|
@@ -309,7 +309,7 @@ AI 会根据任务复杂度自动选择同步或异步工具完成任务。
|
|
|
309
309
|
}
|
|
310
310
|
```
|
|
311
311
|
|
|
312
|
-
|
|
312
|
+
**Truncated return example (not completed within 50s):**
|
|
313
313
|
```json
|
|
314
314
|
{
|
|
315
315
|
"success": true,
|
|
@@ -320,100 +320,100 @@ AI 会根据任务复杂度自动选择同步或异步工具完成任务。
|
|
|
320
320
|
}
|
|
321
321
|
```
|
|
322
322
|
|
|
323
|
-
##
|
|
323
|
+
## FAQ
|
|
324
324
|
|
|
325
|
-
### Agent
|
|
325
|
+
### Agent reports timeout when calling tools?
|
|
326
326
|
|
|
327
|
-
|
|
327
|
+
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.
|
|
328
328
|
|
|
329
|
-
|
|
329
|
+
**Solutions:**
|
|
330
330
|
|
|
331
|
-
1.
|
|
331
|
+
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
332
|
|
|
333
|
-
2.
|
|
333
|
+
2. **Sync tool truncation mechanism**: `enhance_video_sync` has an internal 50-second truncation limit. If the task is not completed within 50 seconds, the tool proactively returns a `task_id` and instructs the Agent to use `get_task_status` to follow up.
|
|
334
334
|
|
|
335
|
-
3. **SAM3
|
|
335
|
+
3. **SAM3 truncation mechanism**: `sam3_predict` defaults to 25 polling attempts (~50 seconds). If the task is not completed, it returns a truncation notice indicating the task is still processing.
|
|
336
336
|
|
|
337
|
-
4.
|
|
337
|
+
4. **Adjust SAM3 polling parameters** (advanced): If you are confident that SAM3 tasks are usually fast (e.g., under 10 seconds), you can increase polling attempts via environment variable:
|
|
338
338
|
```bash
|
|
339
339
|
SAM3_POLL_MAX_ATTEMPTS=60
|
|
340
340
|
```
|
|
341
|
-
|
|
341
|
+
But ensure the total wait time does not exceed your Agent's timeout limit.
|
|
342
342
|
|
|
343
|
-
###
|
|
343
|
+
### Drag-and-drop attachment says file not found?
|
|
344
344
|
|
|
345
|
-
|
|
345
|
+
This is a known limitation of stdio MCP. When dragging or uploading an attachment through the Agent interface, the file path is usually not automatically passed to the MCP Server.
|
|
346
346
|
|
|
347
|
-
|
|
347
|
+
**Solutions:**
|
|
348
348
|
|
|
349
|
-
1.
|
|
350
|
-
> "
|
|
349
|
+
1. **Provide the path simultaneously** (recommended): After dragging the image, add the local absolute path in your message:
|
|
350
|
+
> "Please analyze this image `D:\\photos\\cat.jpg` and find the cat"
|
|
351
351
|
|
|
352
|
-
2.
|
|
352
|
+
2. **Wait for auto-encoding**: Claude may automatically encode the image as base64. If successful, no extra action is needed.
|
|
353
353
|
|
|
354
|
-
3.
|
|
354
|
+
3. **Reply to path inquiry**: If Claude asks for the image path, simply reply with the local absolute path.
|
|
355
355
|
|
|
356
|
-
###
|
|
356
|
+
### Is there a priority among the three input methods?
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
There is no strict priority. Claude will automatically choose the most appropriate method based on conversation context:
|
|
359
359
|
|
|
360
|
-
-
|
|
361
|
-
-
|
|
362
|
-
-
|
|
360
|
+
- You provided a local path → uses `imagePath`
|
|
361
|
+
- You provided a web link → uses `imageUrl`
|
|
362
|
+
- You dragged an attachment without a path → tries `imageBase64`
|
|
363
363
|
|
|
364
|
-
###
|
|
364
|
+
### What image formats are supported?
|
|
365
365
|
|
|
366
|
-
|
|
366
|
+
Common formats: PNG, JPG, JPEG, BMP, WebP, etc. PNG or JPG is recommended.
|
|
367
367
|
|
|
368
|
-
### URL
|
|
368
|
+
### What if URL image download fails?
|
|
369
369
|
|
|
370
|
-
|
|
370
|
+
Ensure the URL is **publicly accessible**, requiring no login, cookies, or signatures. If the image is on a service requiring authentication (e.g., private S3 Bucket, login-required image host), download it locally first and use `imagePath`.
|
|
371
371
|
|
|
372
|
-
###
|
|
372
|
+
### What if the base64 image is too large?
|
|
373
373
|
|
|
374
|
-
|
|
374
|
+
If the image is very large (e.g., 4K resolution), the base64-encoded data will be very large and may slow transmission. Suggestions:
|
|
375
375
|
|
|
376
|
-
1.
|
|
377
|
-
2.
|
|
376
|
+
1. Use `imagePath` instead
|
|
377
|
+
2. Or compress the image before encoding
|
|
378
378
|
|
|
379
|
-
##
|
|
379
|
+
## File Upload Notes
|
|
380
380
|
|
|
381
|
-
|
|
382
|
-
1.
|
|
383
|
-
2.
|
|
384
|
-
3.
|
|
381
|
+
When `type` is `"local"`:
|
|
382
|
+
1. File is read locally by the MCP Server
|
|
383
|
+
2. Uploaded directly to TOS object storage via pre-signed URL
|
|
384
|
+
3. **Max file size: 100MB**
|
|
385
385
|
|
|
386
|
-
##
|
|
386
|
+
## Troubleshooting
|
|
387
387
|
|
|
388
388
|
### "command not found: npx"
|
|
389
389
|
|
|
390
|
-
|
|
390
|
+
Install Node.js >= 18: https://nodejs.org/
|
|
391
391
|
|
|
392
|
-
### "
|
|
392
|
+
### "Error: --api-key argument or API_KEY environment variable is required"
|
|
393
393
|
|
|
394
|
-
API Key
|
|
394
|
+
Your API Key is missing. Double-check the `env.API_KEY` in your config.
|
|
395
395
|
|
|
396
|
-
### MCP Server
|
|
396
|
+
### MCP Server shows red/error in client
|
|
397
397
|
|
|
398
|
-
|
|
399
|
-
- **Claude Desktop macOS
|
|
400
|
-
- **Claude Desktop Windows
|
|
401
|
-
- **Cursor
|
|
398
|
+
Check logs:
|
|
399
|
+
- **Claude Desktop macOS**: `~/Library/Logs/Claude/mcp*.log`
|
|
400
|
+
- **Claude Desktop Windows**: `%APPDATA%\Claude\logs\mcp*.log`
|
|
401
|
+
- **Cursor**: Output panel > MCP
|
|
402
402
|
|
|
403
|
-
### "TOS
|
|
403
|
+
### "TOS upload failed"
|
|
404
404
|
|
|
405
|
-
|
|
405
|
+
Usually a signature mismatch. Ensure your `HTTP_API_BASE_URL` and `API_KEY` are correct and active.
|
|
406
406
|
|
|
407
|
-
##
|
|
407
|
+
## Global Install (Alternative)
|
|
408
408
|
|
|
409
|
-
|
|
409
|
+
If you prefer not using `npx` every time:
|
|
410
410
|
|
|
411
411
|
```bash
|
|
412
412
|
npm install -g @avclabs.ai/media-mcp
|
|
413
413
|
```
|
|
414
414
|
|
|
415
|
-
|
|
415
|
+
Then use `"command": "media-mcp"` with `"args": ["--api-key", "your-api-key"]` in your config.
|
|
416
416
|
|
|
417
417
|
## License
|
|
418
418
|
|
|
419
|
-
MIT License -
|
|
419
|
+
MIT License - See [LICENSE](LICENSE) file for details
|