@yoonion/mimi-seed-mcp 0.25.4 → 0.25.5

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.
@@ -1,4 +1,5 @@
1
1
  import type { FacebookConfig } from './config.js';
2
+ import { type PublishHooks } from '../lib/meta-auth.js';
2
3
  export interface FacebookPage {
3
4
  id: string;
4
5
  name: string;
@@ -11,6 +12,6 @@ export interface PostResult {
11
12
  permalink?: string;
12
13
  }
13
14
  export declare function getPage(cfg: FacebookConfig): Promise<FacebookPage>;
14
- export declare function postPhoto(cfg: FacebookConfig, imageUrl: string, caption: string): Promise<PostResult>;
15
- export declare function postMultiPhoto(cfg: FacebookConfig, imageUrls: string[], caption: string): Promise<PostResult>;
15
+ export declare function postPhoto(cfg: FacebookConfig, imageUrl: string, caption: string, hooks?: PublishHooks): Promise<PostResult>;
16
+ export declare function postMultiPhoto(cfg: FacebookConfig, imageUrls: string[], caption: string, hooks?: PublishHooks): Promise<PostResult>;
16
17
  export declare function listAccessiblePages(userAccessToken: string): Promise<FacebookPage[]>;
@@ -56,7 +56,9 @@ async function uploadUnpublishedPhoto(cfg, imageUrl) {
56
56
  });
57
57
  return result.id;
58
58
  }
