aimakeall-mcp 0.1.0 → 0.2.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 CHANGED
@@ -16,7 +16,7 @@ Claude Code·Codex 같은 MCP 클라이언트에서 자연어로 AImakeAll 영
16
16
  "mcpServers": {
17
17
  "aimakeall": {
18
18
  "command": "npx",
19
- "args": ["-y", "aimakeall-mcp@0.1.0"],
19
+ "args": ["-y", "aimakeall-mcp@0.2.0"],
20
20
  "env": { "AIMAKEALL_PAT": "aio_pat_..." }
21
21
  }
22
22
  }
@@ -129,7 +129,7 @@ export function registerCloudTools(server, config, api) {
129
129
  {
130
130
  topic: z.string().optional().describe("영상 주제"),
131
131
  copy: z.string().optional().describe("핵심 카피/대사"),
132
- categoryId: z.enum(["community-shorts", "viral-shorts"]).optional().describe("기본 community-shorts"),
132
+ categoryId: z.enum(["community-shorts", "viral-shorts", "insight"]).optional().describe("기본 community-shorts. insight=명언(통찰) 쇼츠"),
133
133
  targetCustomer: z.string().optional(),
134
134
  tone: z.string().optional().describe("기본 '자동 추천'"),
135
135
  sceneCount: z.number().int().min(1).max(10).optional().describe("기본 3"),
@@ -496,7 +496,7 @@ export function registerCloudTools(server, config, api) {
496
496
  endSec: z.number(),
497
497
  startSec: z.number(),
498
498
  text: z.string(),
499
- })).optional().describe("자막 타이밍 (쇼츠)"),
499
+ })).optional().describe("자막 타이밍 (쇼츠 하단자막) — tts_narration_with_captions의 subtitleLines를 그대로 사용"),
500
500
  transitionMode: z.enum(["fade", "none"]).optional().describe("기본 fade"),
501
501
  },
502
502
  wrapCloudHandler(config, async ({ sceneVideos, featureKey = "commerceVideo", projectTitle = "aimakeall-mcp", aspectRatio = "9:16", ttsAudioPath = "", bgmAudioPath = "", audioDurationSec = 0, bgmVolume = null, muteVideoAudio = true, titleText = "", subtitleLines = [], transitionMode = "fade" }) => {
@@ -641,4 +641,362 @@ export function registerCloudTools(server, config, api) {
641
641
  });
642
642
  }),
643
643
  );
