@avclabs.ai/media-mcp 0.2.0 → 0.3.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 +398 -184
- package/README_CN.md +633 -0
- package/config.json +1 -0
- package/dist/image-enhancement.d.ts +3 -0
- package/dist/image-enhancement.d.ts.map +1 -0
- package/dist/image-enhancement.js +185 -0
- package/dist/image-enhancement.js.map +1 -0
- package/dist/sam3.d.ts +7 -0
- package/dist/sam3.d.ts.map +1 -1
- package/dist/sam3.js +148 -104
- package/dist/sam3.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +80 -56
- package/dist/server.js.map +1 -1
- package/dist/service-config.d.ts +62 -0
- package/dist/service-config.d.ts.map +1 -0
- package/dist/service-config.js +58 -0
- package/dist/service-config.js.map +1 -0
- package/dist/tooling.d.ts +42 -0
- package/dist/tooling.d.ts.map +1 -0
- package/dist/tooling.js +153 -0
- package/dist/tooling.js.map +1 -0
- package/dist/tos.d.ts +35 -0
- package/dist/tos.d.ts.map +1 -0
- package/dist/tos.js +281 -0
- package/dist/tos.js.map +1 -0
- package/dist/upload.d.ts +79 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +190 -0
- package/dist/upload.js.map +1 -0
- package/dist/video-enhancement.d.ts.map +1 -1
- package/dist/video-enhancement.js +95 -175
- package/dist/video-enhancement.js.map +1 -1
- package/package.json +11 -6
- package/README_EN.md +0 -419
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
|
-
import * as path from 'path';
|
|
4
3
|
import { z } from 'zod';
|
|
5
|
-
import
|
|
4
|
+
import { checkLocalFile, formatRequestError, parseTosSignature, unwrapEnvelope, uploadToTos, } from './tos.js';
|
|
5
|
+
import { classifyStatus, POLL_REQUEST_TIMEOUT_MS, pollUntilTerminal, registerTool } from './tooling.js';
|
|
6
|
+
const PollIntervalSchema = z.number().min(0.5).max(30).default(5).describe('Polling interval in seconds (0.5-30), default 5');
|
|
7
|
+
const SyncTimeoutSchema = z.number().min(1).max(45).default(45).describe('Synchronous wait timeout in seconds (1-45), default 45. Returns task_id early when exceeded, use the task status tool to continue polling');
|
|
6
8
|
// Schemas
|
|
7
9
|
const CreateTaskSchema = z.object({
|
|
8
|
-
video_source: z.string().describe('
|
|
9
|
-
type: z.enum(['url', 'local']).default('url').describe('
|
|
10
|
-
resolution: z.enum(['480p', '540p', '720p', '1080p', '2k']).default('720p').describe('
|
|
10
|
+
video_source: z.string().describe('Video URL or local file path (URL must be publicly accessible, login or signed links are not supported)'),
|
|
11
|
+
type: z.enum(['url', 'local']).default('url').describe('Upload type: url=remote video, local=local file'),
|
|
12
|
+
resolution: z.enum(['480p', '540p', '720p', '1080p', '2k']).default('720p').describe('Target resolution, default 720p'),
|
|
11
13
|
});
|
|
12
14
|
const GetTaskStatusSchema = z.object({
|
|
13
|
-
task_id: z.string().describe('
|
|
15
|
+
task_id: z.string().describe('Task ID'),
|
|
14
16
|
});
|
|
15
17
|
const EnhanceVideoSyncSchema = z.object({
|
|
16
|
-
video_source: z.string().describe('
|
|
17
|
-
type: z.enum(['url', 'local']).default('url').describe('
|
|
18
|
-
resolution: z.enum(['480p', '540p', '720p', '1080p', '2k']).default('720p').describe('
|
|
19
|
-
poll_interval:
|
|
20
|
-
timeout:
|
|
18
|
+
video_source: z.string().describe('Video URL or local file path (URL must be publicly accessible, login or signed links are not supported)'),
|
|
19
|
+
type: z.enum(['url', 'local']).default('url').describe('Upload type: url=remote video, local=local file'),
|
|
20
|
+
resolution: z.enum(['480p', '540p', '720p', '1080p', '2k']).default('720p').describe('Target resolution, default 720p'),
|
|
21
|
+
poll_interval: PollIntervalSchema,
|
|
22
|
+
timeout: SyncTimeoutSchema,
|
|
21
23
|
});
|
|
22
24
|
export function setupVideoEnhancementTools(server, baseUrl, apiKey) {
|
|
23
25
|
const client = axios.create({
|
|
@@ -28,178 +30,111 @@ export function setupVideoEnhancementTools(server, baseUrl, apiKey) {
|
|
|
28
30
|
},
|
|
29
31
|
timeout: 60000,
|
|
30
32
|
});
|
|
31
|
-
|
|
32
|
-
server.tool('create_task', `创建视频增强任务(异步)
|
|
33
|
+
registerTool(server, 'create_task', `Create a video enhancement task (asynchronous).
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
1. URL
|
|
36
|
-
2.
|
|
35
|
+
Two upload methods are supported:
|
|
36
|
+
1. URL upload: provide a video URL
|
|
37
|
+
2. Local upload: provide a local file path, the MCP Server will auto-upload to TOS object storage
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
- video_source:
|
|
40
|
-
- type: "url"
|
|
41
|
-
- resolution:
|
|
39
|
+
Parameters:
|
|
40
|
+
- video_source: video URL or local file path
|
|
41
|
+
- type: "url" or "local"
|
|
42
|
+
- resolution: target resolution
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
content: [{ type: 'text', text: JSON.stringify({ success: false, error: errorMessage }, null, 2) }],
|
|
54
|
-
};
|
|
55
|
-
}
|
|
44
|
+
After creating a task, a task_id is returned immediately. Use get_task_status to poll for results until status becomes "completed" or "failed".`, CreateTaskSchema.shape, async (args) => createTask(client, args.video_source, args.type, args.resolution));
|
|
45
|
+
registerTool(server, 'get_task_status', 'Query video enhancement task status. The status field can be: processing, completed, or failed. If status is processing, wait a few seconds and call this tool again to poll.', GetTaskStatusSchema.shape, async (args) => {
|
|
46
|
+
const result = await getTaskStatus(client, args.task_id);
|
|
47
|
+
return {
|
|
48
|
+
...result,
|
|
49
|
+
// registerTool marks isError on success===false: a terminal failed
|
|
50
|
+
// status is a failed query outcome, not a healthy poll tick.
|
|
51
|
+
success: classifyStatus(result.status) !== 'failed',
|
|
52
|
+
message: result.status === 'processing' ? 'Task is still processing, please check again later' : undefined,
|
|
53
|
+
};
|
|
56
54
|
});
|
|
57
|
-
|
|
58
|
-
server.tool('get_task_status', '查询视频增强任务状态。返回值中的 status 字段可能为:processing(处理中)、completed(已完成)、failed(失败)。如果 status 为 processing,你需要等待几秒后再次调用此工具轮询。', GetTaskStatusSchema.shape, async (args) => {
|
|
59
|
-
try {
|
|
60
|
-
const result = await getTaskStatus(client, args.task_id);
|
|
61
|
-
return {
|
|
62
|
-
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
67
|
-
return {
|
|
68
|
-
content: [{ type: 'text', text: JSON.stringify({ success: false, error: errorMessage }, null, 2) }],
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
// enhance_video_sync tool
|
|
73
|
-
server.tool('enhance_video_sync', `同步增强视频(阻塞等待完成)
|
|
55
|
+
registerTool(server, 'enhance_video_sync', `Synchronously enhance video (blocks until completion).
|
|
74
56
|
|
|
75
|
-
|
|
76
|
-
1. URL
|
|
77
|
-
2.
|
|
57
|
+
Two upload methods are supported:
|
|
58
|
+
1. URL upload: provide a video URL
|
|
59
|
+
2. Local upload: provide a local file path, the MCP Server will auto-upload to TOS object storage
|
|
78
60
|
|
|
79
|
-
|
|
80
|
-
- video_source:
|
|
81
|
-
- type: "url"
|
|
82
|
-
- resolution:
|
|
83
|
-
- poll_interval:
|
|
84
|
-
- timeout:
|
|
61
|
+
Parameters:
|
|
62
|
+
- video_source: video URL or local file path
|
|
63
|
+
- type: "url" or "local"
|
|
64
|
+
- resolution: target resolution
|
|
65
|
+
- poll_interval: polling interval in seconds
|
|
66
|
+
- timeout: synchronous wait timeout in seconds, default 45
|
|
85
67
|
|
|
86
|
-
|
|
87
|
-
try {
|
|
88
|
-
const result = await enhanceVideoSync(client, args.video_source, args.type, args.resolution, args.poll_interval, args.timeout);
|
|
89
|
-
return {
|
|
90
|
-
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
95
|
-
return {
|
|
96
|
-
content: [{ type: 'text', text: JSON.stringify({ success: false, error: errorMessage }, null, 2) }],
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
function checkLocalFile(filePath) {
|
|
102
|
-
if (!fs.existsSync(filePath)) {
|
|
103
|
-
throw new Error(`文件不存在: ${filePath}`);
|
|
104
|
-
}
|
|
105
|
-
const stats = fs.statSync(filePath);
|
|
106
|
-
const maxSize = 100 * 1024 * 1024;
|
|
107
|
-
if (stats.size > maxSize) {
|
|
108
|
-
throw new Error('文件大小超过 100MB 限制');
|
|
109
|
-
}
|
|
110
|
-
return { filePath, fileName: path.basename(filePath) };
|
|
68
|
+
Best for short videos (estimated processing time < 1 minute). If the task is not completed within the timeout, the tool returns early with a task_id. Use get_task_status to continue polling.`, EnhanceVideoSyncSchema.shape, async (args) => enhanceVideoSync(client, args.video_source, args.type, args.resolution, args.poll_interval, args.timeout));
|
|
111
69
|
}
|
|
112
70
|
async function getTosSignature(client, fileName) {
|
|
113
71
|
const response = await client.post('/api/v3/contents/generations/tos-signature', {
|
|
114
72
|
file_type: 'video',
|
|
115
73
|
file_name: fileName,
|
|
116
74
|
});
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
throw new Error(
|
|
75
|
+
const unwrapped = unwrapEnvelope(response);
|
|
76
|
+
if (!unwrapped.ok) {
|
|
77
|
+
throw new Error(unwrapped.error);
|
|
120
78
|
}
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
async function uploadToTos(filePath, signatureData) {
|
|
124
|
-
const formData = new FormData();
|
|
125
|
-
const objectKey = decodeURIComponent(new URL(signatureData.url).pathname.slice(1));
|
|
126
|
-
formData.append('key', objectKey);
|
|
127
|
-
const fieldMapping = {
|
|
128
|
-
algorithm: 'x-tos-algorithm',
|
|
129
|
-
credential: 'x-tos-credential',
|
|
130
|
-
date: 'x-tos-date',
|
|
131
|
-
signature: 'x-tos-signature',
|
|
132
|
-
};
|
|
133
|
-
for (const [key, value] of Object.entries(signatureData)) {
|
|
134
|
-
if (key === 'url' || key === 'origin_policy')
|
|
135
|
-
continue;
|
|
136
|
-
const formKey = fieldMapping[key] || key;
|
|
137
|
-
formData.append(formKey, String(value));
|
|
138
|
-
}
|
|
139
|
-
const fileName = path.basename(filePath);
|
|
140
|
-
formData.append('file', fs.createReadStream(filePath), fileName);
|
|
141
|
-
const response = await axios.post(signatureData.url, formData, {
|
|
142
|
-
headers: formData.getHeaders(),
|
|
143
|
-
maxBodyLength: Infinity,
|
|
144
|
-
maxContentLength: Infinity,
|
|
145
|
-
});
|
|
146
|
-
if (response.status >= 400) {
|
|
147
|
-
const debugInfo = JSON.stringify({
|
|
148
|
-
status: response.status,
|
|
149
|
-
statusText: response.statusText,
|
|
150
|
-
data: response.data,
|
|
151
|
-
url: signatureData.url,
|
|
152
|
-
signatureFields: Object.keys(signatureData),
|
|
153
|
-
fileName,
|
|
154
|
-
fileSize: fs.statSync(filePath).size,
|
|
155
|
-
}, null, 2);
|
|
156
|
-
throw new Error(`TOS 上传失败: ${response.status} ${response.statusText}\n调试信息: ${debugInfo}`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function parseFileIdFromUrl(url) {
|
|
160
|
-
const pathname = new URL(url).pathname;
|
|
161
|
-
const segments = pathname.split('/');
|
|
162
|
-
return decodeURIComponent(segments.pop() || '');
|
|
79
|
+
return unwrapped.data;
|
|
163
80
|
}
|
|
164
81
|
async function createTask(client, videoSource, sourceType, resolution) {
|
|
165
82
|
let contentItem;
|
|
166
83
|
if (sourceType === 'local') {
|
|
167
|
-
const fileInfo = checkLocalFile(videoSource);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
84
|
+
const fileInfo = checkLocalFile(videoSource, 'video');
|
|
85
|
+
// Step 1: Get TOS signature
|
|
86
|
+
let target;
|
|
87
|
+
try {
|
|
88
|
+
target = parseTosSignature(await getTosSignature(client, fileInfo.fileName));
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
throw new Error(`[Step 1: TOS signature failed] ${formatRequestError(error)}`);
|
|
92
|
+
}
|
|
93
|
+
// Step 2: Upload to TOS
|
|
94
|
+
try {
|
|
95
|
+
await uploadToTos(target, fs.createReadStream(videoSource), fileInfo.fileName);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
throw new Error(`[Step 2: TOS upload failed] ${error.message}`);
|
|
99
|
+
}
|
|
100
|
+
contentItem = { type: 'video_file', file_id: target.fileId, file_name: fileInfo.fileName };
|
|
172
101
|
}
|
|
173
102
|
else {
|
|
174
103
|
contentItem = { type: 'video_url', video_url: { url: videoSource } };
|
|
175
104
|
}
|
|
105
|
+
// Step 3: Call video API
|
|
176
106
|
const payload = { model: 'avc-enhance', content: [contentItem], resolution };
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return { success: false, error: data.message };
|
|
107
|
+
let response;
|
|
108
|
+
try {
|
|
109
|
+
response = await client.post('/api/v3/contents/generations/tasks', payload);
|
|
181
110
|
}
|
|
182
|
-
|
|
111
|
+
catch (error) {
|
|
112
|
+
throw new Error(`[Step 3: API call failed] ${formatRequestError(error)}`);
|
|
113
|
+
}
|
|
114
|
+
const unwrapped = unwrapEnvelope(response);
|
|
115
|
+
if (!unwrapped.ok) {
|
|
116
|
+
return { success: false, error: unwrapped.error };
|
|
117
|
+
}
|
|
118
|
+
return { success: true, task_id: unwrapped.data.task_id, status: unwrapped.data.status };
|
|
183
119
|
}
|
|
184
|
-
async function getTaskStatus(client, taskId) {
|
|
185
|
-
const response = await client.get(`/api/v3/contents/generations/tasks/${taskId}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
120
|
+
async function getTaskStatus(client, taskId, signal) {
|
|
121
|
+
const response = await client.get(`/api/v3/contents/generations/tasks/${encodeURIComponent(taskId)}`, {
|
|
122
|
+
timeout: POLL_REQUEST_TIMEOUT_MS,
|
|
123
|
+
signal,
|
|
124
|
+
});
|
|
125
|
+
const unwrapped = unwrapEnvelope(response);
|
|
126
|
+
if (!unwrapped.ok) {
|
|
127
|
+
throw new Error(unwrapped.error);
|
|
189
128
|
}
|
|
190
|
-
const result =
|
|
129
|
+
const result = unwrapped.data;
|
|
191
130
|
return {
|
|
192
|
-
success: true,
|
|
193
131
|
task_id: result.task_id,
|
|
194
132
|
status: result.status,
|
|
195
|
-
progress: result.progress
|
|
133
|
+
progress: result.progress ?? 0,
|
|
196
134
|
video_url: result.video_url,
|
|
197
|
-
debug_video_url_length: result.video_url?.length,
|
|
198
|
-
debug_video_url_full: result.video_url,
|
|
199
135
|
error_message: result.error_message,
|
|
200
136
|
created_at: result.created_at,
|
|
201
137
|
updated_at: result.updated_at,
|
|
202
|
-
message: result.status === 'processing' ? '任务仍在处理中,请稍后再查询' : undefined,
|
|
203
138
|
};
|
|
204
139
|
}
|
|
205
140
|
async function enhanceVideoSync(client, videoSource, sourceType, resolution, pollInterval, timeout) {
|
|
@@ -207,30 +142,15 @@ async function enhanceVideoSync(client, videoSource, sourceType, resolution, pol
|
|
|
207
142
|
if (!createResult.success) {
|
|
208
143
|
return createResult;
|
|
209
144
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const elapsed = (Date.now() - startTime) / 1000;
|
|
221
|
-
if (elapsed >= timeout) {
|
|
222
|
-
return {
|
|
223
|
-
success: true,
|
|
224
|
-
status: 'processing',
|
|
225
|
-
task_id: taskId,
|
|
226
|
-
message: `任务仍在处理中(已等待 ${timeout} 秒)。请使用 get_task_status 工具继续查询此任务状态。`,
|
|
227
|
-
note: '此工具对长任务的同步等待已被截断,请切换到 get_task_status 轮询模式。',
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
await sleep(pollInterval * 1000);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
function sleep(ms) {
|
|
234
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
145
|
+
return pollUntilTerminal({
|
|
146
|
+
taskId: createResult.task_id,
|
|
147
|
+
timeoutSeconds: timeout,
|
|
148
|
+
pollIntervalSeconds: pollInterval,
|
|
149
|
+
continueHint: 'get_task_status',
|
|
150
|
+
fetchStatus: async (signal) => {
|
|
151
|
+
const { task_id, status, ...payload } = await getTaskStatus(client, createResult.task_id, signal);
|
|
152
|
+
return { status, payload };
|
|
153
|
+
},
|
|
154
|
+
});
|
|
235
155
|
}
|
|
236
156
|
//# sourceMappingURL=video-enhancement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-enhancement.js","sourceRoot":"","sources":["../src/video-enhancement.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,
|
|
1
|
+
{"version":3,"file":"video-enhancement.js","sourceRoot":"","sources":["../src/video-enhancement.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,WAAW,GACZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAExG,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAA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E,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAClG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;QAC7B,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@avclabs.ai/media-mcp",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"description": "MCP Server for video enhancement and image segmentation (SAM3)",
|
|
4
|
+
"version": "0.3.0",
|
|
5
|
+
"description": "MCP Server for video enhancement, image enhancement/colorization/denoising, and image segmentation (SAM3)",
|
|
6
6
|
"mcpName": "io.github.avclabs/media-mcp",
|
|
7
7
|
"main": "dist/server.js",
|
|
8
8
|
"types": "dist/server.d.ts",
|
|
@@ -14,26 +14,31 @@
|
|
|
14
14
|
"config.json",
|
|
15
15
|
"LICENSE",
|
|
16
16
|
"README.md",
|
|
17
|
-
"
|
|
17
|
+
"README_CN.md"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsc",
|
|
21
|
+
"check:release": "node scripts/check-release.mjs",
|
|
21
22
|
"dev": "tsc --watch",
|
|
22
23
|
"prepare": "npm run build",
|
|
23
|
-
"prepublishOnly": "npm run build"
|
|
24
|
+
"prepublishOnly": "npm run build",
|
|
25
|
+
"test": "npm run build && node --test tests/*.test.mjs",
|
|
26
|
+
"release:verify": "npm run check:release && npm audit --omit=dev --audit-level=high && npm test && npm pack --dry-run"
|
|
24
27
|
},
|
|
25
28
|
"keywords": [
|
|
26
29
|
"mcp",
|
|
27
30
|
"model-context-protocol",
|
|
28
31
|
"video",
|
|
32
|
+
"image",
|
|
29
33
|
"enhancement",
|
|
34
|
+
"colorization",
|
|
35
|
+
"denoising",
|
|
30
36
|
"http",
|
|
31
37
|
"client",
|
|
32
38
|
"server",
|
|
33
39
|
"claude",
|
|
34
40
|
"anthropic"
|
|
35
41
|
],
|
|
36
|
-
"author": "Your Name <your.email@example.com>",
|
|
37
42
|
"license": "MIT",
|
|
38
43
|
"repository": {
|
|
39
44
|
"type": "git",
|
|
@@ -64,7 +69,7 @@
|
|
|
64
69
|
"HTTP_API_BASE_URL": "https://mcp.avc.ai/enhance",
|
|
65
70
|
"SAM3_API_BASE_URL": "https://mcp.avc.ai/sam"
|
|
66
71
|
},
|
|
67
|
-
"description": "视频增强 + SAM3 图像分割 MCP 服务",
|
|
72
|
+
"description": "视频增强 + 图片增强/上色/降噪 + SAM3 图像分割 MCP 服务",
|
|
68
73
|
"setup": "需要替换 env.API_KEY 为你的 API Key"
|
|
69
74
|
},
|
|
70
75
|
"engines": {
|