59
- export async function postPhoto(cfg, imageUrl, caption) {
59
+ export async function postPhoto(cfg, imageUrl, caption, hooks = {}) {
60
+ // A published photo is one request: it is the publishing step.
61
+ hooks.onPublishStart?.();
60
62
  const result = await fbPost(cfg.pageAccessToken, `/${encodePathSegment(cfg.pageId)}/photos`, {
61
63
  url: imageUrl,
62
64
  message: caption,
@@ -71,7 +73,7 @@ export async function postPhoto(cfg, imageUrl, caption) {
71
73
  catch { /* best-effort */ }
72
74
  return { id: postId, permalink };
73
75
  }
74
- export async function postMultiPhoto(cfg, imageUrls, caption) {
76
+ export async function postMultiPhoto(cfg, imageUrls, caption, hooks = {}) {
75
77
  if (imageUrls.length < 2 || imageUrls.length > 10) {
76
78
  throw new Error(M().imageCount);
77
79
  }
@@ -83,6 +85,8 @@ export async function postMultiPhoto(cfg, imageUrls, caption) {
83
85
  }
84
86
  // Step 2: create feed post with all photos attached
85
87
  const attachedMedia = photoIds.map(id => JSON.stringify({ media_fbid: id }));
88
+ // The unpublished uploads above are invisible; this feed post is what publishes.
89
+ hooks.onPublishStart?.();
86
90
  const result = await fbPost(cfg.pageAccessToken, `/${encodePathSegment(cfg.pageId)}/feed`, {
87
91
  message: caption,
88
92
  attached_media: `[${attachedMedia.join(',')}]`,
@@ -43,6 +43,9 @@ export const MANIFEST_TEXT_EN = {
43
43
  'Threads 토큰 (mimi-seed auth threads)': 'Threads token (mimi-seed auth threads)',
44
44
  '텍스트/이미지/영상 포스팅·토큰 갱신': 'Post text/images/videos; refresh the token',
45
45
  'Organic API 계정 진단·게시 전 검증·공개 영상 게시·상태·중복 방지 감사 로그': 'Organic API account diagnostics, pre-publish validation, public video publishing, status, duplicate-prevention audit log',
46
+ '소셜 통합 게시': 'Cross-platform social publishing',
47
+ '플랫폼별 연결 (mimi-seed auth social)': 'Each platform connected (mimi-seed auth social)',
48
+ '여러 소셜 플랫폼에 한 번에 게시·중복 게시 방지': 'Publish one post to several social platforms; duplicate-post protection',
46
49
  '영상 제작': 'Video production',
47
50
  '기능별 API 키 + Google OAuth(YouTube 게시) + FFmpeg': 'Per-feature API keys + Google OAuth (YouTube publishing) + FFmpeg',
48
51
  'story 스토리보드·영상 리서치/제작·YouTube 업로드와 공개 상태 관리': 'story storyboards, video research/production, YouTube upload and privacy management',
@@ -0,0 +1,23 @@
1
+ /** crosspost 도구 · 파라미터 설명의 영어 — 키는 한국어 원문 (lib/tool-text.ts). 원문을 고치면 키도 고친다. */
2
+ declare const _default: {
3
+ '\uD558\uB098\uC758 \uAC8C\uC2DC\uBB3C\uC744 \uC5EC\uB7EC \uC18C\uC15C \uD50C\uB7AB\uD3FC(facebook, instagram, threads, youtube, tiktok)\uC5D0 \uD55C \uBC88\uC5D0 \uAC8C\uC2DC\uD569\uB2C8\uB2E4. confirm \uC5C6\uC774 \uBD80\uB974\uBA74 dry-run \uACC4\uD68D\uB9CC \uB3CC\uB824\uC90D\uB2C8\uB2E4: \uD50C\uB7AB\uD3FC\uBCC4 \uB3D9\uC791\u00B7\uBCF8\uBB38\u00B7\uBBF8\uB514\uC5B4\uC640 \uAC8C\uC2DC\uB97C \uB9C9\uB294 \uBB38\uC81C. \uB124\uD2B8\uC6CC\uD06C \uD638\uCD9C\uC740 \uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uD55C \uB300\uC0C1\uC774\uB77C\uB3C4 \uBB38\uC81C\uAC00 \uC788\uC73C\uBA74 \uC5B4\uB514\uC5D0\uB3C4 \uAC8C\uC2DC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uC0AC\uC6A9\uC790\uC5D0\uAC8C \uACC4\uD68D\uC744 \uBCF4\uC5EC\uC8FC\uACE0 \uBA85\uC2DC \uC2B9\uC778\uC744 \uBC1B\uC740 \uB4A4 confirm: true \uB85C \uB2E4\uC2DC \uD638\uCD9C\uD558\uC138\uC694. \uBBF8\uB514\uC5B4 \uADDC\uCE59\uC740 \uD50C\uB7AB\uD3FC\uBCC4 \uB3C4\uAD6C\uC640 \uAC19\uC2B5\uB2C8\uB2E4: Facebook\u00B7Instagram \uC740 public HTTPS imageUrls(1~10\uC7A5)\uAC00 \uD544\uC694\uD558\uACE0, Threads \uB294 \uD14D\uC2A4\uD2B8\u00B7\uC774\uBBF8\uC9C0(1~20\uC7A5)\u00B7videoUrl \uC911 \uD558\uB098, YouTube \uB294 \uB85C\uCEEC videoFilePath \uC640 youtube.expectedChannelId, TikTok \uC740 tiktok_business_plan_video_post \uB85C \uB9CC\uB4E0 tiktok.planId \uB97C \uC501\uB2C8\uB2E4. \uACB0\uACFC\uB294 \uD50C\uB7AB\uD3FC\uBCC4\uB85C \uB3CC\uB824\uC90D\uB2C8\uB2E4. \uAC19\uC740 \uAC8C\uC2DC\uBB3C(\uD50C\uB7AB\uD3FC\u00B7\uACC4\uC815\u00B7\uB0B4\uC6A9\uC774 \uAC19\uC74C)\uC740 \uB450 \uBC88 \uAC8C\uC2DC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: \uB2E4\uC2DC \uBD80\uB974\uBA74 \uC774\uBBF8 \uAC8C\uC2DC\uB41C \uACF3\uC740 \uAC74\uB108\uB6F0\uACE0, \uC2E4\uD328\uD55C \uACF3\uB9CC \uBCF4\uB0C5\uB2C8\uB2E4. \uAC19\uC740 \uB0B4\uC6A9\uC744 \uC77C\uBD80\uB7EC \uB2E4\uC2DC \uC62C\uB9AC\uB824\uBA74 repost: [{ platform, at }] \uC73C\uB85C \uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C \uADF8 \uAC8C\uC2DC \uAE30\uB85D\uC758 at \uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \uACB0\uACFC\uB97C \uC54C \uC218 \uC5C6\uB294 \uAC8C\uC2DC\uAC00 \uC788\uB294 \uACC4\uC815\uC740 \uB0B4\uC6A9\uC774 \uB2EC\uB77C\uB3C4 \uB9C9\uD788\uBA70, \uC0AC\uB78C\uC774 \uADF8 \uD50C\uB7AB\uD3FC\uC5D0\uC11C \uD655\uC778\uD55C \uB4A4 resendUnknown: [{ platform, at }] \uC73C\uB85C \uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C at \uC744 \uC9C0\uC815\uD574\uC57C\uB9CC \uB2E4\uC2DC \uBCF4\uB0C5\uB2C8\uB2E4. \uD655\uC778\uD574 \uBCF4\uB2C8 \uC774\uBBF8 \uC62C\uB77C\uAC00 \uC788\uB2E4\uBA74 markPosted: [{ platform, at }] \uC73C\uB85C \uAC8C\uC2DC\uB428\uC73C\uB85C \uAE30\uB85D\uD569\uB2C8\uB2E4. \uC2B9\uC778\uC740 \uC9C0\uC815\uD55C \uAE30\uB85D \uD558\uB098\uC5D0\uB9CC \uC4F0\uC785\uB2C8\uB2E4.': string;
4
+ '\uC774 \uD50C\uB7AB\uD3FC\uC5D0 \uC4F8 \uC18C\uC15C \uD504\uB85C\uD544 ID (\uC0DD\uB7B5 \uC2DC \uD504\uB85C\uC81D\uD2B8 \uB9E4\uD551 \uB610\uB294 \uAE30\uBCF8 \uC124\uC815)': string;
5
+ '\uC774 \uD50C\uB7AB\uD3FC\uC5D0\uB9CC \uC4F8 \uBCF8\uBB38 (\uC0DD\uB7B5 \uC2DC \uACF5\uD1B5 text)': string;
6
+ '\uAC8C\uC2DC\uD560 \uD50C\uB7AB\uD3FC \uBAA9\uB85D (\uC774 \uC21C\uC11C\uB300\uB85C \uAC8C\uC2DC)': string;
7
+ '\uACF5\uD1B5 \uBCF8\uBB38. \uD50C\uB7AB\uD3FC\uBCC4 text \uB85C \uB36E\uC5B4\uC4F8 \uC218 \uC788\uC2B5\uB2C8\uB2E4 (Threads 500\uC790, Instagram 2,200\uC790).': string;
8
+ '\uC774\uBBF8\uC9C0 public HTTPS URL (Facebook\u00B7Instagram \uCD5C\uB300 10\uC7A5, Threads \uCD5C\uB300 20\uC7A5)': string;
9
+ 'Threads \uC601\uC0C1 \uAC8C\uC2DC\uC6A9 public HTTPS URL': string;
10
+ 'YouTube \uC5C5\uB85C\uB4DC\uC6A9 \uB85C\uCEEC \uC601\uC0C1 \uC808\uB300\uACBD\uB85C': string;
11
+ 'Google \uB85C\uADF8\uC778 \uD504\uB85C\uD544 (mimi-seed auth social \uC740 "youtube" \uD504\uB85C\uD544\uC5D0 \uC5F0\uACB0\uD569\uB2C8\uB2E4)': string;
12
+ '\uC601\uC0C1 \uC81C\uBAA9 (\uC0DD\uB7B5 \uC2DC text \uC758 \uCCAB \uC904)': string;
13
+ '\uC601\uC0C1 \uC124\uBA85 (\uC0DD\uB7B5 \uC2DC text)': string;
14
+ '\uAE30\uBCF8 private. \uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB418\uBA70 \uC2B9\uC778 \uB300\uC0C1\uC785\uB2C8\uB2E4.': string;
15
+ 'tiktok_business_plan_video_post \uAC00 \uB9CC\uB4E0 \uACC4\uD68D ID (\uCEA1\uC158\u00B7\uC124\uC815\uC740 \uACC4\uD68D\uC758 \uAC12\uC744 \uC501\uB2C8\uB2E4)': string;
16
+ '\uC9C0\uC6D0 \uC911\uB2E8 \u2014 \uB118\uAE30\uBA74 \uAC70\uBD80\uD569\uB2C8\uB2E4. \uAC19\uC740 \uAC8C\uC2DC\uBB3C\uC740 \uC790\uB3D9\uC73C\uB85C \uD55C \uBC88\uB9CC \uAC8C\uC2DC\uB429\uB2C8\uB2E4.': string;
17
+ '\uC0AC\uC6A9\uC790\uC758 \uBA85\uC2DC \uC2B9\uC778 \uD6C4 true. false \uBA74 dry-run \uACC4\uD68D\uB9CC \uBC18\uD658\uD569\uB2C8\uB2E4.': string;
18
+ '\uC0AC\uC6A9\uC790\uAC00 \uADF8 \uD50C\uB7AB\uD3FC\uC5D0\uC11C \uAC8C\uC2DC\uB418\uC9C0 \uC54A\uC558\uC74C\uC744 \uD655\uC778\uD55C, \uACB0\uACFC\uB97C \uC54C \uC218 \uC5C6\uC5C8\uB358 \uAE30\uB85D. \uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C \uD50C\uB7AB\uD3FC\uACFC at \uC744 \uADF8\uB300\uB85C \uB118\uAE41\uB2C8\uB2E4. \uADF8 \uAE30\uB85D\uB9CC \uB2E4\uC2DC \uBCF4\uB0B4\uBA70, \uC774\uD6C4 \uC0C8\uB85C \uC0DD\uAE34 \uACB0\uACFC \uBD88\uBA85\uC740 \uB2E4\uC2DC \uB9C9\uD799\uB2C8\uB2E4.': string;
19
+ '\uC0AC\uC6A9\uC790\uAC00 \uC77C\uBD80\uB7EC \uB2E4\uC2DC \uAC8C\uC2DC\uD558\uB824\uB294 \uC774\uBBF8 \uAC8C\uC2DC\uB41C \uAE30\uB85D. \uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C \uD50C\uB7AB\uD3FC\uACFC at \uC744 \uADF8\uB300\uB85C \uB118\uAE41\uB2C8\uB2E4. \uD55C \uBC88 \uB2E4\uC2DC \uAC8C\uC2DC\uB418\uBA74 \uADF8 \uC2B9\uC778\uC740 \uB354 \uC774\uC0C1 \uB9DE\uC9C0 \uC54A\uC544 \uC7AC\uC2DC\uB3C4\uB85C \uBC18\uBCF5 \uAC8C\uC2DC\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.': string;
20
+ '\uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C \uADF8 \uAE30\uB85D\uC758 at (\uC2B9\uC778 \uB300\uC0C1 \uAE30\uB85D\uC744 \uC815\uD655\uD788 \uC9C0\uBAA9)': string;
21
+ '\uACB0\uACFC\uB97C \uC54C \uC218 \uC5C6\uC5C8\uB358 \uAE30\uB85D \uC911, \uC0AC\uC6A9\uC790\uAC00 \uADF8 \uD50C\uB7AB\uD3FC\uC5D0\uC11C \uC2E4\uC81C\uB85C \uC62C\uB77C\uAC00 \uC788\uC74C\uC744 \uD655\uC778\uD55C \uAC83. \uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C \uD50C\uB7AB\uD3FC\uACFC at \uC744 \uADF8\uB300\uB85C \uB118\uAE41\uB2C8\uB2E4. \uADF8 \uAE30\uB85D\uC744 \uAC8C\uC2DC\uB428\uC73C\uB85C \uB0A8\uAE30\uACE0 \uACC4\uC815 \uCC28\uB2E8\uC744 \uD489\uB2C8\uB2E4 (\uBCF4\uB0B4\uC9C0\uB294 \uC54A\uC74C).': string;
22
+ };
23
+ export default _default;
@@ -0,0 +1,22 @@
1
+ /** crosspost 도구 · 파라미터 설명의 영어 — 키는 한국어 원문 (lib/tool-text.ts). 원문을 고치면 키도 고친다. */
2
+ export default {
3
+ '하나의 게시물을 여러 소셜 플랫폼(facebook, instagram, threads, youtube, tiktok)에 한 번에 게시합니다. confirm 없이 부르면 dry-run 계획만 돌려줍니다: 플랫폼별 동작·본문·미디어와 게시를 막는 문제. 네트워크 호출은 하지 않습니다. 한 대상이라도 문제가 있으면 어디에도 게시하지 않습니다. 사용자에게 계획을 보여주고 명시 승인을 받은 뒤 confirm: true 로 다시 호출하세요. 미디어 규칙은 플랫폼별 도구와 같습니다: Facebook·Instagram 은 public HTTPS imageUrls(1~10장)가 필요하고, Threads 는 텍스트·이미지(1~20장)·videoUrl 중 하나, YouTube 는 로컬 videoFilePath 와 youtube.expectedChannelId, TikTok 은 tiktok_business_plan_video_post 로 만든 tiktok.planId 를 씁니다. 결과는 플랫폼별로 돌려줍니다. 같은 게시물(플랫폼·계정·내용이 같음)은 두 번 게시하지 않습니다: 다시 부르면 이미 게시된 곳은 건너뛰고, 실패한 곳만 보냅니다. 같은 내용을 일부러 다시 올리려면 repost: [{ platform, at }] 으로 계획에 표시된 그 게시 기록의 at 을 지정합니다. 결과를 알 수 없는 게시가 있는 계정은 내용이 달라도 막히며, 사람이 그 플랫폼에서 확인한 뒤 resendUnknown: [{ platform, at }] 으로 계획에 표시된 at 을 지정해야만 다시 보냅니다. 확인해 보니 이미 올라가 있다면 markPosted: [{ platform, at }] 으로 게시됨으로 기록합니다. 승인은 지정한 기록 하나에만 쓰입니다.': 'Publishes one post to several social platforms (facebook, instagram, threads, youtube, tiktok) at once. Without confirm it returns only a dry-run plan: each platform\'s action, text, and media, plus any problem that would block it. It makes no network calls. If any target has a problem, nothing is posted anywhere. Show the user the plan, get their explicit approval, then call again with confirm: true. Media rules match the per-platform tools: Facebook and Instagram need public HTTPS imageUrls (1–10); Threads takes text, images (1–20), or a videoUrl; YouTube uses a local videoFilePath and youtube.expectedChannelId; TikTok uses a tiktok.planId made by tiktok_business_plan_video_post. Results come back per platform. The same post (same platform, account, and content) is never posted twice: calling again skips platforms that already posted and sends only the failed ones. To post the same content again on purpose, pass repost: [{ platform, at }] with the at the plan shows for that posted record. An account with a send whose outcome is unknown is blocked even for different content, and is sent to again only after a person checked it on that platform and resendUnknown: [{ platform, at }] names the at the plan shows. If the check shows it is already live, pass markPosted: [{ platform, at }] to record it as posted. An approval covers only the record it names.',
4
+ '이 플랫폼에 쓸 소셜 프로필 ID (생략 시 프로젝트 매핑 또는 기본 설정)': 'Social profile ID to use for this platform (when omitted, the project mapping or the default config)',
5
+ '이 플랫폼에만 쓸 본문 (생략 시 공통 text)': 'Text for this platform only (when omitted, the common text)',
6
+ '게시할 플랫폼 목록 (이 순서대로 게시)': 'Platforms to post to (posted in this order)',
7
+ '공통 본문. 플랫폼별 text 로 덮어쓸 수 있습니다 (Threads 500자, Instagram 2,200자).': 'Common text. Each platform\'s text can override it (Threads 500 characters, Instagram 2,200).',
8
+ '이미지 public HTTPS URL (Facebook·Instagram 최대 10장, Threads 최대 20장)': 'Public HTTPS image URLs (Facebook and Instagram up to 10, Threads up to 20)',
9
+ 'Threads 영상 게시용 public HTTPS URL': 'Public HTTPS URL for a Threads video post',
10
+ 'YouTube 업로드용 로컬 영상 절대경로': 'Absolute path of the local video to upload to YouTube',
11
+ 'Google 로그인 프로필 (mimi-seed auth social 은 "youtube" 프로필에 연결합니다)': 'Google login profile (mimi-seed auth social connects the "youtube" profile)',
12
+ '영상 제목 (생략 시 text 의 첫 줄)': 'Video title (when omitted, the first line of text)',
13
+ '영상 설명 (생략 시 text)': 'Video description (when omitted, text)',
14
+ '기본 private. 계획에 표시되며 승인 대상입니다.': 'Default private. Shown in the plan and covered by the approval.',
15
+ 'tiktok_business_plan_video_post 가 만든 계획 ID (캡션·설정은 계획의 값을 씁니다)': 'Plan ID made by tiktok_business_plan_video_post (the caption and settings come from the plan)',
16
+ '지원 중단 — 넘기면 거부합니다. 같은 게시물은 자동으로 한 번만 게시됩니다.': 'Removed — passing it is rejected. The same post is posted only once automatically.',
17
+ '사용자의 명시 승인 후 true. false 면 dry-run 계획만 반환합니다.': 'true after the user\'s explicit approval. When false, returns only the dry-run plan.',
18
+ '사용자가 그 플랫폼에서 게시되지 않았음을 확인한, 결과를 알 수 없었던 기록. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 그 기록만 다시 보내며, 이후 새로 생긴 결과 불명은 다시 막힙니다.': 'Unknown-outcome records the user checked are not posted on that platform. Pass the platform and at exactly as the plan showed them. Only that record is sent again; a newer unknown outcome is blocked again.',
19
+ '사용자가 일부러 다시 게시하려는 이미 게시된 기록. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 한 번 다시 게시되면 그 승인은 더 이상 맞지 않아 재시도로 반복 게시되지 않습니다.': 'Already-posted records the user wants to post again on purpose. Pass the platform and at exactly as the plan showed them. Once reposted, that approval no longer matches, so a retry cannot repost again.',
20
+ '계획에 표시된 그 기록의 at (승인 대상 기록을 정확히 지목)': 'The at the plan showed for that record (names exactly which record is approved)',
21
+ '결과를 알 수 없었던 기록 중, 사용자가 그 플랫폼에서 실제로 올라가 있음을 확인한 것. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 그 기록을 게시됨으로 남기고 계정 차단을 풉니다 (보내지는 않음).': 'Unknown-outcome records the user checked and found live on that platform. Pass the platform and at exactly as the plan showed them. The record is kept as posted and the account is unblocked (nothing is sent).',
22
+ };
@@ -18,6 +18,7 @@ import iam from './iam.js';
18
18
  import instagram from './instagram.js';
19
19
  import jenkins from './jenkins.js';
20
20
  import playstore from './playstore.js';
21
+ import crosspost from './crosspost.js';
21
22
  import threads from './threads.js';
22
23
  import tiktok from './tiktok.js';
23
24
  import video from './video.js';
@@ -49,6 +50,7 @@ export const TOOL_TEXT_EN_SOURCES = {
49
50
  instagram,
50
51
  jenkins,
51
52
  playstore,
53
+ crosspost,
52
54
  threads,
53
55
  tiktok,
54
56
  video,
@@ -1,4 +1,5 @@
1
1
  import type { InstagramConfig } from './config.js';
2
+ import { type PublishHooks } from '../lib/meta-auth.js';
2
3
  export declare function apiBaseFor(token: string): string;
3
4
  export interface InstagramAccount {
4
5
  id: string;
@@ -15,5 +16,5 @@ export interface PublishResult {
15
16
  id: string;
16
17
  permalink?: string;
17
18
  }
18
- export declare function postImage(cfg: InstagramConfig, imageUrl: string, caption: string): Promise<PublishResult>;
19
- export declare function postCarousel(cfg: InstagramConfig, imageUrls: string[], caption: string): Promise<PublishResult>;
19
+ export declare function postImage(cfg: InstagramConfig, imageUrl: string, caption: string, hooks?: PublishHooks): Promise<PublishResult>;
20
+ export declare function postCarousel(cfg: InstagramConfig, imageUrls: string[], caption: string, hooks?: PublishHooks): Promise<PublishResult>;
@@ -108,17 +108,19 @@ async function fetchPermalink(cfg, mediaId) {
108
108
  return undefined;
109
109
  }
110
110
  }
111
- export async function postImage(cfg, imageUrl, caption) {
111
+ export async function postImage(cfg, imageUrl, caption, hooks = {}) {
112
112
  // Step 1: image container 생성
113
113
  const container = await igFetch(cfg.accessToken, `/${encodePathSegment(cfg.userId)}/media`, { image_url: imageUrl, caption, access_token: cfg.accessToken }, 'POST');
114
114
  // Step 2: publish
115
+ // Containers are invisible until media_publish; this request is what publishes.
116
+ hooks.onPublishStart?.();
115
117
  const published = await igFetch(cfg.accessToken, `/${encodePathSegment(cfg.userId)}/media_publish`, { creation_id: container.id, access_token: cfg.accessToken }, 'POST');
116
118
  return {
117
119
  id: published.id,
118
120
  permalink: await fetchPermalink(cfg, published.id),
119
121
  };
120
122
  }
121
- export async function postCarousel(cfg, imageUrls, caption) {
123
+ export async function postCarousel(cfg, imageUrls, caption, hooks = {}) {
122
124
  if (imageUrls.length < 2 || imageUrls.length > 10) {
123
125
  throw new Error(M().carouselCount(imageUrls.length));
124
126
  }
@@ -139,6 +141,8 @@ export async function postCarousel(cfg, imageUrls, caption) {
139
141
  }, 'POST');
140
142
  await waitForContainer(cfg, carousel.id);
141
143
  // Step 3: publish
144
+ // Containers are invisible until media_publish; this request is what publishes.
145
+ hooks.onPublishStart?.();
142
146
  const published = await igFetch(cfg.accessToken, `/${encodePathSegment(cfg.userId)}/media_publish`, { creation_id: carousel.id, access_token: cfg.accessToken }, 'POST');
143
147
  return {
144
148
  id: published.id,
@@ -10,3 +10,12 @@ export declare function metaExpiryMessage(expiresAt: string | undefined, fix: st
10
10
  export declare function redactMetaSecrets(message: string): string;
11
11
  /** Translates a Meta OAuth expiry/revocation into a command the user can run to recover right away. */
12
12
  export declare function metaApiError(platform: MetaPlatform, status: number, message: string, code?: number): Error;
13
+ /** HTTP status of an error made by metaApiError, if any. */
14
+ export declare function metaErrorStatus(error: unknown): number | undefined;
15
+ /**
16
+ * Lets a caller learn when the request that makes a post visible is about to be sent. Anything that fails before it
17
+ * published nothing; after it, only a definite rejection proves nothing was published.
18
+ */
19
+ export interface PublishHooks {
20
+ onPublishStart?: () => void;
21
+ }
@@ -68,11 +68,20 @@ export function metaApiError(platform, status, message, code) {
68
68
  status === 401 ||
69
69
  /(?:session|access token|token).*(?:expired|invalid|revoked)|error validating access token/i.test(safeMessage);
70
70
  if (needsReconnect) {
71
- return new Error([
71
+ return withStatus(new Error([
72
72
  M().revoked(LABEL[platform]),
73
73
  M().recovery(FIX[platform]),
74
74
  M().metaResponse(safeMessage),
75
- ].join('\n'));
75
+ ].join('\n')), status);
76
76
  }
77
- return new Error(`${LABEL[platform]} API ${status}: ${safeMessage}`);
77
+ return withStatus(new Error(`${LABEL[platform]} API ${status}: ${safeMessage}`), status);
78
+ }
79
+ /** The HTTP status rides on the error, so callers can tell a rejection (4xx) from a server failure (5xx). */
80
+ function withStatus(error, status) {
81
+ return Object.assign(error, { status });
82
+ }
83
+ /** HTTP status of an error made by metaApiError, if any. */
84
+ export function metaErrorStatus(error) {
85
+ const status = error?.status;
86
+ return typeof status === 'number' ? status : undefined;
78
87
  }
@@ -2,7 +2,7 @@ export const TOOL_MENU_URI = 'mimi-seed://tools/menu';
2
2
  export const TOOL_SELECTION_URI = `${TOOL_MENU_URI}/{areas*}`;
3
3
  const menuOrder = [
4
4
  'ga4', 'bigquery', 'playstore', 'appstore', 'video', 'youtube', 'firebase', 'googleads',
5
- 'admob', 'drive', 'gsc', 'naver', 'instagram', 'threads', 'facebook', 'tiktok',
5
+ 'admob', 'drive', 'gsc', 'naver', 'instagram', 'threads', 'facebook', 'tiktok', 'crosspost',
6
6
  'ci', 'jenkins', 'checks', 'android', 'iam', 'billing', 'ai', 'auth',
7
7
  ];
8
8
  const labels = {
@@ -12,6 +12,7 @@ const labels = {
12
12
  video: { ko: 'YouTube · 영상 제작', en: 'YouTube · Video production' },
13
13
  youtube: { ko: 'YouTube · 업로드·채널 운영', en: 'YouTube · Upload and channel management' },
14
14
  naver: { ko: '네이버 서치어드바이저', en: 'Naver Search Advisor' },
15
+ crosspost: { ko: '소셜 통합 게시', en: 'Cross-post to several social platforms' },
15
16
  checks: { ko: '출시 상태·제출 전 점검', en: 'Release status and submission checks' },
16
17
  android: { ko: 'Android 서명', en: 'Android signing' },
17
18
  ai: { ko: 'AI 초안 · 릴리스 노트 / 리뷰 답변', en: 'AI drafts · Release notes and review replies' },
@@ -0,0 +1,2 @@
1
+ import type { ToolRegistrar } from '../lib/tool-registrar.js';
2
+ export declare function registerCrosspostTools(server: ToolRegistrar): void;
@@ -0,0 +1,81 @@
1
+ import { z } from 'zod';
2
+ import { SOCIAL_PROFILE_ID_PATTERN } from '#core/project-manifest.js';
3
+ import { GOOGLE_PROFILE_ID } from '../auth/google-auth.js';
4
+ import { YOUTUBE_CHANNEL_ID } from '../auth/youtube-channel.js';
5
+ import { executePublish, planPublish, SOCIAL_TARGETS } from '../crosspost/tools.js';
6
+ import { jsonResult } from '../lib/mcp-response.js';
7
+ import { catalog } from '#core/lang.js';
8
+ const M = catalog({
9
+ httpsOnly: 'HTTPS URL만 허용합니다.',
10
+ absoluteOnly: '절대경로만 허용합니다.',
11
+ preview: 'dry-run — 아무것도 게시하지 않았습니다. 아래 계획을 사용자에게 보여주고 명시 승인을 받은 뒤, 같은 인자에 confirm: true 를 더해 다시 호출하세요.',
12
+ blocked: '문제가 있는 대상이 있어 아무 곳에도 게시하지 않았습니다. problems 를 고친 뒤 다시 미리보기하세요.',
13
+ requestIdRemoved: 'requestId 는 더 이상 받지 않습니다. 같은 게시물(플랫폼·계정·내용이 같음)은 requestId 없이도 한 번만 게시됩니다. requestId 를 빼고 다시 부르세요. 같은 내용을 일부러 다시 올리려면 repost 를 쓰세요.',
14
+ done: '게시를 마쳤습니다. 실패한 대상은 다시 호출하면 다시 보냅니다 — 이미 게시된 곳은 건너뜁니다. 결과를 알 수 없는 대상은 그 플랫폼에서 먼저 확인하세요.',
15
+ }, {
16
+ httpsOnly: 'Only HTTPS URLs are allowed.',
17
+ absoluteOnly: 'Only absolute paths are allowed.',
18
+ preview: 'dry-run — nothing was posted. Show the user the plan below, get their explicit approval, then call again with the same arguments plus confirm: true.',
19
+ blocked: 'Nothing was posted because some targets have problems. Fix the problems, then preview again.',
20
+ requestIdRemoved: 'requestId is no longer accepted. The same post (same platform, account, and content) is posted only once without it. Call again without requestId. To post the same content again on purpose, use repost.',
21
+ done: 'Publishing finished. Calling again resends the failed targets — platforms that already posted are skipped. Check any unknown-outcome target on its platform first.',
22
+ });
23
+ const httpsUrl = z.string().url().refine((value) => new URL(value).protocol === 'https:', { error: () => M().httpsOnly });
24
+ const absolutePath = z.string().min(1).refine((value) => value.startsWith('/') || /^[A-Za-z]:[\\/]/.test(value), {
25
+ error: () => M().absoluteOnly,
26
+ });
27
+ const socialProfile = z.string().regex(SOCIAL_PROFILE_ID_PATTERN).optional().describe('이 플랫폼에 쓸 소셜 프로필 ID (생략 시 프로젝트 매핑 또는 기본 설정)');
28
+ const metaOptions = z.object({
29
+ profile: socialProfile,
30
+ text: z.string().optional().describe('이 플랫폼에만 쓸 본문 (생략 시 공통 text)'),
31
+ }).optional();
32
+ const approval = z.object({
33
+ platform: z.enum(SOCIAL_TARGETS),
34
+ at: z.string().min(1).max(64).describe('계획에 표시된 그 기록의 at (승인 대상 기록을 정확히 지목)'),
35
+ });
36
+ export function registerCrosspostTools(server) {
37
+ server.tool('social_publish', [
38
+ '하나의 게시물을 여러 소셜 플랫폼(facebook, instagram, threads, youtube, tiktok)에 한 번에 게시합니다.',
39
+ 'confirm 없이 부르면 dry-run 계획만 돌려줍니다: 플랫폼별 동작·본문·미디어와 게시를 막는 문제. 네트워크 호출은 하지 않습니다.',
40
+ '한 대상이라도 문제가 있으면 어디에도 게시하지 않습니다. 사용자에게 계획을 보여주고 명시 승인을 받은 뒤 confirm: true 로 다시 호출하세요.',
41
+ '미디어 규칙은 플랫폼별 도구와 같습니다: Facebook·Instagram 은 public HTTPS imageUrls(1~10장)가 필요하고, Threads 는 텍스트·이미지(1~20장)·videoUrl 중 하나, YouTube 는 로컬 videoFilePath 와 youtube.expectedChannelId, TikTok 은 tiktok_business_plan_video_post 로 만든 tiktok.planId 를 씁니다.',
42
+ '결과는 플랫폼별로 돌려줍니다. 같은 게시물(플랫폼·계정·내용이 같음)은 두 번 게시하지 않습니다: 다시 부르면 이미 게시된 곳은 건너뛰고, 실패한 곳만 보냅니다. 같은 내용을 일부러 다시 올리려면 repost: [{ platform, at }] 으로 계획에 표시된 그 게시 기록의 at 을 지정합니다. 결과를 알 수 없는 게시가 있는 계정은 내용이 달라도 막히며, 사람이 그 플랫폼에서 확인한 뒤 resendUnknown: [{ platform, at }] 으로 계획에 표시된 at 을 지정해야만 다시 보냅니다. 확인해 보니 이미 올라가 있다면 markPosted: [{ platform, at }] 으로 게시됨으로 기록합니다. 승인은 지정한 기록 하나에만 쓰입니다.',
43
+ ].join(' '), {
44
+ targets: z.array(z.enum(SOCIAL_TARGETS)).min(1).max(SOCIAL_TARGETS.length).describe('게시할 플랫폼 목록 (이 순서대로 게시)'),
45
+ text: z.string().max(63_206).describe('공통 본문. 플랫폼별 text 로 덮어쓸 수 있습니다 (Threads 500자, Instagram 2,200자).'),
46
+ imageUrls: z.array(httpsUrl).min(1).max(20).optional().describe('이미지 public HTTPS URL (Facebook·Instagram 최대 10장, Threads 최대 20장)'),
47
+ videoUrl: httpsUrl.optional().describe('Threads 영상 게시용 public HTTPS URL'),
48
+ videoFilePath: absolutePath.optional().describe('YouTube 업로드용 로컬 영상 절대경로'),
49
+ facebook: metaOptions,
50
+ instagram: metaOptions,
51
+ threads: metaOptions,
52
+ youtube: z.object({
53
+ profile: z.string().regex(GOOGLE_PROFILE_ID).optional().describe('Google 로그인 프로필 (mimi-seed auth social 은 "youtube" 프로필에 연결합니다)'),
54
+ expectedChannelId: z.string().regex(YOUTUBE_CHANNEL_ID).describe('업로드 대상 채널 ID. 인증된 채널과 다르면 업로드 중단.'),
55
+ title: z.string().min(1).max(100).optional().describe('영상 제목 (생략 시 text 의 첫 줄)'),
56
+ description: z.string().max(5_000).optional().describe('영상 설명 (생략 시 text)'),
57
+ tags: z.array(z.string().min(1).max(500)).max(100).optional(),
58
+ privacyStatus: z.enum(['private', 'unlisted', 'public']).default('private').describe('기본 private. 계획에 표시되며 승인 대상입니다.'),
59
+ madeForKids: z.boolean().default(false),
60
+ containsSyntheticMedia: z.boolean().optional().describe('현실적으로 보이는 AI 생성·변형 콘텐츠 여부를 YouTube에 고지'),
61
+ }).optional(),
62
+ tiktok: z.object({
63
+ planId: z.string().min(1).max(128).describe('tiktok_business_plan_video_post 가 만든 계획 ID (캡션·설정은 계획의 값을 씁니다)'),
64
+ }).optional(),
65
+ resendUnknown: z.array(approval).max(SOCIAL_TARGETS.length * 2).optional().describe('사용자가 그 플랫폼에서 게시되지 않았음을 확인한, 결과를 알 수 없었던 기록. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 그 기록만 다시 보내며, 이후 새로 생긴 결과 불명은 다시 막힙니다.'),
66
+ repost: z.array(approval).max(SOCIAL_TARGETS.length * 2).optional().describe('사용자가 일부러 다시 게시하려는 이미 게시된 기록. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 한 번 다시 게시되면 그 승인은 더 이상 맞지 않아 재시도로 반복 게시되지 않습니다.'),
67
+ markPosted: z.array(approval).max(SOCIAL_TARGETS.length * 2).optional().describe('결과를 알 수 없었던 기록 중, 사용자가 그 플랫폼에서 실제로 올라가 있음을 확인한 것. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 그 기록을 게시됨으로 남기고 계정 차단을 풉니다 (보내지는 않음).'),
68
+ // Removed: the "same post" rule replaced it. Rejected rather than silently dropped, so a caller relying on it
69
+ // learns that it no longer chooses what counts as a retry.
70
+ requestId: z.never({ error: () => M().requestIdRemoved }).optional().describe('지원 중단 — 넘기면 거부합니다. 같은 게시물은 자동으로 한 번만 게시됩니다.'),
71
+ confirm: z.boolean().default(false).describe('사용자의 명시 승인 후 true. false 면 dry-run 계획만 반환합니다.'),
72
+ }, async ({ confirm, requestId: _removed, ...input }) => {
73
+ const plan = planPublish(input);
74
+ if (!confirm)
75
+ return jsonResult({ mode: 'dry-run', note: M().preview, ...plan });
76
+ if (!plan.ok)
77
+ return jsonResult({ mode: 'blocked', note: M().blocked, ...plan });
78
+ const results = await executePublish(input, plan);
79
+ return jsonResult({ mode: 'published', note: M().done, results });
80
+ });
81
+ }
package/dist/server.js CHANGED
@@ -12,6 +12,7 @@ import { registerAuthTools } from './registers/auth.js';
12
12
  import { registerCiTools } from './registers/ci.js';
13
13
  import { registerInstagramTools } from './registers/instagram.js';
14
14
  import { registerThreadsTools } from './registers/threads.js';
15
+ import { registerCrosspostTools } from './registers/crosspost.js';
15
16
  import { registerFacebookTools } from './registers/facebook.js';
16
17
  import { registerGoogleAdsTools } from './registers/googleads.js';
17
18
  import { registerGscTools } from './registers/gsc.js';
@@ -86,6 +87,7 @@ export function buildServer(version, options = {}) {
86
87
  registerVideoTools(registrar);
87
88
  registerYouTubeTools(registrar);
88
89
  registerTikTokBusinessTools(registrar);
90
+ registerCrosspostTools(registrar);
89
91
  registerDriveTools(registrar);
90
92
  // 모든 언어에 적용한다 — `$schema` 제거는 언어와 무관하다. 번역은 en 일 때만.
91
93
  localizeToolList(server, toolLang === 'en' ? translate : undefined);
@@ -1,4 +1,5 @@
1
1
  import type { ThreadsConfig } from './config.js';
2
+ import { type PublishHooks } from '../lib/meta-auth.js';
2
3
  export interface ThreadsAccount {
3
4
  id: string;
4
5
  username: string;
@@ -19,7 +20,7 @@ export interface PublishResult {
19
20
  permalink?: string;
20
21
  }
21
22
  /** 텍스트 전용 게시 — Threads 의 핵심 유스케이스. imageUrl 을 주면 이미지 게시. */
22
- export declare function postText(cfg: ThreadsConfig, text: string, imageUrl?: string): Promise<PublishResult>;
23
+ export declare function postText(cfg: ThreadsConfig, text: string, imageUrl?: string, hooks?: PublishHooks): Promise<PublishResult>;
23
24
  /** public URL의 영상을 Threads 미디어 컨테이너로 만든 뒤 처리 완료 후 게시한다. */
24
- export declare function postVideo(cfg: ThreadsConfig, videoUrl: string, text?: string, altText?: string): Promise<PublishResult>;
25
- export declare function postCarousel(cfg: ThreadsConfig, imageUrls: string[], text: string): Promise<PublishResult>;
25
+ export declare function postVideo(cfg: ThreadsConfig, videoUrl: string, text?: string, altText?: string, hooks?: PublishHooks): Promise<PublishResult>;
26
+ export declare function postCarousel(cfg: ThreadsConfig, imageUrls: string[], text: string, hooks?: PublishHooks): Promise<PublishResult>;
@@ -126,12 +126,14 @@ async function waitForContainer(cfg, containerId) {
126
126
  }
127
127
  throw new Error(M().mediaTimeout);
128
128
  }
129
- async function publish(cfg, creationId) {
129
+ async function publish(cfg, creationId, hooks = {}) {
130
+ // Containers are invisible until threads_publish; this request is what publishes.
131
+ hooks.onPublishStart?.();
130
132
  const published = await thFetch(cfg.accessToken, '/me/threads_publish', { creation_id: creationId, access_token: cfg.accessToken }, 'POST');
131
133
  return { id: published.id, permalink: await fetchPermalink(cfg, published.id) };
132
134
  }
133
135
  /** 텍스트 전용 게시 — Threads 의 핵심 유스케이스. imageUrl 을 주면 이미지 게시. */
134
- export async function postText(cfg, text, imageUrl) {
136
+ export async function postText(cfg, text, imageUrl, hooks = {}) {
135
137
  const params = {
136
138
  media_type: imageUrl ? 'IMAGE' : 'TEXT',
137
139
  text,
@@ -142,10 +144,10 @@ export async function postText(cfg, text, imageUrl) {
142
144
  const container = await thFetch(cfg.accessToken, '/me/threads', params, 'POST');
143
145
  if (imageUrl)
144
146
  await waitForContainer(cfg, container.id); // 미디어만 처리 대기
145
- return publish(cfg, container.id);
147
+ return publish(cfg, container.id, hooks);
146
148
  }
147
149
  /** public URL의 영상을 Threads 미디어 컨테이너로 만든 뒤 처리 완료 후 게시한다. */
148
- export async function postVideo(cfg, videoUrl, text = '', altText) {
150
+ export async function postVideo(cfg, videoUrl, text = '', altText, hooks = {}) {
149
151
  const params = {
150
152
  media_type: 'VIDEO',
151
153
  video_url: videoUrl,
@@ -156,9 +158,9 @@ export async function postVideo(cfg, videoUrl, text = '', altText) {
156
158
  params.alt_text = altText;
157
159
  const container = await thFetch(cfg.accessToken, '/me/threads', params, 'POST');
158
160
  await waitForContainer(cfg, container.id);
159
- return publish(cfg, container.id);
161
+ return publish(cfg, container.id, hooks);
160
162
  }
161
- export async function postCarousel(cfg, imageUrls, text) {
163
+ export async function postCarousel(cfg, imageUrls, text, hooks = {}) {
162
164
  if (imageUrls.length < 2 || imageUrls.length > 20) {
163
165
  throw new Error(M().carouselCount(imageUrls.length));
164
166
  }
@@ -176,5 +178,5 @@ export async function postCarousel(cfg, imageUrls, text) {
176
178
  // 부모 컨테이너도 비동기로 조립되므로 완료 전에 publish 하지 않는다.
177
179
  await waitForContainer(cfg, carousel.id);
178
180
  // Step 3: publish
179
- return publish(cfg, carousel.id);
181
+ return publish(cfg, carousel.id, hooks);
180
182
  }
@@ -64,7 +64,17 @@ declare function releasePublishLock(openId: string, contentHash: string, lockDir
64
64
  declare function existingBlockingAudit(openId: string, contentHash: string, file?: string): TikTokPublishAudit | null;
65
65
  export declare function planVideoPost(input: PlanVideoPostInput): Promise<TikTokPostPlan>;
66
66
  export declare function loadPostPlan(planId: string): TikTokPostPlan;
67
- export declare function publishPlannedVideo(planId: string, confirmPublish: boolean): Promise<{
67
+ /**
68
+ * Local checks that publishPlannedVideo makes before sending, without network: the plan exists and is fresh, the
69
+ * connected account is the one that made the plan, and this content has no blocking audit. social_publish runs it
70
+ * in its plan so a TikTok problem stops the cross-post before any other platform posts.
71
+ */
72
+ export declare function preflightPlannedVideo(planId: string): TikTokPostPlan;
73
+ export interface PublishPlannedVideoHooks {
74
+ /** Called right before the publish request. A failure before it sent nothing. */
75
+ onPublishStart?: () => void;
76
+ }
77
+ export declare function publishPlannedVideo(planId: string, confirmPublish: boolean, hooks?: PublishPlannedVideoHooks): Promise<{
68
78
  publishId: string;
69
79
  state: string;
70
80
  planId: string;
@@ -6,6 +6,7 @@ import { CREDENTIAL_DIR_MODE, CREDENTIAL_FILE_MODE, writeJsonAtomic } from '#cor
6
6
  import { validateVideo } from '../video/render.js';
7
7
  import { TikTokApiError, getPublishStatus, getVideoSettings, publishVideo } from './api.js';
8
8
  import { ensureTikTokPublishConfig } from './auth.js';
9
+ import { requireTikTokBusinessConfig } from './config.js';
9
10
  import { catalog } from '#core/lang.js';
10
11
  import { readJsonFile } from '../lib/json-file.js';
11
12
  const M = catalog({
@@ -308,7 +309,22 @@ export function loadPostPlan(planId) {
308
309
  throw new Error(M().planExpired);
309
310
  return plan;
310
311
  }
311
- export async function publishPlannedVideo(planId, confirmPublish) {
312
+ /**
313
+ * Local checks that publishPlannedVideo makes before sending, without network: the plan exists and is fresh, the
314
+ * connected account is the one that made the plan, and this content has no blocking audit. social_publish runs it
315
+ * in its plan so a TikTok problem stops the cross-post before any other platform posts.
316
+ */
317
+ export function preflightPlannedVideo(planId) {
318
+ const plan = loadPostPlan(planId);
319
+ const config = requireTikTokBusinessConfig();
320
+ if (config.openId !== plan.openId)
321
+ throw new Error(M().accountMismatch);
322
+ const duplicate = existingBlockingAudit(plan.openId, plan.contentHash);
323
+ if (duplicate)
324
+ throw new Error(M().duplicateBlocked(duplicate.state));
325
+ return plan;
326
+ }
327
+ export async function publishPlannedVideo(planId, confirmPublish, hooks = {}) {
312
328
  if (!confirmPublish)
313
329
  throw new Error(M().confirmRequired);
314
330
  const plan = loadPostPlan(planId);
@@ -338,6 +354,7 @@ export async function publishPlannedVideo(planId, confirmPublish) {
338
354
  throw error;
339
355
  }
340
356
  let result;
357
+ hooks.onPublishStart?.();
341
358
  try {
342
359
  result = await publishVideo(config, plan.request);
343
360
  }
@@ -55,7 +55,47 @@ export declare function getYouTubeVideoStatus(auth: OAuth2Client, videoId: strin
55
55
  watchUrl: string | null;
56
56
  studioUrl: string | null;
57
57
  }>;
58
- export declare function uploadYouTubeVideo(auth: OAuth2Client, input: UploadYouTubeVideoInput): Promise<{
58
+ export interface UploadYouTubeVideoHooks {
59
+ /**
60
+ * Called right before the upload request is sent. Everything that fails before it (channel check, file and
61
+ * video validation) has sent nothing; after it, a thrown error may still mean the video was uploaded.
62
+ */
63
+ onUploadStart?: () => void;
64
+ }
65
+ /**
66
+ * Every check the upload makes before sending anything: the authenticated channel, visibility confirmation, the
67
+ * file, title/description/tags, and the video stream (ffprobe). Exported so a caller that posts to several
68
+ * platforms can run it for YouTube before posting anywhere else.
69
+ */
70
+ export declare function prepareYouTubeUpload(auth: OAuth2Client, input: UploadYouTubeVideoInput): Promise<{
71
+ channel: {
72
+ id: string;
73
+ title: string;
74
+ };
75
+ privacyStatus: YouTubePrivacyStatus;
76
+ file: {
77
+ size: number;
78
+ mimeType: string;
79
+ };
80
+ validation: {
81
+ valid: boolean;
82
+ format: unknown;
83
+ streams: unknown[];
84
+ issues: string[];
85
+ };
86
+ facts: {
87
+ width?: number;
88
+ height?: number;
89
+ durationSec?: number;
90
+ };
91
+ }>;
92
+ export type PreparedYouTubeUpload = Awaited<ReturnType<typeof prepareYouTubeUpload>>;
93
+ /**
94
+ * `prepared` skips the pre-upload checks when the caller already ran prepareYouTubeUpload for this exact input
95
+ * (social_publish does, before posting anywhere): repeating them would cost quota and an ffprobe, and could fail
96
+ * late on a transient error after other platforms are live.
97
+ */
98
+ export declare function uploadYouTubeVideo(auth: OAuth2Client, input: UploadYouTubeVideoInput, hooks?: UploadYouTubeVideoHooks, prepared?: PreparedYouTubeUpload): Promise<{
59
99
  authenticatedChannel: {
60
100
  id: string;
61
101
  title: string;
@@ -125,7 +125,12 @@ export async function getYouTubeVideoStatus(auth, videoId) {
125
125
  throw new Error(M().notFound(videoId));
126
126
  return safeStatus(video);
127
127
  }
128
- export async function uploadYouTubeVideo(auth, input) {
128
+ /**
129
+ * Every check the upload makes before sending anything: the authenticated channel, visibility confirmation, the
130
+ * file, title/description/tags, and the video stream (ffprobe). Exported so a caller that posts to several
131
+ * platforms can run it for YouTube before posting anywhere else.
132
+ */
133
+ export async function prepareYouTubeUpload(auth, input) {
129
134
  if (!input.expectedChannelId)
130
135
  throw new Error('expectedChannelId is required before uploading.');
131
136
  const channel = await verifyYouTubeChannel(auth, input.expectedChannelId);
@@ -144,9 +149,19 @@ export async function uploadYouTubeVideo(auth, input) {
144
149
  }
145
150
  if (input.shortsOnly)
146
151
  assertShortsCompatible(facts);
152
+ return { channel, privacyStatus, file, validation, facts };
153
+ }
154
+ /**
155
+ * `prepared` skips the pre-upload checks when the caller already ran prepareYouTubeUpload for this exact input
156
+ * (social_publish does, before posting anywhere): repeating them would cost quota and an ffprobe, and could fail
157
+ * late on a transient error after other platforms are live.
158
+ */
159
+ export async function uploadYouTubeVideo(auth, input, hooks = {}, prepared) {
160
+ const { channel, privacyStatus, file, validation, facts } = prepared ?? await prepareYouTubeUpload(auth, input);
147
161
  const youtube = google.youtube({ version: 'v3', auth });
148
162
  // try 는 업로드 호출만 감싼다 — 응답 검사(videoId 없음)를 같은 try 에 두면 catch 에서 메시지 문구로 구분해야 했다.
149
163
  let response;
164
+ hooks.onUploadStart?.();
150
165
  try {
151
166
  response = await youtube.videos.insert({
152
167
  part: ['snippet', 'status'],
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@yoonion/mimi-seed-mcp",
3
- "version": "0.25.4",
3
+ "version": "0.25.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@yoonion/mimi-seed-mcp",
9
- "version": "0.25.4",
9
+ "version": "0.25.5",
10
10
  "license": "PolyForm-Noncommercial-1.0.0",
11
11
  "dependencies": {
12
12
  "@googleapis/admob": "^11.0.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoonion/mimi-seed-mcp",
3
- "version": "0.25.4",
3
+ "version": "0.25.5",
4
4
  "description": "Mimi Seed MCP server \u2014 Firebase + AdMob + Google Play + App Store management for Claude Code / Codex / Cursor / any MCP client.",
5
5
  "type": "module",
6
6
  "imports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$comment": "등록된 MCP 도구 + 도메인 메타데이터(label·credential·summary) + 도구 분류(write·destructive·local·idempotent → MCP annotations·confirm 가드) + toolset 그룹·폐기 별칭의 SSOT (src/lib/tool-registrar.ts 가 읽는다). src/__tests__/tool-manifest.test.ts 가 실제 서버 등록 목록과 diff 하고 메타데이터 정합성을 검사한다. 도구 추가/삭제/개명 시 이 파일을 함께 갱신할 것 — 산문 문서에는 정확한 개수를 쓰지 말고 이 파일을 가리킬 것. mimi-seed://tools/catalog 리소스가 이 파일을 그대로 서빙한다.",
3
- "total": 256,
3
+ "total": 257,
4
4
  "alwaysOn": [
5
5
  "auth",
6
6
  "checks"
@@ -42,7 +42,8 @@
42
42
  "instagram",
43
43
  "threads",
44
44
  "tiktok",
45
- "youtube"
45
+ "youtube",
46
+ "crosspost"
46
47
  ],
47
48
  "media": [
48
49
  "video",
@@ -792,6 +793,23 @@
792
793
  "tiktok_business_get_publish_status"
793
794
  ]
794
795
  },
796
+ "crosspost": {
797
+ "label": "소셜 통합 게시",
798
+ "credential": "플랫폼별 연결 (mimi-seed auth social)",
799
+ "summary": "여러 소셜 플랫폼에 한 번에 게시·중복 게시 방지",
800
+ "tools": [
801
+ "social_publish"
802
+ ],
803
+ "write": [],
804
+ "destructive": [
805
+ "social_publish"
806
+ ],
807
+ "ownGate": [
808
+ "social_publish"
809
+ ],
810
+ "local": [],
811
+ "idempotent": []
812
+ },
795
813
  "video": {
796
814
  "label": "영상 제작",
797
815
  "credential": "기능별 API 키 + Google OAuth(YouTube 게시) + FFmpeg",