@instavar/mcp-server 0.7.0 → 0.8.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.
Files changed (2) hide show
  1. package/dist/index.js +183 -55
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -250,6 +250,7 @@ function registerPairedAnnouncement(server, options = {}) {
250
250
  description: "Prepare one paired announcement-card-v1 template, continue its caller-held project, edit copy or switch frameworks. Returns source files for local rendering. " + pairedAnnouncementInstructions(options.pairedCatalogue),
251
251
  inputSchema: pairedAnnouncementInput,
252
252
  annotations: {
253
+ title: "Prepare announcement",
253
254
  readOnlyHint: true,
254
255
  destructiveHint: false,
255
256
  openWorldHint: false
@@ -441,6 +442,22 @@ var PAIRED_FONTS = [
441
442
  sha256: "3100e775e8616cd2611beecfa23a4263d7037586789b43f035236a2e6fbd4c62"
442
443
  }
443
444
  ];
445
+ var NO_LOOK = {
446
+ scale: false,
447
+ fill: false,
448
+ surface: false,
449
+ background: false,
450
+ motion: false,
451
+ transition: false
452
+ };
453
+ var FIT_EXPONENT = 0.5;
454
+ var DEFAULT_LOOK = {
455
+ ...NO_LOOK,
456
+ scale: true,
457
+ fill: true,
458
+ surface: true
459
+ };
460
+ var fillScale = (width, height) => height * 9 === width * 16 ? 4 / 3 : height * 4 === width * 5 ? 9 / 8 : 1;
444
461
  var palettes = {
445
462
  "editorial-light": {
446
463
  background: "#f4efe5",
@@ -486,7 +503,7 @@ var escapeHtml = (value) => value.replace(
486
503
  );
487
504
  var str = (value) => typeof value === "string" ? value : "";
488
505
  var div = (className, value, attributes = "") => `<div class="${className}"${attributes}>${escapeHtml(value)}</div>`;
489
- function sceneCss(palette) {
506
+ function sceneCss(palette, look, k, width, height) {
490
507
  const p = palette;
491
508
  const fonts = PAIRED_FONTS.map(
492
509
  (font) => `@font-face{font-family:${font.family};src:url(${font.file}) format('woff2');font-weight:100 900;font-style:normal;unicode-range:${LATIN_RANGE}}`
@@ -535,7 +552,38 @@ function sceneCss(palette) {
535
552
  .window-title{font-size:72px;line-height:1.04;margin-bottom:42px}
536
553
  .window{position:relative;height:66%;overflow:hidden;border-radius:36px;background:${p.surface};box-shadow:0 28px 80px rgba(20,40,58,.14)}
537
554
  .window video{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover}
538
- .scene-label{position:absolute;left:54px;bottom:40px;color:${p.muted};font-family:Inter;font-size:18px}`;
555
+ .scene-label{position:absolute;left:54px;bottom:40px;color:${p.muted};font-family:Inter;font-size:18px}${lookCss(p, look, k, width, height)}`;
556
+ }
557
+ function lookCss(p, look, k, width, height) {
558
+ let css = "";
559
+ if (look.scale)
560
+ css += `
561
+ .hero-sub{font-size:46px}
562
+ .statement-sub,.cta-sub{font-size:42px}
563
+ .mechanism-sub,.points-sub{font-size:40px}
564
+ .point-text{font-size:42px}
565
+ .label,.footer{font-size:32px}
566
+ .state-label{font-size:36px}`;
567
+ if (look.fill && k !== 1)
568
+ css += `
569
+ .fill-box{position:absolute;top:0;left:0;width:${width / k}px;height:${height / k}px;transform:scale(${k});transform-origin:0 0}`;
570
+ if (look.surface)
571
+ css += `
572
+ .statement-card{width:100%;padding:8px 0 8px 52px;border-radius:0;background:none;box-shadow:none;border-left:12px solid ${p.accent}}
573
+ .statement-title{font-size:108px;line-height:1;letter-spacing:-2px}
574
+ .point-list{gap:0;margin-top:58px;border-bottom:2px solid ${p.muted}55}
575
+ .point{background:none;box-shadow:none;border-radius:0;padding:30px 0;border-top:2px solid ${p.muted}55;grid-template-columns:84px 1fr;gap:20px;align-items:baseline}
576
+ .number{width:auto;height:auto;border-radius:0;background:none;justify-content:flex-start;font-family:Fraunces;font-size:64px;font-weight:600;line-height:1}`;
577
+ if (look.background)
578
+ css += `
579
+ .background{background:linear-gradient(158deg,color-mix(in srgb,${p.background} 90%,${p.accentSoft}) 0%,${p.background} 46%,color-mix(in srgb,${p.background} 93%,${p.ink}) 100%)}
580
+ .orb{width:1100px;height:1100px;opacity:.5;background:radial-gradient(closest-side,${p.accentSoft} 0%,${p.accentSoft}00 100%);right:-420px;top:-420px}
581
+ .ring{display:none}
582
+ .bg-v1 .orb{right:auto;left:-460px;top:auto;bottom:-380px}
583
+ .bg-v2 .orb{right:-520px;top:30%}
584
+ .bg-v3 .orb{right:auto;left:-420px;top:-360px}
585
+ .grain{position:absolute;inset:0;opacity:.07;mix-blend-mode:overlay;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.4 -.2'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>")}`;
586
+ return css;
539
587
  }
540
588
  function title(content, className, fit = "") {
541
589
  return div(
@@ -556,14 +604,27 @@ function label(content) {
556
604
  const value = str(content.label);
557
605
  return value ? div("label", value) : "";
558
606
  }
559
- function sceneBody(scene, id2, seconds) {
607
+ function sceneBody(scene, id2, seconds, look, k) {
608
+ const fit = (width, cap) => ` data-fit="${k === 1 ? width : Math.round(width / k ** FIT_EXPONENT * 10) / 10},${cap}"`;
560
609
  const c = scene.content;
561
610
  switch (scene.kind) {
562
611
  case "hero":
612
+ if (look.motion)
613
+ return `<div class="accent-bar" data-motion="bar"></div><div><div data-motion="rise" data-rise="42">${title(
614
+ c,
615
+ "hero-title",
616
+ fit(885.6, 126)
617
+ )}</div><div data-motion="rise" data-rise="18" data-delay="5">${subtitle(
618
+ c,
619
+ "hero-sub"
620
+ )}</div></div><div data-motion="fade" data-delay="10">${div(
621
+ "footer",
622
+ str(c.footer)
623
+ )}</div>`;
563
624
  return `<div class="accent-bar" data-motion="bar"></div><div data-motion="rise" data-rise="42">${title(
564
625
  c,
565
626
  "hero-title",
566
- ' data-fit="885.6,126"'
627
+ fit(885.6, 126)
567
628
  )}${subtitle(c, "hero-sub")}</div>${div("footer", str(c.footer))}`;
568
629
  case "statement":
569
630
  case "custom":
@@ -591,9 +652,12 @@ function sceneBody(scene, id2, seconds) {
591
652
  return `<div class="points-head">${label(c)}${title(
592
653
  c,
593
654
  "points-title",
594
- ' data-fit="850,98"'
655
+ fit(850, 98)
595
656
  )}${pointsSubtitle(c)}</div><div class="point-list">${points.map(
596
- (point2, index) => `<div class="point" data-motion="rise" data-rise="28" data-delay="${index * 6}">${div("number", String(index + 1))}${div(
657
+ (point2, index) => look.motion ? `<div class="point" data-motion="fade" data-delay="${index * 6}"><div data-motion="pop" data-delay="${index * 6}">${div(
658
+ "number",
659
+ String(index + 1)
660
+ )}</div><div data-motion="slide" data-delay="${index * 6 + 2}">${div("point-text", point2)}</div></div>` : `<div class="point" data-motion="rise" data-rise="28" data-delay="${index * 6}">${div("number", String(index + 1))}${div(
597
661
  "point-text",
598
662
  point2
599
663
  )}</div>`
@@ -620,7 +684,7 @@ function sceneBody(scene, id2, seconds) {
620
684
  )}${subtitle(c, "cta-sub")}`;
621
685
  }
622
686
  }
623
- function sceneScript(id2, seconds, fps) {
687
+ function sceneScript(id2, seconds, fps, look, exit) {
624
688
  const samples = springSamples(fps);
625
689
  const span = samples.length - 1;
626
690
  return `(async()=>{
@@ -633,22 +697,26 @@ const tl=gsap.timeline({paused:true});
633
697
  tl.to({},{duration:${seconds}},0);
634
698
  const spring={duration:${span / fps},ease:t=>enter(t*${span}),force3D:false};
635
699
  root.querySelectorAll('[data-motion="rise"]').forEach(e=>tl.fromTo(e,{opacity:0,y:Number(e.dataset.rise)},{opacity:1,y:0,...spring},Number(e.dataset.delay||0)/${fps}));
636
- root.querySelectorAll('[data-motion="fade"]').forEach(e=>tl.fromTo(e,{opacity:0},{opacity:1,...spring},0));
700
+ root.querySelectorAll('[data-motion="fade"]').forEach(e=>tl.fromTo(e,{opacity:0},{opacity:1,...spring},${look.motion ? "Number(e.dataset.delay||0)/" + fps : "0"}));
637
701
  root.querySelectorAll('[data-motion="bar"]').forEach(e=>tl.fromTo(e,{scaleX:0},{scaleX:1,...spring},0));
638
- root.querySelectorAll('[data-motion="pop"]').forEach(e=>tl.fromTo(e,{scale:0},{scale:1,...spring},0));
702
+ root.querySelectorAll('[data-motion="pop"]').forEach(e=>tl.fromTo(e,{scale:0},{scale:1,...spring},${look.motion ? "Number(e.dataset.delay||0)/" + fps : "0"}));
639
703
  const calm={duration:1.95,ease:'power1.inOut',force3D:false};
640
704
  root.querySelectorAll('[data-motion="before"]').forEach(e=>tl.fromTo(e,{scaleX:1},{scaleX:0.66,...calm},0.45));
641
705
  root.querySelectorAll('[data-motion="after"]').forEach(e=>tl.fromTo(e,{scaleX:0.45},{scaleX:0.25,...calm},0.45));
642
706
  root.querySelectorAll('[data-motion="arrow"]').forEach(e=>tl.fromTo(e,{x:-14},{x:14,...calm},0.45));
643
- window.__timelines=window.__timelines||{};window.__timelines[${JSON.stringify(
707
+ ${look.motion ? `const at=e=>Number(e.dataset.delay||0)/${fps};
708
+ root.querySelectorAll('[data-motion="slide"]').forEach(e=>tl.fromTo(e,{opacity:0,x:36},{opacity:1,x:0,...spring},at(e)));
709
+ root.querySelectorAll('.orb').forEach(e=>tl.fromTo(e,{x:0,y:0},{x:-40,y:28,duration:${seconds},ease:'none',force3D:false},0));` : ""}${exit ? `tl.fromTo(root.querySelector('.layout'),{opacity:1},{opacity:0,duration:${6 / fps},ease:'power2.in',immediateRender:false},${seconds - 6 / fps});` : ""}window.__timelines=window.__timelines||{};window.__timelines[${JSON.stringify(
644
710
  id2
645
711
  )}]=tl;window.__hfForceTimelineRebind?.();
646
712
  })();`;
647
713
  }
648
- function hyperframesVideoSpecFiles(spec, timeline) {
714
+ function hyperframesVideoSpecFiles(spec, timeline, look = DEFAULT_LOOK) {
649
715
  const palette = paletteFor(spec);
650
- const css = sceneCss(palette);
651
716
  const { fps, width, height } = timeline;
717
+ const k = look.fill ? fillScale(width, height) : 1;
718
+ const css = sceneCss(palette, look, k, width, height);
719
+ const visible = timeline.scenes.filter((entry) => entry.visibleFrames > 0);
652
720
  const total = timeline.durationInFrames / fps;
653
721
  const files = {};
654
722
  const hosts = [];
@@ -657,7 +725,8 @@ function hyperframesVideoSpecFiles(spec, timeline) {
657
725
  const scene = spec.scenes[entry.index];
658
726
  const id2 = `scene-${entry.index + 1}`;
659
727
  const seconds = entry.visibleFrames / fps;
660
- const body = `<div class="fill background"><div class="orb" data-layout-allow-overflow></div><div class="ring" data-layout-allow-overflow></div></div><div class="fill layout ${scene.kind}">${sceneBody(scene, id2, seconds)}</div>${spec.style.showSceneLabels ? div("scene-label", scene.kind) : ""}`;
728
+ const boxed = look.fill && k !== 1;
729
+ const body = `<div class="fill background${look.background ? ` bg-v${entry.index % 4}` : ""}"><div class="orb" data-layout-allow-overflow></div><div class="ring" data-layout-allow-overflow></div>${look.background ? '<div class="grain"></div>' : ""}</div>${boxed ? '<div class="fill-box">' : ""}<div class="fill layout ${scene.kind}">${sceneBody(scene, id2, seconds, look, k)}</div>${boxed ? "</div>" : ""}${spec.style.showSceneLabels ? div("scene-label", scene.kind) : ""}`;
661
730
  files[`compositions/${id2}.html`] = `<template><style>${css}
662
731
  #${id2}{position:absolute;inset:0;width:100%;height:100%;overflow:hidden}
663
732
  #${id2},#${id2} *{text-rendering:auto}</style><div id="${id2}" data-composition-id="${id2}" data-scene-id="${escapeHtml(
@@ -665,7 +734,9 @@ function hyperframesVideoSpecFiles(spec, timeline) {
665
734
  )}" data-start="0" data-duration="${seconds}" data-width="${width}" data-height="${height}">${body}</div><script>${sceneScript(
666
735
  id2,
667
736
  seconds,
668
- fps
737
+ fps,
738
+ look,
739
+ look.transition && entry !== visible[visible.length - 1]
669
740
  )}</script></template>
670
741
  `;
671
742
  hosts.push(
@@ -696,7 +767,9 @@ ${hosts.join("\n")}
696
767
  </body></html>
697
768
  `;
698
769
  files["video.json"] = JSON.stringify(spec, null, 2) + "\n";
699
- files["hyperframes.json"] = JSON.stringify({ authoringSkill: "general-video" }, null, 2) + "\n";
770
+ files["hyperframes.json"] = // A usage-attribution label only. HyperFrames 0.9.19 lists "general-video"
771
+ // as retired in favour of "hyperframes"; change it with the version.
772
+ JSON.stringify({ authoringSkill: "general-video" }, null, 2) + "\n";
700
773
  files["package.json"] = JSON.stringify(
701
774
  {
702
775
  private: true,
@@ -707,7 +780,7 @@ ${hosts.join("\n")}
707
780
  preview: "hyperframes preview",
708
781
  // Extract source video frames as PNG. The default JPEG extraction
709
782
  // re-subsamples chroma and leaves 1:1 windows of saturated footage
710
- // just under the similarity floor; under HyperFrames 0.8.143 PNG
783
+ // just under the similarity floor; since HyperFrames 0.8.143 PNG
711
784
  // extraction no longer darkens BT.709 footage.
712
785
  render: `hyperframes render --fps ${fps} --video-frame-format png --output video.mp4`
713
786
  },
@@ -747,7 +820,7 @@ await import("./preflight.mjs");
747
820
  // src/paired-templates/remotion-videospec.ts
748
821
  var REMOTION_TEMPLATES = {
749
822
  repository: "https://github.com/instavar/remotion-templates",
750
- commit: "a9092254937d28a05a277a9b6ecfd4ebea864245",
823
+ commit: "d50166d84a75bdc0585897dc78316d6c6f6588ff",
751
824
  remotion: "4.0.502"
752
825
  };
753
826
  function remotionVideoSpecFiles(spec, timeline) {
@@ -1405,6 +1478,7 @@ function registerPairedTemplates(server) {
1405
1478
  description: "Validate one VideoSpec against the paired template contract and return local source for the chosen framework, or switch an existing project's framework. " + PAIRED_TEMPLATE_INSTRUCTIONS,
1406
1479
  inputSchema: prepareVideoTemplateInput,
1407
1480
  annotations: {
1481
+ title: "Prepare video template",
1408
1482
  readOnlyHint: true,
1409
1483
  destructiveHint: false,
1410
1484
  openWorldHint: false
@@ -1509,6 +1583,7 @@ function registerCreativeGuides(server) {
1509
1583
  guideId: creativeGuideIdSchema.optional().describe("Guide to read. Omit to list the guides.")
1510
1584
  },
1511
1585
  annotations: {
1586
+ title: "Get creative guide",
1512
1587
  readOnlyHint: true,
1513
1588
  destructiveHint: false,
1514
1589
  openWorldHint: false
@@ -2288,6 +2363,16 @@ function result(value, summary) {
2288
2363
  content: [{ type: "text", text: summary }]
2289
2364
  };
2290
2365
  }
2366
+ function withStructuredContentText(value) {
2367
+ if (value.isError || value.structuredContent === void 0) return value;
2368
+ return {
2369
+ ...value,
2370
+ content: [
2371
+ ...value.content,
2372
+ { type: "text", text: JSON.stringify(value.structuredContent) }
2373
+ ]
2374
+ };
2375
+ }
2291
2376
  function slugify(value) {
2292
2377
  const slug = value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 72);
2293
2378
  return slug.length >= 3 ? slug : "new-video";
@@ -2704,12 +2789,12 @@ function runGetExampleTool(args, paired) {
2704
2789
  `Example VideoSpec for ${args.templateId}.`
2705
2790
  );
2706
2791
  }
2707
- function runGetRenderInstructionsTool(args) {
2792
+ function runGetRenderInstructionsTool(args, options = {}) {
2708
2793
  const commands = [
2709
2794
  `git clone ${TEMPLATE_REPOSITORY}.git`,
2710
2795
  "cd remotion-templates",
2711
2796
  "npm install",
2712
- `# Generate narration at ${VOICE_STUDIO_URL}, with one paragraph per scene`,
2797
+ options.voiceStudio === false ? "# Optional: save your own narration recording as public/generated/narration.wav, with one paragraph per scene" : `# Generate narration at ${VOICE_STUDIO_URL}, with one paragraph per scene`,
2713
2798
  "npm run video:timing -- path/to/video.video.json --audio public/generated/narration.wav --manifest path/to/narration.timing.json",
2714
2799
  "npm run video:validate -- path/to/video.video.json",
2715
2800
  "npm run video:preview -- path/to/video.video.json",
@@ -2763,6 +2848,7 @@ var READ_ONLY_ANNOTATIONS = {
2763
2848
  function registerSharedTemplateTools(server, options) {
2764
2849
  const paired = options.pairedTemplates;
2765
2850
  const meta = (name) => options.toolMeta ? { _meta: options.toolMeta(name) } : {};
2851
+ const send = (name, value) => options.jsonTextTools?.has(name) ? withStructuredContentText(value) : value;
2766
2852
  const catalogue = paired ? "video" : "Remotion";
2767
2853
  server.registerTool(
2768
2854
  "list_carousel_templates",
@@ -2776,7 +2862,7 @@ function registerSharedTemplateTools(server, options) {
2776
2862
  },
2777
2863
  ...meta("list_carousel_templates")
2778
2864
  },
2779
- async () => runListCarouselTemplatesTool()
2865
+ async () => send("list_carousel_templates", runListCarouselTemplatesTool())
2780
2866
  );
2781
2867
  server.registerTool(
2782
2868
  "get_carousel_schema",
@@ -2787,7 +2873,7 @@ function registerSharedTemplateTools(server, options) {
2787
2873
  annotations: { title: "Get carousel schema", ...READ_ONLY_ANNOTATIONS },
2788
2874
  ...meta("get_carousel_schema")
2789
2875
  },
2790
- async () => runGetCarouselSchemaTool()
2876
+ async () => send("get_carousel_schema", runGetCarouselSchemaTool())
2791
2877
  );
2792
2878
  server.registerTool(
2793
2879
  "scaffold_carousel_deck",
@@ -2814,7 +2900,7 @@ function registerSharedTemplateTools(server, options) {
2814
2900
  },
2815
2901
  ...meta("scaffold_carousel_deck")
2816
2902
  },
2817
- async (args) => runScaffoldCarouselDeckTool(args)
2903
+ async (args) => send("scaffold_carousel_deck", runScaffoldCarouselDeckTool(args))
2818
2904
  );
2819
2905
  server.registerTool(
2820
2906
  "list_templates",
@@ -2829,7 +2915,7 @@ function registerSharedTemplateTools(server, options) {
2829
2915
  annotations: { title: "List templates", ...READ_ONLY_ANNOTATIONS },
2830
2916
  ...meta("list_templates")
2831
2917
  },
2832
- async (args) => runListTemplatesTool(args, paired)
2918
+ async (args) => send("list_templates", runListTemplatesTool(args, paired))
2833
2919
  );
2834
2920
  server.registerTool(
2835
2921
  "get_template",
@@ -2844,7 +2930,7 @@ function registerSharedTemplateTools(server, options) {
2844
2930
  annotations: { title: "Get template", ...READ_ONLY_ANNOTATIONS },
2845
2931
  ...meta("get_template")
2846
2932
  },
2847
- async (args) => runGetTemplateTool(args, paired)
2933
+ async (args) => send("get_template", runGetTemplateTool(args, paired))
2848
2934
  );
2849
2935
  server.registerTool(
2850
2936
  "get_video_schema",
@@ -2855,7 +2941,7 @@ function registerSharedTemplateTools(server, options) {
2855
2941
  annotations: { title: "Get video schema", ...READ_ONLY_ANNOTATIONS },
2856
2942
  ...meta("get_video_schema")
2857
2943
  },
2858
- async () => runGetVideoSchemaTool()
2944
+ async () => send("get_video_schema", runGetVideoSchemaTool())
2859
2945
  );
2860
2946
  server.registerTool(
2861
2947
  "get_example",
@@ -2870,7 +2956,7 @@ function registerSharedTemplateTools(server, options) {
2870
2956
  annotations: { title: "Get example", ...READ_ONLY_ANNOTATIONS },
2871
2957
  ...meta("get_example")
2872
2958
  },
2873
- async (args) => runGetExampleTool(args, paired)
2959
+ async (args) => send("get_example", runGetExampleTool(args, paired))
2874
2960
  );
2875
2961
  server.registerTool(
2876
2962
  "propose_video_storyboard",
@@ -2890,7 +2976,7 @@ function registerSharedTemplateTools(server, options) {
2890
2976
  body: z5.string().min(1).max(2e3).optional().describe("Accepted body copy, kept exactly as supplied."),
2891
2977
  cta: z5.string().min(1).max(500).optional().describe("Accepted call to action, kept exactly as supplied."),
2892
2978
  acceptedDesign: acceptedDesignSchema.optional().describe(
2893
- "The design the user accepted: style, duration in seconds, audio, illustration and exclusions. Pass it on to scaffold_video_spec and hosted tools."
2979
+ "The design the user accepted: style, duration in seconds, audio, illustration and exclusions. Pass it on to scaffold_video_spec and later steps."
2894
2980
  ),
2895
2981
  aspect: aspectSchema.default("9:16").describe("Output aspect ratio. Defaults to 9:16.")
2896
2982
  },
@@ -2900,7 +2986,10 @@ function registerSharedTemplateTools(server, options) {
2900
2986
  },
2901
2987
  ...meta("propose_video_storyboard")
2902
2988
  },
2903
- async (args) => runProposeVideoStoryboardTool(args, options.acceptedPreview)
2989
+ async (args) => send(
2990
+ "propose_video_storyboard",
2991
+ runProposeVideoStoryboardTool(args, options.acceptedPreview)
2992
+ )
2904
2993
  );
2905
2994
  server.registerTool(
2906
2995
  "scaffold_video_spec",
@@ -2932,7 +3021,10 @@ function registerSharedTemplateTools(server, options) {
2932
3021
  annotations: { title: "Scaffold video spec", ...READ_ONLY_ANNOTATIONS },
2933
3022
  ...meta("scaffold_video_spec")
2934
3023
  },
2935
- async (args) => runScaffoldVideoSpecTool(args, paired, options.acceptedPreview)
3024
+ async (args) => send(
3025
+ "scaffold_video_spec",
3026
+ runScaffoldVideoSpecTool(args, paired, options.acceptedPreview)
3027
+ )
2936
3028
  );
2937
3029
  server.registerTool(
2938
3030
  "get_render_instructions",
@@ -2950,7 +3042,10 @@ function registerSharedTemplateTools(server, options) {
2950
3042
  },
2951
3043
  ...meta("get_render_instructions")
2952
3044
  },
2953
- async (args) => runGetRenderInstructionsTool(args)
3045
+ async (args) => send(
3046
+ "get_render_instructions",
3047
+ runGetRenderInstructionsTool(args, { voiceStudio: options.voiceStudio })
3048
+ )
2954
3049
  );
2955
3050
  server.registerTool(
2956
3051
  "diagnose_render_error",
@@ -2963,7 +3058,7 @@ function registerSharedTemplateTools(server, options) {
2963
3058
  annotations: { title: "Diagnose render error", ...READ_ONLY_ANNOTATIONS },
2964
3059
  ...meta("diagnose_render_error")
2965
3060
  },
2966
- async (args) => runDiagnoseRenderErrorTool(args)
3061
+ async (args) => send("diagnose_render_error", runDiagnoseRenderErrorTool(args))
2967
3062
  );
2968
3063
  }
2969
3064
 
@@ -4177,30 +4272,20 @@ function registerTools(server) {
4177
4272
  "publish_job",
4178
4273
  {
4179
4274
  title: "Publish job",
4180
- description: "Publish an APPROVED job to its connected social destination via the gated publish API. All production gates run (paid plan, ownership, abuse, QA, disclosure, destination, rights, moderation). Requires a key with publish scope; the post goes live on the external platform and cannot be recalled by the API. For YouTube pass youtubePrivacyStatus:'private' for safe runs.",
4275
+ description: "Publish an APPROVED job to one connected social account. The user must approve each post in Instavar Studio: the first call returns a link and code that show them the exact account, text, video and visibility. Show the link to the user, wait for them to approve, then call again with the returned confirmationId. Nothing is posted until the user approves, and only the user can approve. All production gates still run; the post goes live and cannot be recalled by the API. LinkedIn, X, YouTube, Facebook, Instagram and Threads; TikTok posts are made in Instavar Studio. Requires a key with publish scope.",
4181
4276
  inputSchema: z8.object({
4182
4277
  jobId: uuid("The approved job to publish"),
4183
- xPreviewArtifactId: z8.string().min(1).optional().describe("X only. Exact reviewed video artifact ID."),
4184
- xCaption: z8.string().trim().min(1).max(2e3).optional().describe("X only. Exact post text approved by the user."),
4185
- xMadeWithAi: z8.boolean().optional().describe("X only. Enable the Made with AI disclosure."),
4186
- confirmXPublicPost: z8.boolean().optional().describe(
4187
- "True only after the user authorizes this public X post."
4188
- ),
4189
- confirmXAutomationPolicy: z8.boolean().optional().describe(
4190
- "True only after the user confirms the X automation policy."
4278
+ confirmationId: z8.string().uuid().optional().describe(
4279
+ "The confirmationId from an earlier publish_job reply, after the user approved in Instavar Studio."
4191
4280
  ),
4192
- confirmXOriginalContent: z8.boolean().optional().describe(
4193
- "True only after the user confirms ownership or publishing rights."
4194
- ),
4195
- youtubePrivacyStatus: z8.enum(["private", "unlisted", "public"]).optional().describe("YouTube only. Use 'private' for safe dogfood runs."),
4196
- tiktokPostMode: z8.enum(["direct_publish", "draft_upload"]).optional().describe("TikTok only. Use 'draft_upload' for safe dogfood runs."),
4197
4281
  connectedAccountDestinationId: z8.string().uuid().optional().describe(
4198
4282
  "Specific destination when the org has multiple accounts for the provider."
4199
4283
  ),
4200
- confirmSyntheticDisclosure: z8.boolean().optional().describe(
4201
- "Set true when the job requires an AI synthetic-media disclosure."
4202
- ),
4203
- confirmQaOverride: z8.boolean().optional().describe("Set true to override a non-passing QA gate.")
4284
+ xCaption: z8.string().trim().min(1).max(2e3).optional().describe("X only. The post text to show the user for approval."),
4285
+ xMadeWithAi: z8.boolean().optional().describe("X only. Turn on the Made with AI label."),
4286
+ youtubePrivacyStatus: z8.enum(["private", "unlisted", "public"]).optional().describe(
4287
+ "YouTube only. Must match the channel's saved privacy setting; use 'private' for safe dogfood runs."
4288
+ )
4204
4289
  }).strict(),
4205
4290
  annotations: {
4206
4291
  readOnlyHint: false,
@@ -4210,11 +4295,54 @@ function registerTools(server) {
4210
4295
  openWorldHint: true
4211
4296
  }
4212
4297
  },
4213
- async ({ jobId, ...rest }) => (
4214
- // NOTE: publish is NOT under /api/v1 — it is the gated /api/jobs route.
4215
- runTool(
4216
- () => apiPost(`/api/jobs/${encodeURIComponent(jobId)}/publish`, rest)
4217
- )
4298
+ async ({ jobId, confirmationId, youtubePrivacyStatus, ...target }) => (
4299
+ // This package runs on the user's machine, so it never records an
4300
+ // approval itself: the user approves on the signed-in Studio page and
4301
+ // the publish route consumes that server-side confirmation.
4302
+ runTool(async () => {
4303
+ const loaded = confirmationId ? await apiGet(
4304
+ `/api/v1/publish-confirmations/${encodeURIComponent(
4305
+ confirmationId
4306
+ )}`
4307
+ ) : await apiPost(
4308
+ `/api/v1/jobs/${encodeURIComponent(jobId)}/publish-confirmations`,
4309
+ target
4310
+ );
4311
+ const view = loaded.body;
4312
+ if (!loaded.ok || !view?.confirmationId || !view.content) return loaded;
4313
+ if (view.content.jobId !== jobId) {
4314
+ return {
4315
+ ok: false,
4316
+ status: 409,
4317
+ body: {
4318
+ posted: false,
4319
+ error: "That confirmation is for a different video. Call publish_job again without confirmationId."
4320
+ }
4321
+ };
4322
+ }
4323
+ if (view.status === "approved") {
4324
+ return apiPost(`/api/jobs/${encodeURIComponent(jobId)}/publish`, {
4325
+ publishConfirmationId: view.confirmationId,
4326
+ provider: view.content.platform,
4327
+ connectedAccountDestinationId: view.content.destinationId,
4328
+ expectedVideoArtifactId: view.content.videoArtifactId,
4329
+ youtubePrivacyStatus: view.content.platform === "youtube" ? youtubePrivacyStatus : void 0
4330
+ });
4331
+ }
4332
+ const message = view.status === "pending" ? `Nothing was posted yet. Ask the user to open ${view.approveUrl} in a browser signed in to Instavar, check the code ${view.userCode} matches, and approve the post to ${view.content.platformName} account ${view.content.accountName}. Then call publish_job again with confirmationId ${view.confirmationId}. Only the user can approve; do not approve on their behalf. The request expires at ${view.expiresAt}.` : view.status === "used" ? "Nothing new was posted: this approval was already used for one post." : view.status === "expired" ? "Nothing was posted: the approval request expired. Call publish_job again without confirmationId." : "Nothing was posted: the user declined this post.";
4333
+ return {
4334
+ ok: true,
4335
+ status: 200,
4336
+ body: {
4337
+ posted: false,
4338
+ status: view.status,
4339
+ confirmationId: view.confirmationId,
4340
+ approveUrl: view.approveUrl,
4341
+ userCode: view.userCode,
4342
+ message
4343
+ }
4344
+ };
4345
+ })
4218
4346
  )
4219
4347
  );
4220
4348
  server.registerTool(
@@ -4272,7 +4400,7 @@ function registerConfiguredTools(server, apiKey = process.env.INSTAVAR_API_KEY)
4272
4400
  // package.json
4273
4401
  var package_default = {
4274
4402
  name: "@instavar/mcp-server",
4275
- version: "0.7.0",
4403
+ version: "0.8.0",
4276
4404
  mcpName: "com.instavar/mcp-server",
4277
4405
  description: "Make local videos with Instavar templates for Remotion or HyperFrames for free, then add an API key for hosted Studio workflows.",
4278
4406
  type: "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instavar/mcp-server",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "mcpName": "com.instavar/mcp-server",
5
5
  "description": "Make local videos with Instavar templates for Remotion or HyperFrames for free, then add an API key for hosted Studio workflows.",
6
6
  "type": "module",