@hadialmarzooq/agent-media-mcp 0.3.0 → 0.4.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.
Files changed (3) hide show
  1. package/README.md +42 -6
  2. package/dist/index.js +27 -10
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -4,7 +4,7 @@ MCP server for semantic, replayable, and verified media transformations.
4
4
 
5
5
  ## What it does
6
6
 
7
- A [Model Context Protocol](https://modelcontextprotocol.io) stdio server that exposes [Agent Media](https://github.com/HadiAlMarzooq/agent-media) to AI agents. Ten semantic tools covering the full inspect → plan → execute → verify contract.
7
+ A [Model Context Protocol](https://modelcontextprotocol.io) stdio server that exposes [Agent Media](https://github.com/HadiAlMarzooq/agent-media) to AI agents. Sixteen semantic tools covering the full inspect → plan → execute → verify contract, plus plan repair, durable receipts, and content checks.
8
8
 
9
9
  ## Install
10
10
 
@@ -21,14 +21,23 @@ Prerequisites: Node.js 22+, `ffmpeg` and `ffprobe` on `PATH`.
21
21
  | `inspect_media` | Inspect normalized media metadata |
22
22
  | `get_media_capabilities` | Detect local FFmpeg capabilities |
23
23
  | `plan_media` | Create an inspectable versioned Media IR plan |
24
+ | `validate_plan` | Report mechanical plan issues without executing |
25
+ | `repair_plan` | Repair a plan and report every change made |
26
+ | `get_media_plan_schema` | The canonical Media IR JSON Schema |
24
27
  | `make_vertical` | Verified 9:16 vertical workflow with progress |
25
28
  | `optimize_for_web` | Verified web optimization workflow with progress |
26
29
  | `normalize_media` | Verified high-compatibility normalization with progress |
27
30
  | `extract_audio` | Verified audio extraction with progress |
28
31
  | `extract_frame` | Verified still frame extraction with progress |
32
+ | `concatenate_media` | Verified concatenation of two or more clips |
29
33
  | `execute_media_plan` | Execute a serialized or object Media IR plan |
34
+ | `resume_execution` | Continue from a saved execution receipt |
35
+ | `inspect_receipt` | Validate and read a saved receipt |
30
36
  | `verify_media` | Verify output against plan expectations |
31
37
 
38
+ Every tool declares an `outputSchema` and returns `structuredContent`. Read-only tools carry
39
+ `readOnlyHint`; writer tools carry `destructiveHint`.
40
+
32
41
  ## Usage
33
42
 
34
43
  ### Claude Desktop
@@ -39,29 +48,56 @@ Add to `claude_desktop_config.json`:
39
48
  {
40
49
  "mcpServers": {
41
50
  "agent-media": {
42
- "command": "agent-media-mcp"
51
+ "command": "agent-media-mcp",
52
+ "env": { "AGENT_MEDIA_ALLOWED_OUTPUT_DIR": "/Users/you/Movies/agent-output" }
43
53
  }
44
54
  }
45
55
  }
46
56
  ```
47
57
 
58
+ ### Claude Code
59
+
60
+ ```bash
61
+ claude mcp add agent-media -- agent-media-mcp
62
+ ```
63
+
48
64
  ### Any MCP client
49
65
 
50
66
  ```bash
51
67
  agent-media-mcp
52
68
  ```
53
69
 
54
- The server runs over stdio. Workflows send standard MCP `notifications/progress` when the client supplies a progress token. Plan execution and verification accept either a plan object or serialized plan JSON. Tool failures set `isError: true` and carry the same structured error body as the SDK and CLI.
70
+ The server runs over stdio. Workflows send standard MCP `notifications/progress` when the client
71
+ supplies a progress token, and honour client cancellation. Plan execution and verification accept
72
+ either a plan object or serialized plan JSON. Tool failures set `isError: true` and carry the same
73
+ structured error body as the SDK and CLI.
74
+
75
+ ## Limits the operator sets
76
+
77
+ Limits come from the environment, so they belong to whoever runs the server rather than to the model
78
+ calling it. No tool accepts them as an argument, so nothing the model sends can widen them.
79
+
80
+ | Variable | Effect |
81
+ | -------------------------------- | --------------------------------------------------------- |
82
+ | `AGENT_MEDIA_ALLOWED_OUTPUT_DIR` | writes outside this tree fail with `PATH_NOT_ALLOWED` |
83
+ | `AGENT_MEDIA_TIMEOUT_MS` | any FFmpeg run beyond this fails with `OPERATION_TIMEOUT` |
84
+ | `AGENT_MEDIA_FFMPEG_PATH` | an `ffmpeg` that is not on `PATH` |
85
+ | `AGENT_MEDIA_FFPROBE_PATH` | an `ffprobe` that is not on `PATH` |
86
+
87
+ Without a timeout override, probes get 30 seconds and encodes get 30 minutes.
55
88
 
56
89
  ## Why this instead of raw FFmpeg MCP wrappers
57
90
 
58
- - **5 semantic workflows** instead of 40+ FFmpeg-shaped tools
59
- - **Verification** — outputs are inspected and checked against plan expectations, not just "exit code 0"
60
- - **Portable plans** — serialize, persist, replay, audit
91
+ - **Semantic workflows** instead of an FFmpeg-shaped tool per flag
92
+ - **Verification** — outputs are re-inspected and checked against plan expectations, not just "exit code 0"
93
+ - **Content checks** — black frames, silence, frozen video, and whether every stream decodes
94
+ - **Portable plans** — serialize, persist, replay, audit; each step records why it exists
95
+ - **Receipts** — a durable record of every run, so a retry skips work that is already correct
61
96
  - **Structured errors** — stable codes with recovery suggestions, not stderr noise
62
97
 
63
98
  ## Documentation
64
99
 
100
+ - [Usage guide](https://github.com/HadiAlMarzooq/agent-media/blob/main/docs/usage.md)
65
101
  - [Full docs](https://github.com/HadiAlMarzooq/agent-media/tree/main/docs)
66
102
  - [Workflows](https://github.com/HadiAlMarzooq/agent-media/blob/main/docs/workflows.md)
67
103
  - [API reference](https://github.com/HadiAlMarzooq/agent-media/blob/main/docs/api.md)
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(plan, await inspectMedia(plan.source.path));
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.0",
3
+ "version": "0.4.1",
4
4
  "description": "MCP server for semantic, replayable, and verified media transformations.",
5
5
  "keywords": [
6
6
  "media",
@@ -39,8 +39,8 @@
39
39
  "dependencies": {
40
40
  "@modelcontextprotocol/sdk": "1.30.0",
41
41
  "zod": "^4.5.4",
42
- "@hadialmarzooq/agent-media-core": "0.3.0",
43
- "@hadialmarzooq/agent-media-ffmpeg": "0.3.0"
42
+ "@hadialmarzooq/agent-media-ffmpeg": "0.4.1",
43
+ "@hadialmarzooq/agent-media-core": "0.3.1"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsup src/index.ts --format esm --dts",