644
+
645
+ // ── 대본(Script Studio) — 스타일별 지침 자동 적용 ────────────────────────────
646
+ server.tool(
647
+ "write_script",
648
+ "대본을 생성합니다 (스크립트 스튜디오). 스타일별 전용 지침이 자동 적용됩니다: standard(스탠다드)/senior(시니어)/insight(명언·통찰)/webnovel(웹소설)/christian(기독교)/community-shorts/viral-shorts. 스탠다드·시니어·명언은 실시간 리서치가 함께 수행됩니다. 부동산·상권 분석 대본은 전용 도구(write_real_estate_report/write_market_analysis)를 쓰세요.",
649
+ {
650
+ title: z.string().describe("영상 제목/주제"),
651
+ storyText: z.string().optional().describe("핵심 줄거리·내용 브리프"),
652
+ styleId: z.enum(["standard", "senior", "insight", "webnovel", "christian", "community-shorts", "viral-shorts"]).optional().describe("기본 standard. senior=시니어(쉽고 친절), insight=명언(통찰)"),
653
+ model: z.enum(["gemini", "opus", "sonnet"]).optional().describe("기본 gemini(가성비). opus/sonnet=Claude"),
654
+ targetLength: z.number().int().min(500).max(20000).optional().describe("목표 글자수, 기본 5000"),
655
+ targetLanguageLabel: z.string().optional().describe("출력 언어 라벨, 기본 '한국 (한국어)'"),
656
+ contentFormat: z.enum(["longform", "shortform"]).optional().describe("기본 longform (standard/senior/insight는 항상 longform)"),
657
+ webnovelSubtypeId: z.enum(["modern-webnovel", "regression-fantasy", "romance-fantasy", "martial-arts", "light-novel", "hunter-fantasy", "revenge-soda", "healing-daily", "relationship-drama", "literary-serial"]).optional().describe("styleId=webnovel일 때 장르"),
658
+ christianContentType: z.enum(["youtube-narration", "prayer", "devotional", "comfort-message"]).optional().describe("styleId=christian일 때 유형"),
659
+ insightFigureNames: z.string().optional().describe("styleId=insight일 때 인물명(쉼표 구분)"),
660
+ userOpinion: z.string().optional().describe("본문에 자연스럽게 녹일 작성자 의견"),
661
+ },
662
+ wrapCloudHandler(config, async ({
663
+ title,
664
+ storyText = "",
665
+ styleId = "standard",
666
+ model = "gemini",
667
+ targetLength = 5000,
668
+ targetLanguageLabel = "한국 (한국어)",
669
+ contentFormat = "longform",
670
+ webnovelSubtypeId = "modern-webnovel",
671
+ christianContentType = "youtube-narration",
672
+ insightFigureNames = "",
673
+ userOpinion = "",
674
+ }) => {
675
+ const SCRIPT_MODEL_MAP = { gemini: "gemini-3.5-flash", opus: "claude-opus-4-8", sonnet: "claude-sonnet-5" };
676
+ const payload = await api.request("/api/tracker/ai/script", {
677
+ body: {
678
+ apiModel: SCRIPT_MODEL_MAP[model] || SCRIPT_MODEL_MAP.gemini,
679
+ channelStyleProfile: null,
680
+ channelStyleReferenceText: "",
681
+ christianContentType,
682
+ contentFormat,
683
+ generationIntent: "new",
684
+ insightFigureMode: insightFigureNames.trim() ? "blend" : "auto",
685
+ insightFigureNames,
686
+ insightToneMode: "warm",
687
+ modelKey: model,
688
+ personas: [],
689
+ previousScript: "",
690
+ selectedStyleId: styleId,
691
+ storyMemory: null,
692
+ storyText,
693
+ targetLanguageLabel,
694
+ targetLength,
695
+ title,
696
+ userOpinion,
697
+ webnovelSubtypeId,
698
+ },
699
+ method: "POST",
700
+ timeoutMs: 240_000,
701
+ });
702
+ const text = String(payload?.text || "").trim();
703
+ if (!text) return textResult("대본 생성 결과가 비어 있습니다. 제목/브리프를 보강해 다시 시도하세요.", { isError: true });
704
+ return jsonResult({ model: payload?.model, styleId, text });
705
+ }),
706
+ );
707
+
708
+ server.tool(
709
+ "write_real_estate_report",
710
+ "부동산(아파트/빌라/지역) 종합분석 나레이션 대본을 생성합니다 (Gemini 검색 리서치 기반). primaryTarget/region/title/storyText 중 하나 이상은 필수입니다.",
711
+ {
712
+ analysisType: z.enum(["apartment-report", "region-recommend", "comparison", "price-check", "outlook", "policy", "villa", "fact-check"]).optional().describe("기본 apartment-report"),
713
+ primaryTarget: z.string().optional().describe("주요 대상 단지/지역"),
714
+ secondaryTarget: z.string().optional().describe("비교 대상 (analysisType=comparison이면 필수)"),
715
+ region: z.string().optional().describe("지역/생활권"),
716
+ title: z.string().optional().describe("브리프 제목"),
717
+ storyText: z.string().optional().describe("핵심 브리프"),
718
+ purpose: z.enum(["investment", "owner-occupancy", "move-up", "verification"]).optional().describe("기본 investment"),
719
+ budget: z.string().optional().describe("예산/가격대"),
720
+ notes: z.string().optional(),
721
+ targetLength: z.number().int().min(500).max(20000).optional().describe("목표 글자수, 기본 5000"),
722
+ targetLanguageLabel: z.string().optional().describe("기본 '한국 (한국어)'"),
723
+ },
724
+ wrapCloudHandler(config, async ({ analysisType = "apartment-report", primaryTarget = "", secondaryTarget = "", region = "", title = "", storyText = "", purpose = "investment", budget = "", notes = "", targetLength = 5000, targetLanguageLabel = "한국 (한국어)" }) => {
725
+ if (![primaryTarget, region, title, storyText].some((value) => String(value).trim())) {
726
+ return textResult("primaryTarget/region/title/storyText 중 하나는 입력해야 합니다.", { isError: true });
727
+ }
728
+ if (analysisType === "comparison" && !String(secondaryTarget).trim()) {
729
+ return textResult("analysisType=comparison에는 secondaryTarget(비교 대상)이 필수입니다.", { isError: true });
730
+ }
731
+ const payload = await api.request("/api/tracker/ai/real-estate-report", {
732
+ body: {
733
+ analysisType,
734
+ apiModel: "gemini-3.5-flash",
735
+ budget,
736
+ channelStyleProfile: null,
737
+ channelStyleReferenceText: "",
738
+ modelKey: "gemini",
739
+ notes,
740
+ personas: [],
741
+ primaryTarget,
742
+ purpose,
743
+ region,
744
+ secondaryTarget,
745
+ storyText,
746
+ targetLanguageLabel,
747
+ targetLength,
748
+ title,
749
+ },
750
+ method: "POST",
751
+ timeoutMs: 240_000,
752
+ });
753
+ const text = String(payload?.text || "").trim();
754
+ if (!text) return textResult("부동산 분석 대본 결과가 비어 있습니다.", { isError: true });
755
+ return jsonResult({ analysisType, model: payload?.model, researchQueries: payload?.research?.performedQueryCount, text });
756
+ }),
757
+ );
758
+
759
+ server.tool(
760
+ "write_market_analysis",
761
+ "상권 분석 나레이션 대본을 생성합니다 (Gemini 검색 리서치 기반). primaryTarget/businessType/title/storyText 중 하나 이상은 필수입니다.",
762
+ {
763
+ analysisType: z.string().optional().describe("기본 commercial-district-report"),
764
+ primaryTarget: z.string().optional().describe("주요 상권/지역"),
765
+ secondaryTarget: z.string().optional().describe("비교 상권 (comparison이면 필수)"),
766
+ businessType: z.string().optional().describe("업종/업태 (예: 카페, 편의점)"),
767
+ title: z.string().optional().describe("브리프 제목"),
768
+ storyText: z.string().optional().describe("핵심 브리프"),
769
+ purpose: z.enum(["startup", "investment", "site-selection", "verification"]).optional().describe("기본 startup"),
770
+ budget: z.string().optional().describe("예산/운영 여력"),
771
+ notes: z.string().optional(),
772
+ targetLength: z.number().int().min(500).max(20000).optional().describe("목표 글자수, 기본 5000"),
773
+ targetLanguageLabel: z.string().optional().describe("기본 '한국 (한국어)'"),
774
+ },
775
+ wrapCloudHandler(config, async ({ analysisType = "commercial-district-report", primaryTarget = "", secondaryTarget = "", businessType = "", title = "", storyText = "", purpose = "startup", budget = "", notes = "", targetLength = 5000, targetLanguageLabel = "한국 (한국어)" }) => {
776
+ if (![primaryTarget, businessType, title, storyText].some((value) => String(value).trim())) {
777
+ return textResult("primaryTarget/businessType/title/storyText 중 하나는 입력해야 합니다.", { isError: true });
778
+ }
779
+ if (analysisType === "comparison" && !String(secondaryTarget).trim()) {
780
+ return textResult("analysisType=comparison에는 secondaryTarget(비교 상권)이 필수입니다.", { isError: true });
781
+ }
782
+ const payload = await api.request("/api/tracker/ai/market-analysis", {
783
+ body: {
784
+ analysisType,
785
+ apiModel: "gemini-3.5-flash",
786
+ budget,
787
+ businessType,
788
+ channelStyleProfile: null,
789
+ channelStyleReferenceText: "",
790
+ modelKey: "gemini",
791
+ notes,
792
+ personas: [],
793
+ primaryTarget,
794
+ purpose,
795
+ secondaryTarget,
796
+ storyText,
797
+ targetLanguageLabel,
798
+ targetLength,
799
+ title,
800
+ },
801
+ method: "POST",
802
+ timeoutMs: 240_000,
803
+ });
804
+ const text = String(payload?.text || "").trim();
805
+ if (!text) return textResult("상권 분석 대본 결과가 비어 있습니다.", { isError: true });
806
+ return jsonResult({ analysisType, model: payload?.model, researchQueries: payload?.research?.performedQueryCount, text });
807
+ }),
808
+ );
809
+
810
+ // ── 뮤직비디오 기획 ──────────────────────────────────────────────────────────
811
+ server.tool(
812
+ "plan_music_video",
813
+ "뮤직비디오 씬 플랜을 생성합니다. suno_music_download로 받은 곡의 가사·길이(durationSec)를 입력하세요. 결과 scenes의 imagePrompt는 generate_scene_image로 이어집니다.",
814
+ {
815
+ durationSec: z.number().min(10).describe("곡 길이(초) — suno_music_download 결과의 durationSec"),
816
+ lyrics: z.string().optional().describe("가사 전체 (instrumental이면 생략 가능)"),
817
+ conceptBrief: z.string().optional().describe("영상 컨셉 브리프"),
818
+ instrumental: z.boolean().optional().describe("연주곡 여부, 기본 false"),
819
+ sceneSeconds: z.number().int().min(3).max(8).optional().describe("씬 길이(초), 기본 5"),
820
+ splitMode: z.enum(["fixed", "auto"]).optional().describe("씬 분할, 기본 fixed"),
821
+ videoStylePreset: z.string().optional().describe("기본 seedance-music-video"),
822
+ aspectRatio: z.string().optional().describe("기본 9:16"),
823
+ },
824
+ wrapCloudHandler(config, async ({ durationSec, lyrics = "", conceptBrief = "", instrumental = false, sceneSeconds = 5, splitMode = "fixed", videoStylePreset = "seedance-music-video", aspectRatio = "9:16" }) => {
825
+ if (!instrumental && !String(lyrics).trim()) {
826
+ return textResult("lyrics를 입력하거나 instrumental=true로 지정하세요.", { isError: true });
827
+ }
828
+ const payload = await api.request("/api/tracker/music-video/plan", {
829
+ body: {
830
+ alignedLines: [],
831
+ aspectRatio,
832
+ conceptBrief,
833
+ durationSec,
834
+ instrumental,
835
+ lyrics,
836
+ sceneSeconds,
837
+ selectedCharacters: [],
838
+ songMeta: {},
839
+ splitMode,
840
+ videoStylePreset,
841
+ },
842
+ method: "POST",
843
+ timeoutMs: 240_000,
844
+ });
845
+ // usage/원장 이벤트 등 컨텍스트 낭비 필드는 제거하고 기획 본문만 돌려준다.
846
+ const { accountCostEvents, providerUsage, usage, ...plan } = payload && typeof payload === "object" ? payload : {};
847
+ return jsonResult(plan);
848
+ }),
849
+ );
850
+
851
+ // ── 짜집기 편집점 분석 (티키타카 편집점 지침) ────────────────────────────────
852
+ server.tool(
853
+ "analyze_edit_points",
854
+ "짜집기(리메이크)용 편집점 분석 — 티키타카 편집점 지침으로 원본 YouTube 영상의 장면 카탈로그(sceneCatalog)를 만듭니다. 전사는 자동 확보합니다. 컷 정확도를 높이려면 detect_shots(로컬 컴패니언)로 만든 shotsFile 경로를 videoId별로 넘기세요.",
855
+ {
856
+ videos: z.array(z.object({
857
+ id: z.string().describe("YouTube video id"),
858
+ title: z.string().optional(),
859
+ channel: z.string().optional(),
860
+ durationSeconds: z.number().optional(),
861
+ })).min(1).max(5).describe("분석할 원본 영상 (최대 5편)"),
862
+ shotsFiles: z.record(z.string()).optional().describe("videoId → detect_shots가 저장한 shots JSON 파일 경로"),
863
+ },
864
+ wrapCloudHandler(config, async ({ videos, shotsFiles = {} }) => {
865
+ // 1) 실제 오디오 전사 확보 — 편집점 분류([N]/[S]/[A])의 핵심 신호.
866
+ // 서버가 오디오 다운로드+Gemini 전사를 수행하므로 영상당 수 분 걸릴 수 있다.
867
+ const transcriptPayload = await api.request("/api/tracker/youtube/transcripts", {
868
+ body: { videos: videos.map((video) => ({ channel: video.channel || "", id: video.id, title: video.title || "" })) },
869
+ method: "POST",
870
+ timeoutMs: 600_000,
871
+ });
872
+ const transcriptMap = new Map(
873
+ (transcriptPayload?.items || []).map((item) => [item.videoId, Array.isArray(item.segments) ? item.segments : []]),
874
+ );
875
+
876
+ // 2) 컴패니언 샷 파일 로드 (imageBase64 포함) — 있으면 서버가 실제 컷 기준으로 분석.
877
+ const preDetectedShots = {};
878
+ for (const [videoId, filePath] of Object.entries(shotsFiles)) {
879
+ const parsed = JSON.parse(readFileSync(String(filePath), "utf8"));
880
+ const shots = Array.isArray(parsed) ? parsed : Array.isArray(parsed?.shots) ? parsed.shots : [];
881
+ if (shots.length) preDetectedShots[videoId] = shots;
882
+ }
883
+
884
+ const body = {
885
+ preDetectedShots: Object.keys(preDetectedShots).length ? preDetectedShots : null,
886
+ videos: videos.map((video) => ({
887
+ channel: video.channel || "",
888
+ durationSeconds: Number(video.durationSeconds) || 0,
889
+ frameSamples: [],
890
+ id: video.id,
891
+ title: video.title || "",
892
+ transcriptSegments: transcriptMap.get(video.id) || [],
893
+ })),
894
+ };
895
+ if (Buffer.byteLength(JSON.stringify(body), "utf8") > BODY_BUDGET_BYTES) {
896
+ return textResult("샷 이미지 총량이 서버 상한을 초과합니다. 영상 수 또는 detect_shots의 maxShots를 줄이세요.", { isError: true });
897
+ }
898
+
899
+ const payload = await api.request("/api/tracker/gemini/video-analysis", { body, method: "POST", timeoutMs: 240_000 });
900
+ const hadShots = Object.keys(preDetectedShots).length > 0;
901
+ // 이미지/전사 원문은 빼고 편집점 정보만 컨텍스트로 반환.
902
+ // sceneCatalog 필드명은 서버 sanitizeSceneCatalogItem 과 정확히 일치해야 한다.
903
+ return jsonResult({
904
+ summaryBody: payload?.summaryBody,
905
+ summaryHeadline: payload?.summaryHeadline,
906
+ videos: (payload?.videos || []).map((video) => ({
907
+ angle: video?.angle,
908
+ hook: video?.hook,
909
+ id: video?.id,
910
+ keywords: video?.keywords,
911
+ recommendedPreset: video?.recommendedPreset,
912
+ sceneCatalog: (video?.sceneCatalog || []).map((scene) => ({
913
+ actionTags: scene?.actionTags,
914
+ ambienceScore: scene?.ambienceScore,
915
+ dialogueVisualScore: scene?.dialogueVisualScore,
916
+ emotionTags: scene?.emotionTags,
917
+ endMs: scene?.endMs,
918
+ moodTags: scene?.moodTags,
919
+ narrationFit: scene?.narrationFit,
920
+ narrationFitScore: scene?.narrationFitScore,
921
+ shotId: scene?.shotId,
922
+ shortLabel: scene?.shortLabel,
923
+ startMs: scene?.startMs,
924
+ timecodeLabel: scene?.timecodeLabel,
925
+ visualSummary: scene?.visualSummary,
926
+ })),
927
+ })),
928
+ ...(hadShots ? {} : {
929
+ warning: "shotsFiles 없이 분석했습니다 — 장면 타임스탬프는 추정치입니다. 정확한 컷 기준 편집점이 필요하면 detect_shots(로컬 컴패니언)로 샷을 감지해 shotsFiles로 넘기세요.",
930
+ }),
931
+ });
932
+ }),
933
+ );
934
+
935
+ // ── 시간 동기 자막 TTS — 쇼츠 하단자막용 ─────────────────────────────────────
936
+ server.tool(
937
+ "tts_narration_with_captions",
938
+ "ElevenLabs TTS를 char-level 타이밍과 함께 합성해 mp3 파일 + 시간 동기 자막 라인(subtitleLines)을 만듭니다. 쇼츠 하단자막이 필요하면 tts_narration 대신 이걸 쓰고, 결과 subtitleLines·durationSec·filePath를 stitch_timeline에 그대로 넘기세요 (웹 쇼츠 스튜디오와 동일한 정렬 방식).",
939
+ {
940
+ text: z.string().describe("내레이션 텍스트"),
941
+ voice: z.string().optional().describe("보이스 이름 또는 ID (생략 시 기본 보이스)"),
942
+ speed: z.number().optional().describe("기본 1 (0.7~1.2)"),
943
+ },
944
+ wrapCloudHandler(config, async ({ text, voice = "", speed = 1 }) => {
945
+ const payload = await api.request("/api/tracker/tts/elevenlabs-with-timestamps", {
946
+ body: {
947
+ costEventId: createUsageEventId("mcp-tts-elevenlabs-ts"),
948
+ languageCode: "ko",
949
+ speed,
950
+ text,
951
+ voice,
952
+ },
953
+ method: "POST",
954
+ timeoutMs: 180_000,
955
+ });
956
+ const audioBase64 = String(payload?.audioBase64 || "");
957
+ if (!audioBase64) {
958
+ return textResult("TTS 합성 결과가 비어 있습니다. ElevenLabs API 키 연결 여부를 확인하세요.", { isError: true });
959
+ }
960
+ const saved = saveMediaBuffer(config.stateDir, "narration-captions.mp3", Buffer.from(audioBase64, "base64"), { contentType: "audio/mpeg" });
961
+ const subtitleLines = (Array.isArray(payload?.alignedLines) ? payload.alignedLines : [])
962
+ .map((line) => ({
963
+ endSec: Number(line?.endSec) || 0,
964
+ startSec: Number(line?.startSec) || 0,
965
+ text: String(line?.text || "").trim(),
966
+ }))
967
+ .filter((line) => line.text && line.endSec > line.startSec);
968
+ const charEnds = payload?.alignment?.character_end_times_seconds;
969
+ const durationSec = Array.isArray(charEnds) && charEnds.length
970
+ ? Math.round(Number(charEnds[charEnds.length - 1]) * 10) / 10
971
+ : audioDurationSecFromFile(saved.filePath);
972
+ return jsonResult({
973
+ durationSec,
974
+ filePath: saved.filePath,
975
+ lineCount: subtitleLines.length,
976
+ subtitleLines,
977
+ });
978
+ }),
979
+ );
980
+
981
+ // ── TTS 보이스 카탈로그 ──────────────────────────────────────────────────────
982
+ server.tool(
983
+ "tts_list_voices",
984
+ "TTS 보이스 목록을 조회합니다. tts_narration의 voice에 넣을 이름을 고를 때 사용하세요. (voice를 생략하면 서버가 기본 보이스로 합성합니다)",
985
+ {
986
+ provider: z.enum(["typecast", "elevenlabs"]).optional().describe("기본 typecast"),
987
+ },
988
+ wrapCloudHandler(config, async ({ provider = "typecast" }) => {
989
+ const payload = await api.request(`/api/tracker/tts/${provider}/voices`, { method: "GET", timeoutMs: 30_000 });
990
+ // ElevenLabs 는 gender/age 가 labels 객체 안에 있다 — 두 공급자 형태 모두 지원.
991
+ const voices = (Array.isArray(payload?.voices) ? payload.voices : []).slice(0, 80).map((voice) => ({
992
+ age: voice?.age || voice?.labels?.age,
993
+ description: voice?.description || undefined,
994
+ gender: voice?.gender || voice?.labels?.gender,
995
+ name: voice?.voiceName || voice?.name,
996
+ nameKo: voice?.voiceNameKo,
997
+ voiceId: voice?.voiceId,
998
+ }));
999
+ return jsonResult({ count: voices.length, provider, voices });
1000
+ }),
1001
+ );
644
1002
  }
