@avclabs.ai/media-mcp 0.1.1 → 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 +229 -147
- package/README_CN.md +419 -0
- package/dist/sam3.js +39 -26
- package/dist/sam3.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +7 -7
- package/dist/server.js.map +1 -1
- package/dist/video-enhancement.d.ts.map +1 -1
- package/dist/video-enhancement.js +44 -33
- package/dist/video-enhancement.js.map +1 -1
- package/package.json +2 -2
- package/README_EN.md +0 -336
package/README.md
CHANGED
|
@@ -1,61 +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
|
-
|
|
14
|
-
- `create_task` - 创建视频增强任务(支持 URL 或本地文件上传)
|
|
15
|
-
- `get_task_status` - 查询任务状态
|
|
16
|
-
- `enhance_video_sync` - 同步增强视频(阻塞等待完成)
|
|
17
|
-
- `sam3_predict` - SAM3 图像分割(支持本地路径、URL 或 Base64 图片)
|
|
13
|
+
Provides the following MCP Tools:
|
|
18
14
|
|
|
19
|
-
|
|
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)
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
-
|
|
20
|
+
**Image Segmentation (SAM3)**
|
|
21
|
+
- `sam3_predict` - SAM3 image segmentation (supports local path, URL, or Base64 image)
|
|
23
22
|
|
|
24
|
-
##
|
|
23
|
+
## Prerequisites
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
- **Node.js >= 18** (check: `node --version`)
|
|
26
|
+
- **API Key** (required for authentication)
|
|
27
|
+
|
|
28
|
+
## Lazy Install (Recommended)
|
|
29
|
+
|
|
30
|
+
If your AI Agent has a known MCP config path, just copy the line below and send it to your AI:
|
|
27
31
|
|
|
28
32
|
```
|
|
29
|
-
|
|
33
|
+
Install the npm package @avclabs.ai/media-mcp as an MCP server. My API Key is: sk-xxxxxxxx.
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
AI
|
|
33
|
-
1.
|
|
34
|
-
2.
|
|
35
|
-
3.
|
|
36
|
-
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
|
|
37
41
|
|
|
38
|
-
##
|
|
42
|
+
## Manual Install
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
No installation needed. Use `npx` directly in your MCP client config.
|
|
41
45
|
|
|
42
|
-
### 1. Claude Code
|
|
46
|
+
### 1. Claude Code (CLI)
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
Run in Claude Code:
|
|
45
49
|
|
|
46
50
|
```
|
|
47
51
|
/mcp
|
|
48
52
|
```
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
Check the output for the **"User MCPs"** section to find the config file path, then edit that file.
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
Common paths (if `/mcp` is unavailable):
|
|
53
57
|
- **Windows**: `%USERPROFILE%\.claude.json`
|
|
54
58
|
- **macOS**: `~/.claude.json`
|
|
55
59
|
- **Linux**: `~/.claude.json`
|
|
56
|
-
-
|
|
60
|
+
- **Legacy/Alternative**: `~/.claude/mcp.json`
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
Paste this (replace `your-api-key`):
|
|
59
63
|
|
|
60
64
|
```json
|
|
61
65
|
{
|
|
@@ -71,20 +75,20 @@ AI 会自动完成:
|
|
|
71
75
|
}
|
|
72
76
|
```
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
Save and run `/mcp` to verify it's loaded.
|
|
75
79
|
|
|
76
80
|
### 2. Cursor
|
|
77
81
|
|
|
78
|
-
|
|
82
|
+
Go to **Settings > Tools & MCPs > Add New MCP Server**:
|
|
79
83
|
|
|
80
|
-
- **Name
|
|
81
|
-
- **Type
|
|
82
|
-
- **Command
|
|
84
|
+
- **Name**: `video-enhancement`
|
|
85
|
+
- **Type**: `command`
|
|
86
|
+
- **Command**:
|
|
83
87
|
```bash
|
|
84
|
-
env
|
|
88
|
+
env API_KEY=your-api-key npx -y @avclabs.ai/media-mcp@latest
|
|
85
89
|
```
|
|
86
90
|
|
|
87
|
-
|
|
91
|
+
Or edit `~/.cursor/mcp.json`:
|
|
88
92
|
|
|
89
93
|
```json
|
|
90
94
|
{
|
|
@@ -100,147 +104,196 @@ AI 会自动完成:
|
|
|
100
104
|
}
|
|
101
105
|
```
|
|
102
106
|
|
|
103
|
-
##
|
|
107
|
+
## Verify Installation
|
|
104
108
|
|
|
105
|
-
|
|
109
|
+
After restarting your client, check if the tools are available:
|
|
106
110
|
|
|
107
|
-
1.
|
|
108
|
-
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`
|
|
109
113
|
|
|
110
|
-
##
|
|
114
|
+
## Configuration Options
|
|
111
115
|
|
|
112
|
-
|
|
|
116
|
+
| Variable | Required | Default | Description |
|
|
113
117
|
|---|---|---|---|
|
|
114
|
-
| `API_KEY` |
|
|
115
|
-
| `HTTP_API_BASE_URL` |
|
|
116
|
-
| `SAM3_API_BASE_URL` |
|
|
117
|
-
| `SAM3_POLL_INTERVAL` |
|
|
118
|
-
| `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 |
|
|
119
123
|
|
|
120
|
-
###
|
|
124
|
+
### Custom Endpoint
|
|
121
125
|
|
|
122
126
|
```json
|
|
123
127
|
{
|
|
124
128
|
"env": {
|
|
125
129
|
"HTTP_API_BASE_URL": "https://your-endpoint.com",
|
|
126
130
|
"API_KEY": "your-api-key",
|
|
127
|
-
"SAM3_API_BASE_URL": "
|
|
131
|
+
"SAM3_API_BASE_URL": "https://your-sam3-endpoint.com"
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
```
|
|
131
135
|
|
|
132
|
-
|
|
136
|
+
Or via CLI args:
|
|
133
137
|
```bash
|
|
134
|
-
npx -y @avclabs.ai/media-mcp@latest --base-url https://your-endpoint.com --api-key your-api-key --sam3-base-url
|
|
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
|
|
135
139
|
```
|
|
136
140
|
|
|
137
|
-
##
|
|
141
|
+
## Recommended Workflow
|
|
142
|
+
|
|
143
|
+
This project provides both **synchronous** and **asynchronous** modes.
|
|
144
|
+
|
|
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
|
+
|
|
147
|
+
### Asynchronous Mode (Recommended)
|
|
148
|
+
|
|
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
|
+
|
|
156
|
+
### Synchronous Mode (Simple Scenarios)
|
|
157
|
+
|
|
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
|
+
|
|
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
|
|
138
169
|
|
|
139
|
-
|
|
170
|
+
## Usage Examples
|
|
140
171
|
|
|
141
|
-
|
|
172
|
+
Once configured, ask your AI agent naturally:
|
|
142
173
|
|
|
143
|
-
> "
|
|
174
|
+
> "Enhance this video to 1080p: https://example.com/video.mp4"
|
|
144
175
|
|
|
145
|
-
|
|
176
|
+
> "Improve the quality of /Users/me/Desktop/video.mp4 to 2k"
|
|
146
177
|
|
|
147
|
-
> "
|
|
148
|
-
>
|
|
149
|
-
> "用 SAM3 分割这张图片,prompt 是 'find all cars'"
|
|
178
|
+
> "Analyze this image and find all objects: C:\\Users\\xxx\\photo.png"
|
|
150
179
|
|
|
151
|
-
|
|
180
|
+
> "Use SAM3 to segment this image, prompt: 'find all cars'"
|
|
152
181
|
|
|
153
|
-
|
|
182
|
+
The agent will automatically choose sync or async tools based on task complexity.
|
|
154
183
|
|
|
155
|
-
|
|
184
|
+
## Provided Tools
|
|
156
185
|
|
|
157
|
-
|
|
186
|
+
### Video Enhancement
|
|
158
187
|
|
|
159
|
-
|
|
188
|
+
#### create_task
|
|
189
|
+
|
|
190
|
+
Create an asynchronous video enhancement task.
|
|
191
|
+
|
|
192
|
+
> **Recommended for most use cases.** Ideal for longer videos (over 10 seconds) to avoid timeouts and blocking the connection.
|
|
193
|
+
|
|
194
|
+
| Parameter | Type | Required | Default | Description |
|
|
160
195
|
|---|---|---|---|---|
|
|
161
|
-
| `video_source` | string |
|
|
162
|
-
| `type` | string |
|
|
163
|
-
| `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` |
|
|
164
199
|
|
|
165
|
-
|
|
200
|
+
**Returns:**
|
|
166
201
|
```json
|
|
167
202
|
{
|
|
168
203
|
"success": true,
|
|
169
204
|
"task_id": "xxx",
|
|
170
|
-
"status": "
|
|
205
|
+
"status": "processing"
|
|
171
206
|
}
|
|
172
207
|
```
|
|
173
208
|
|
|
174
|
-
|
|
209
|
+
#### get_task_status
|
|
175
210
|
|
|
176
|
-
|
|
211
|
+
Query video enhancement task status.
|
|
177
212
|
|
|
178
|
-
|
|
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
|
+
|
|
215
|
+
| Parameter | Type | Required |
|
|
179
216
|
|---|---|---|
|
|
180
|
-
| `task_id` | string |
|
|
217
|
+
| `task_id` | string | Yes |
|
|
181
218
|
|
|
182
|
-
|
|
219
|
+
**Returns:**
|
|
183
220
|
```json
|
|
184
221
|
{
|
|
185
222
|
"success": true,
|
|
186
223
|
"task_id": "xxx",
|
|
187
224
|
"status": "completed",
|
|
188
225
|
"progress": 100,
|
|
189
|
-
"video_url": "https://..."
|
|
226
|
+
"video_url": "https://...",
|
|
227
|
+
"message": "Task is still processing, please check again later"
|
|
190
228
|
}
|
|
191
229
|
```
|
|
192
230
|
|
|
193
|
-
|
|
231
|
+
The `message` field only appears when `status` is `processing`, prompting the Agent to continue waiting.
|
|
232
|
+
|
|
233
|
+
#### enhance_video_sync
|
|
194
234
|
|
|
195
|
-
|
|
235
|
+
Synchronously enhance video (blocks until completion).
|
|
196
236
|
|
|
197
|
-
>
|
|
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.
|
|
198
238
|
|
|
199
|
-
|
|
|
239
|
+
| Parameter | Type | Required | Default | Description |
|
|
200
240
|
|---|---|---|---|---|
|
|
201
|
-
| `video_source` | string |
|
|
202
|
-
| `type` | string |
|
|
203
|
-
| `resolution` | string |
|
|
204
|
-
| `poll_interval` | number |
|
|
205
|
-
| `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
|
+
|
|
247
|
+
**Truncated return example (not completed within 50s):**
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"success": true,
|
|
251
|
+
"status": "processing",
|
|
252
|
+
"task_id": "xxx",
|
|
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
|
+
}
|
|
256
|
+
```
|
|
206
257
|
|
|
207
|
-
###
|
|
258
|
+
### Image Segmentation (SAM3)
|
|
208
259
|
|
|
209
|
-
|
|
260
|
+
#### sam3_predict
|
|
210
261
|
|
|
211
|
-
|
|
262
|
+
Analyze an image using the SAM3 segmentation API to generate inference results (masks, boxes, scores).
|
|
212
263
|
|
|
213
|
-
|
|
264
|
+
**Parameters:**
|
|
214
265
|
|
|
215
|
-
|
|
216
|
-
- 示例:`"C:\\Users\\xxx\\photo.png"`、`"/home/user/images/cat.jpg"`
|
|
217
|
-
- 适用场景:用户明确提供了本地文件路径
|
|
266
|
+
Image input (choose one, must provide exactly one):
|
|
218
267
|
|
|
219
|
-
- `
|
|
220
|
-
-
|
|
221
|
-
-
|
|
222
|
-
- 注意:URL 必须公开可访问,不支持需要登录或签名的链接
|
|
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
|
|
223
271
|
|
|
224
|
-
- `
|
|
225
|
-
-
|
|
226
|
-
-
|
|
227
|
-
-
|
|
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
|
|
228
276
|
|
|
229
|
-
|
|
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
|
|
230
281
|
|
|
231
|
-
|
|
282
|
+
Other parameters:
|
|
232
283
|
|
|
233
|
-
|
|
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.
|
|
234
285
|
|
|
235
|
-
|
|
286
|
+
**Normal completion return:**
|
|
236
287
|
|
|
237
|
-
|
|
238
|
-
- **`boxes`**:二维数组。每个元素是 `[x1, y1, x2, y2]` 格式的边界框坐标,表示检测到的物体在图片中的矩形区域。`x1`、`y1` 为左上角坐标,`x2`、`y2` 为右下角坐标。
|
|
288
|
+
After inference completes, returns a JSON string containing three fields:
|
|
239
289
|
|
|
240
|
-
|
|
241
|
-
- **`
|
|
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.
|
|
242
292
|
|
|
243
|
-
|
|
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
|
+
|
|
296
|
+
Example result JSON:
|
|
244
297
|
|
|
245
298
|
```json
|
|
246
299
|
{
|
|
@@ -256,82 +309,111 @@ AI 会自动调用相应工具完成任务。
|
|
|
256
309
|
}
|
|
257
310
|
```
|
|
258
311
|
|
|
259
|
-
|
|
312
|
+
**Truncated return example (not completed within 50s):**
|
|
313
|
+
```json
|
|
314
|
+
{
|
|
315
|
+
"success": true,
|
|
316
|
+
"status": "processing",
|
|
317
|
+
"task_id": "xxx",
|
|
318
|
+
"message": "Task is still processing (waited about 50 seconds). Please retry later or record this task_id for manual follow-up.",
|
|
319
|
+
"note": "The synchronous wait for this long-running task has been truncated."
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## FAQ
|
|
324
|
+
|
|
325
|
+
### Agent reports timeout when calling tools?
|
|
326
|
+
|
|
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
|
+
|
|
329
|
+
**Solutions:**
|
|
330
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
```bash
|
|
339
|
+
SAM3_POLL_MAX_ATTEMPTS=60
|
|
340
|
+
```
|
|
341
|
+
But ensure the total wait time does not exceed your Agent's timeout limit.
|
|
260
342
|
|
|
261
|
-
###
|
|
343
|
+
### Drag-and-drop attachment says file not found?
|
|
262
344
|
|
|
263
|
-
|
|
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.
|
|
264
346
|
|
|
265
|
-
|
|
347
|
+
**Solutions:**
|
|
266
348
|
|
|
267
|
-
1.
|
|
268
|
-
> "
|
|
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"
|
|
269
351
|
|
|
270
|
-
2.
|
|
352
|
+
2. **Wait for auto-encoding**: Claude may automatically encode the image as base64. If successful, no extra action is needed.
|
|
271
353
|
|
|
272
|
-
3.
|
|
354
|
+
3. **Reply to path inquiry**: If Claude asks for the image path, simply reply with the local absolute path.
|
|
273
355
|
|
|
274
|
-
###
|
|
356
|
+
### Is there a priority among the three input methods?
|
|
275
357
|
|
|
276
|
-
|
|
358
|
+
There is no strict priority. Claude will automatically choose the most appropriate method based on conversation context:
|
|
277
359
|
|
|
278
|
-
-
|
|
279
|
-
-
|
|
280
|
-
-
|
|
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`
|
|
281
363
|
|
|
282
|
-
###
|
|
364
|
+
### What image formats are supported?
|
|
283
365
|
|
|
284
|
-
|
|
366
|
+
Common formats: PNG, JPG, JPEG, BMP, WebP, etc. PNG or JPG is recommended.
|
|
285
367
|
|
|
286
|
-
### URL
|
|
368
|
+
### What if URL image download fails?
|
|
287
369
|
|
|
288
|
-
|
|
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`.
|
|
289
371
|
|
|
290
|
-
###
|
|
372
|
+
### What if the base64 image is too large?
|
|
291
373
|
|
|
292
|
-
|
|
374
|
+
If the image is very large (e.g., 4K resolution), the base64-encoded data will be very large and may slow transmission. Suggestions:
|
|
293
375
|
|
|
294
|
-
1.
|
|
295
|
-
2.
|
|
376
|
+
1. Use `imagePath` instead
|
|
377
|
+
2. Or compress the image before encoding
|
|
296
378
|
|
|
297
|
-
##
|
|
379
|
+
## File Upload Notes
|
|
298
380
|
|
|
299
|
-
|
|
300
|
-
1.
|
|
301
|
-
2.
|
|
302
|
-
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**
|
|
303
385
|
|
|
304
|
-
##
|
|
386
|
+
## Troubleshooting
|
|
305
387
|
|
|
306
388
|
### "command not found: npx"
|
|
307
389
|
|
|
308
|
-
|
|
390
|
+
Install Node.js >= 18: https://nodejs.org/
|
|
309
391
|
|
|
310
|
-
### "
|
|
392
|
+
### "Error: --api-key argument or API_KEY environment variable is required"
|
|
311
393
|
|
|
312
|
-
API Key
|
|
394
|
+
Your API Key is missing. Double-check the `env.API_KEY` in your config.
|
|
313
395
|
|
|
314
|
-
### MCP Server
|
|
396
|
+
### MCP Server shows red/error in client
|
|
315
397
|
|
|
316
|
-
|
|
317
|
-
- **Claude Desktop macOS
|
|
318
|
-
- **Claude Desktop Windows
|
|
319
|
-
- **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
|
|
320
402
|
|
|
321
|
-
### "TOS
|
|
403
|
+
### "TOS upload failed"
|
|
322
404
|
|
|
323
|
-
|
|
405
|
+
Usually a signature mismatch. Ensure your `HTTP_API_BASE_URL` and `API_KEY` are correct and active.
|
|
324
406
|
|
|
325
|
-
##
|
|
407
|
+
## Global Install (Alternative)
|
|
326
408
|
|
|
327
|
-
|
|
409
|
+
If you prefer not using `npx` every time:
|
|
328
410
|
|
|
329
411
|
```bash
|
|
330
412
|
npm install -g @avclabs.ai/media-mcp
|
|
331
413
|
```
|
|
332
414
|
|
|
333
|
-
|
|
415
|
+
Then use `"command": "media-mcp"` with `"args": ["--api-key", "your-api-key"]` in your config.
|
|
334
416
|
|
|
335
417
|
## License
|
|
336
418
|
|
|
337
|
-
MIT License -
|
|
419
|
+
MIT License - See [LICENSE](LICENSE) file for details
|