@hadialmarzooq/agent-media-mcp 0.3.0 → 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/dist/index.js +27 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
inspectMedia,
|
|
29
29
|
makeVertical,
|
|
30
30
|
normalize,
|
|
31
|
+
operatorLimits,
|
|
31
32
|
optimizeForWeb
|
|
32
33
|
} from "@hadialmarzooq/agent-media-ffmpeg";
|
|
33
34
|
import { z } from "zod";
|
|
@@ -140,6 +141,11 @@ var readOnlyHint = { readOnlyHint: true };
|
|
|
140
141
|
var destructiveHint = { destructiveHint: true };
|
|
141
142
|
function createMcpServer() {
|
|
142
143
|
const server = new McpServer({ name: "agent-media", version: packageVersion });
|
|
144
|
+
const limits = operatorLimits();
|
|
145
|
+
const probeOptions = {
|
|
146
|
+
...limits.ffprobePath === void 0 ? {} : { ffprobePath: limits.ffprobePath },
|
|
147
|
+
...limits.timeoutMs === void 0 ? {} : { timeoutMs: limits.timeoutMs }
|
|
148
|
+
};
|
|
143
149
|
server.registerTool(
|
|
144
150
|
"inspect_media",
|
|
145
151
|
{
|
|
@@ -148,7 +154,7 @@ function createMcpServer() {
|
|
|
148
154
|
outputSchema: mediaMetadataShape,
|
|
149
155
|
annotations: readOnlyHint
|
|
150
156
|
},
|
|
151
|
-
async ({ input }) => safely(async () => inspectMedia(input))
|
|
157
|
+
async ({ input }) => safely(async () => inspectMedia(input, probeOptions))
|
|
152
158
|
);
|
|
153
159
|
server.registerTool(
|
|
154
160
|
"get_media_capabilities",
|
|
@@ -184,9 +190,9 @@ function createMcpServer() {
|
|
|
184
190
|
},
|
|
185
191
|
async ({ input, goals }) => safely(async () => ({
|
|
186
192
|
plan: planMedia({
|
|
187
|
-
source: await inspectMedia(input),
|
|
193
|
+
source: await inspectMedia(input, probeOptions),
|
|
188
194
|
goals: cleanGoals(validateGoalSchema(goals)),
|
|
189
|
-
capabilities: await getCapabilities()
|
|
195
|
+
capabilities: await getCapabilities(probeOptions)
|
|
190
196
|
})
|
|
191
197
|
}))
|
|
192
198
|
);
|
|
@@ -217,8 +223,8 @@ function createMcpServer() {
|
|
|
217
223
|
},
|
|
218
224
|
async ({ plan: input }) => safely(async () => {
|
|
219
225
|
const plan = normalizePlan(input);
|
|
220
|
-
const source = await inspectMedia(plan.source.path);
|
|
221
|
-
const concatenationSources = await inspectConcatenationSources(plan, source);
|
|
226
|
+
const source = await inspectMedia(plan.source.path, probeOptions);
|
|
227
|
+
const concatenationSources = await inspectConcatenationSources(plan, source, probeOptions);
|
|
222
228
|
return {
|
|
223
229
|
issues: inspectPlanIssues(plan, source, {
|
|
224
230
|
...concatenationSources === void 0 ? {} : { concatenationSources }
|
|
@@ -248,7 +254,10 @@ function createMcpServer() {
|
|
|
248
254
|
},
|
|
249
255
|
async ({ plan: input }) => safely(async () => {
|
|
250
256
|
const plan = normalizePlan(input);
|
|
251
|
-
const { plan: repaired, repairs } = repairPlan(
|
|
257
|
+
const { plan: repaired, repairs } = repairPlan(
|
|
258
|
+
plan,
|
|
259
|
+
await inspectMedia(plan.source.path, probeOptions)
|
|
260
|
+
);
|
|
252
261
|
return { repairs, repairedPlan: repaired };
|
|
253
262
|
})
|
|
254
263
|
);
|
|
@@ -299,6 +308,7 @@ function createMcpServer() {
|
|
|
299
308
|
...options.overwrite === void 0 ? {} : { overwrite: options.overwrite },
|
|
300
309
|
...contentCheckOptions(options.contentChecks),
|
|
301
310
|
...options.warnOnly === void 0 ? {} : { warnOnly: options.warnOnly },
|
|
311
|
+
...limits,
|
|
302
312
|
signal: extra.signal,
|
|
303
313
|
onProgress: notifications.notify
|
|
304
314
|
})
|
|
@@ -341,6 +351,7 @@ function createMcpServer() {
|
|
|
341
351
|
...options.overwrite === void 0 ? {} : { overwrite: options.overwrite },
|
|
342
352
|
...contentCheckOptions(options.contentChecks),
|
|
343
353
|
...options.warnOnly === void 0 ? {} : { warnOnly: options.warnOnly },
|
|
354
|
+
...limits,
|
|
344
355
|
signal: extra.signal,
|
|
345
356
|
onProgress: notifications.notify
|
|
346
357
|
})
|
|
@@ -379,6 +390,7 @@ function createMcpServer() {
|
|
|
379
390
|
...options.overwrite === void 0 ? {} : { overwrite: options.overwrite },
|
|
380
391
|
...contentCheckOptions(options.contentChecks),
|
|
381
392
|
...options.warnOnly === void 0 ? {} : { warnOnly: options.warnOnly },
|
|
393
|
+
...limits,
|
|
382
394
|
signal: extra.signal,
|
|
383
395
|
onProgress: notifications.notify
|
|
384
396
|
})
|
|
@@ -417,6 +429,7 @@ function createMcpServer() {
|
|
|
417
429
|
...options.overwrite === void 0 ? {} : { overwrite: options.overwrite },
|
|
418
430
|
...contentCheckOptions(options.contentChecks),
|
|
419
431
|
...options.warnOnly === void 0 ? {} : { warnOnly: options.warnOnly },
|
|
432
|
+
...limits,
|
|
420
433
|
signal: extra.signal,
|
|
421
434
|
onProgress: notifications.notify
|
|
422
435
|
})
|
|
@@ -453,6 +466,7 @@ function createMcpServer() {
|
|
|
453
466
|
...options.overwrite === void 0 ? {} : { overwrite: options.overwrite },
|
|
454
467
|
...contentCheckOptions(options.contentChecks),
|
|
455
468
|
...options.warnOnly === void 0 ? {} : { warnOnly: options.warnOnly },
|
|
469
|
+
...limits,
|
|
456
470
|
signal: extra.signal,
|
|
457
471
|
onProgress: notifications.notify
|
|
458
472
|
})
|
|
@@ -485,6 +499,7 @@ function createMcpServer() {
|
|
|
485
499
|
...options.overwrite === void 0 ? {} : { overwrite: options.overwrite },
|
|
486
500
|
...contentCheckOptions(options.contentChecks),
|
|
487
501
|
...options.warnOnly === void 0 ? {} : { warnOnly: options.warnOnly },
|
|
502
|
+
...limits,
|
|
488
503
|
signal: extra.signal,
|
|
489
504
|
onProgress: notifications.notify
|
|
490
505
|
})
|
|
@@ -519,6 +534,7 @@ function createMcpServer() {
|
|
|
519
534
|
const response = await safely(async () => {
|
|
520
535
|
const plan = normalizePlan(input);
|
|
521
536
|
const execution = await executePlan(plan, {
|
|
537
|
+
...limits,
|
|
522
538
|
output,
|
|
523
539
|
...overwrite === void 0 ? {} : { overwrite },
|
|
524
540
|
...writeReceipt === void 0 ? {} : { writeReceipt },
|
|
@@ -528,7 +544,7 @@ function createMcpServer() {
|
|
|
528
544
|
signal: extra.signal,
|
|
529
545
|
onProgress: notifications.notify
|
|
530
546
|
});
|
|
531
|
-
const verification = execution.verification ?? execution.receipt?.verification ?? verifyMedia(await inspectMedia(execution.output), plan.expectations);
|
|
547
|
+
const verification = execution.verification ?? execution.receipt?.verification ?? verifyMedia(await inspectMedia(execution.output, probeOptions), plan.expectations);
|
|
532
548
|
if (!verification.passed) {
|
|
533
549
|
throw new MediaError({
|
|
534
550
|
code: "VERIFICATION_FAILED",
|
|
@@ -568,6 +584,7 @@ function createMcpServer() {
|
|
|
568
584
|
const notifications = mcpProgress(extra);
|
|
569
585
|
const response = await safely(async () => {
|
|
570
586
|
const execution = await resumeFromReceipt(parseReceipt(receipt), {
|
|
587
|
+
...limits,
|
|
571
588
|
...output === void 0 ? {} : { output },
|
|
572
589
|
...overwrite === void 0 ? {} : { overwrite },
|
|
573
590
|
signal: extra.signal,
|
|
@@ -606,7 +623,7 @@ function createMcpServer() {
|
|
|
606
623
|
},
|
|
607
624
|
async ({ output, plan: input }) => safely(async () => {
|
|
608
625
|
const plan = normalizePlan(input);
|
|
609
|
-
return verifyMedia(await inspectMedia(output), plan.expectations);
|
|
626
|
+
return verifyMedia(await inspectMedia(output, probeOptions), plan.expectations);
|
|
610
627
|
})
|
|
611
628
|
);
|
|
612
629
|
return server;
|
|
@@ -637,12 +654,12 @@ async function safely(operation) {
|
|
|
637
654
|
};
|
|
638
655
|
}
|
|
639
656
|
}
|
|
640
|
-
async function inspectConcatenationSources(plan, source) {
|
|
657
|
+
async function inspectConcatenationSources(plan, source, probeOptions) {
|
|
641
658
|
const concatenate2 = plan.steps.find((step) => step.operation === "concatenate");
|
|
642
659
|
if (concatenate2?.operation !== "concatenate") return void 0;
|
|
643
660
|
const sources = [];
|
|
644
661
|
for (const [index, input] of concatenate2.inputs.entries()) {
|
|
645
|
-
sources.push(index === 0 ? source : await inspectMedia(input));
|
|
662
|
+
sources.push(index === 0 ? source : await inspectMedia(input, probeOptions));
|
|
646
663
|
}
|
|
647
664
|
return sources;
|
|
648
665
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadialmarzooq/agent-media-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "MCP server for semantic, replayable, and verified media transformations.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"media",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
41
41
|
"zod": "^4.5.4",
|
|
42
42
|
"@hadialmarzooq/agent-media-core": "0.3.0",
|
|
43
|
-
"@hadialmarzooq/agent-media-ffmpeg": "0.
|
|
43
|
+
"@hadialmarzooq/agent-media-ffmpeg": "0.4.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsup src/index.ts --format esm --dts",
|