@@ -7,7 +7,7 @@ import {
7
7
  triageCompanion,
8
8
  } from "./companion-client.mjs";
9
9
  import { detectRemoteEnvironment } from "./config.mjs";
10
- import { readPayloadHandle } from "./media-store.mjs";
10
+ import { readPayloadHandle, saveMediaBuffer } from "./media-store.mjs";
11
11
  import {
12
12
  checkRenderPayloadSize,
13
13
  sanitizeRenderPayload,
@@ -58,6 +58,55 @@ export function registerCompanionTools(server, config) {
58
58
  },
59
59
  );
60
60
 
61
+ server.tool(
62
+ "detect_shots",
63
+ "이 PC의 컴패니언으로 YouTube 영상의 컷(샷) 경계와 대표 프레임을 감지해 shots JSON 파일로 저장합니다. 저장된 파일 경로를 analyze_edit_points의 shotsFiles에 넘기면 실제 컷 기준의 편집점 분석이 됩니다. (다운로드+ffmpeg — 수십 초 걸릴 수 있음)",
64
+ {
65
+ videoId: z.string().describe("YouTube video id"),
66
+ maxShots: z.number().int().min(3).max(18).optional().describe("최대 샷 수, 기본 15 (컴패니언 상한 18)"),
67
+ sceneThreshold: z.number().min(0.08).max(0.9).optional().describe("장면 전환 감도, 기본 0.22"),
68
+ },
69
+ async ({ videoId, maxShots = 15, sceneThreshold = 0.22 }) => {
70
+ try {
71
+ const response = await fetch(`${config.companionUrl}/api/shots`, {
72
+ body: JSON.stringify({
73
+ maxShots,
74
+ minGapMs: 1400,
75
+ sceneThreshold,
76
+ url: `https://www.youtube.com/watch?v=${videoId}`,
77
+ width: 720,
78
+ }),
79
+ headers: { "Content-Type": "application/json" },
80
+ method: "POST",
81
+ signal: AbortSignal.timeout(240_000),
82
+ });
83
+ if (!response.ok) {
84
+ return textResult(`샷 감지 실패 (HTTP ${response.status}). 컴패니언 상태를 companion_status로 확인하세요.`, { isError: true });
85
+ }
86
+ const payload = await response.json();
87
+ const shots = Array.isArray(payload?.shots) ? payload.shots : [];
88
+ if (!shots.length) {
89
+ return textResult("샷 감지 결과가 없습니다. sceneThreshold를 낮추거나 다른 영상으로 시도하세요.", { isError: true });
90
+ }
91
+ // 대표 프레임 base64 는 모델 컨텍스트로 돌려주지 않고 파일 핸들로만 전달.
92
+ const saved = saveMediaBuffer(config.stateDir, `shots-${videoId}.json`, Buffer.from(JSON.stringify(shots)));
93
+ const lastEndMs = Number(shots[shots.length - 1]?.endMs) || 0;
94
+ return textResult(JSON.stringify({
95
+ durationSecApprox: lastEndMs ? Math.round(lastEndMs / 100) / 10 : undefined,
96
+ shotCount: shots.length,
97
+ shotsFile: saved.filePath,
98
+ videoId,
99
+ }, null, 2));
100
+ } catch (error) {
101
+ const triage = await triageCompanion(config.companionUrl).catch(() => ({ detail: "", state: "not-running" }));
102
+ if (triage.state !== "ready") {
103
+ return textResult(describeCompanionState(triage, remoteEnv), { isError: true });
104
+ }
105
+ return textResult(`샷 감지 오류: ${error?.name === "TimeoutError" ? "시간 초과(4분)" : String(error?.message || error)}`, { isError: true });
106
+ }
107
+ },
108
+ );
109
+
61
110
  server.tool(
62
111
  "render_start",
63
112
  "타임라인 페이로드를 로컬 컴패니언에 제출해 mp4 렌더를 시작합니다. stitch_timeline이 반환한 payloadPath를 넘기는 것이 표준 경로입니다. 즉시 jobId를 반환하며, render_status로 폴링하고 render_result로 파일을 저장하세요. 렌더는 이 PC에서 수행됩니다.",
package/lib/config.mjs CHANGED
@@ -2,7 +2,7 @@ import { homedir } from "node:os";
2
2
  import path from "node:path";
3
3
 
4
4
  // 프록시 버전 — 서버가 X-AImakeAll-MCP-Version 으로 하한을 강제(426)할 수 있다.
5
- export const MCP_PROXY_VERSION = "0.1.0";
5
+ export const MCP_PROXY_VERSION = "0.2.0";
6
6
 
7
7
  export const DEFAULT_API_BASE = "https://aimakeall.com";
8
8
  export const DEFAULT_COMPANION_URL = "http://127.0.0.1:9876";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aimakeall-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "AImakeAll MCP 서버 — Claude Code/Codex에서 자연어로 영상 기획·생성·렌더·퍼블리시 (렌더는 로컬 컴패니언)",
5
5
  "type": "module",
6
6
  "bin": {