@yoonion/mimi-seed-mcp 0.25.3 → 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.
Files changed (63) hide show
  1. package/README.md +2 -1
  2. package/assets/agent-guide.md +37 -9
  3. package/dist/auth/cli.js +2 -2
  4. package/dist/auth/constants.js +4 -3
  5. package/dist/auth/errors.js +4 -1
  6. package/dist/auth/google-auth.d.ts +14 -0
  7. package/dist/auth/google-auth.js +19 -1
  8. package/dist/core/console-url.d.ts +17 -2
  9. package/dist/core/console-url.js +54 -16
  10. package/dist/core/credential-store.js +2 -0
  11. package/dist/crosspost/ledger.d.ts +52 -0
  12. package/dist/crosspost/ledger.js +269 -0
  13. package/dist/crosspost/tools.d.ts +136 -0
  14. package/dist/crosspost/tools.js +821 -0
  15. package/dist/drive/tools.d.ts +0 -1
  16. package/dist/drive/tools.js +19 -1
  17. package/dist/facebook/api.d.ts +3 -2
  18. package/dist/facebook/api.js +6 -2
  19. package/dist/i18n/manifest-en.js +3 -0
  20. package/dist/i18n/tools-en/android.d.ts +2 -2
  21. package/dist/i18n/tools-en/android.js +2 -2
  22. package/dist/i18n/tools-en/crosspost.d.ts +23 -0
  23. package/dist/i18n/tools-en/crosspost.js +22 -0
  24. package/dist/i18n/tools-en/index.js +2 -0
  25. package/dist/i18n/tools-en/jenkins.d.ts +4 -4
  26. package/dist/i18n/tools-en/jenkins.js +4 -4
  27. package/dist/instagram/api.d.ts +3 -2
  28. package/dist/instagram/api.js +6 -2
  29. package/dist/instagram/browser-login.js +2 -5
  30. package/dist/jenkins/credentials.d.ts +7 -3
  31. package/dist/jenkins/credentials.js +4 -0
  32. package/dist/jenkins/messages.d.ts +2 -0
  33. package/dist/jenkins/messages.js +15 -0
  34. package/dist/lib/human-approval.d.ts +1 -1
  35. package/dist/lib/human-approval.js +4 -3
  36. package/dist/lib/meta-auth.d.ts +9 -0
  37. package/dist/lib/meta-auth.js +12 -3
  38. package/dist/lib/tool-menu.js +2 -1
  39. package/dist/lib/tool-registrar.js +13 -5
  40. package/dist/registers/android.js +10 -7
  41. package/dist/registers/auth.js +11 -5
  42. package/dist/registers/crosspost.d.ts +2 -0
  43. package/dist/registers/crosspost.js +81 -0
  44. package/dist/registers/jenkins.js +20 -8
  45. package/dist/remote-sync.js +8 -4
  46. package/dist/server.js +2 -0
  47. package/dist/social/broker-base.d.ts +7 -0
  48. package/dist/social/broker-base.js +11 -0
  49. package/dist/social/meta-app-config.d.ts +19 -0
  50. package/dist/social/meta-app-config.js +83 -0
  51. package/dist/social/meta-direct-login.d.ts +45 -0
  52. package/dist/social/meta-direct-login.js +307 -0
  53. package/dist/social/setup-cli.js +228 -20
  54. package/dist/threads/api.d.ts +4 -3
  55. package/dist/threads/api.js +9 -7
  56. package/dist/threads/browser-login.js +2 -5
  57. package/dist/tiktok-business/posting.d.ts +11 -1
  58. package/dist/tiktok-business/posting.js +18 -1
  59. package/dist/video/youtube-publish.d.ts +41 -1
  60. package/dist/video/youtube-publish.js +16 -1
  61. package/npm-shrinkwrap.json +2 -2
  62. package/package.json +1 -1
  63. package/tool-manifest.json +28 -8
@@ -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
  }
@@ -1,4 +1,4 @@
1
- import { consoleUrl } from '#core/console-url.js';
1
+ import { socialBrokerBase } from '../social/broker-base.js';
2
2
  import { createServer } from 'node:http';
3
3
  import { randomBytes, createHash, timingSafeEqual } from 'node:crypto';
4
4
  import { fetchWithTimeout } from '../lib/http.js';
@@ -17,13 +17,10 @@ export async function connectThreadsInBrowser(options = {}) {
17
17
  // Freeze the selected profile before any asynchronous work / directory changes.
18
18
  const target = resolveSocialConfigTarget('threads', options);
19
19
  const saveOptions = { ...options, profile: target.profile ?? undefined, startDir: options.startDir ?? process.cwd() };
20
- const url = consoleUrl(options.webBase ?? process.env.MIMI_SEED_WEB_BASE);
20
+ const url = socialBrokerBase(options.webBase ?? process.env.MIMI_SEED_WEB_BASE);
21
21
  if (!url)
22
22
  throw new ThreadsLoginError('configuration');
23
23
  const base = new URL(url);
24
- if (base.protocol !== 'https:' || base.username || base.password || base.search || base.hash || base.pathname !== '/') {
25
- throw new ThreadsLoginError('configuration');
26
- }
27
24
  const state = randomBytes(32).toString('hex');
28
25
  const verifier = randomBytes(32).toString('base64url');
29
26
  const codeChallenge = createHash('sha256').update(verifier).digest('base64url');
@@ -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.3",
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.3",
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.3",
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",
@@ -116,9 +117,6 @@
116
117
  ],
117
118
  "idempotent": [
118
119
  "jenkins_upload_playstore_sa"
119
- ],
120
- "approval": [
121
- "jenkins_upload_playstore_sa"
122
120
  ]
123
121
  },
124
122
  "appstore": {
@@ -635,9 +633,7 @@
635
633
  "jenkins_update_job"
636
634
  ],
637
635
  "approval": [
638
- "jenkins_save_config",
639
- "jenkins_create_credential",
640
- "jenkins_upload_keystore"
636
+ "jenkins_save_config"
641
637
  ]
642
638
  },
643
639
  "playstore": {
@@ -729,6 +725,9 @@
729
725
  "playstore_update_product_state",
730
726
  "playstore_update_product",
731
727
  "playstore_register_service_account"
728
+ ],
729
+ "approval": [
730
+ "playstore_register_service_account"
732
731
  ]
733
732
  },
734
733
  "threads": {
@@ -794,6 +793,23 @@
794
793
  "tiktok_business_get_publish_status"
795
794
  ]
796
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
+ },
797
813
  "video": {
798
814
  "label": "영상 제작",
799
815
  "credential": "기능별 API 키 + Google OAuth(YouTube 게시) + FFmpeg",
@@ -908,6 +924,10 @@
908
924
  "idempotent": [
909
925
  "drive_create_folder",
910
926
  "drive_update_file_metadata"
927
+ ],
928
+ "approval": [
929
+ "drive_upload_file",
930
+ "drive_update_file_metadata"
911
931
  ]
912
932
  }
913
933
  }