@yoonion/mimi-seed-mcp 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appstore/auth.js +4 -1
- package/dist/auth/bigquery-auth.d.ts +1 -2
- package/dist/auth/bigquery-auth.js +2 -2
- package/dist/auth/bigquery-setup-cli.js +2 -2
- package/dist/auth/playstore-auth.d.ts +1 -1
- package/dist/auth/playstore-auth.js +2 -2
- package/dist/lib/google-auth-lite.d.ts +3 -0
- package/dist/lib/google-auth-lite.js +29 -0
- package/dist/lib/googleapis-lite.d.ts +17 -39
- package/dist/lib/googleapis-lite.js +81 -32
- package/dist/playstore/financials.js +2 -2
- package/dist/playstore/tools.d.ts +1 -2
- package/dist/playstore/tools.js +2 -2
- package/package.json +1 -1
package/dist/appstore/auth.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
// jose 는 값 import 하지 않는다 — import 만으로 ~0.6초가 나가고, 이 파일은
|
|
2
|
+
// helpers.ts 를 통해 대부분의 register 에 딸려 들어가 MCP 기동 시간을 그대로 밀어올린다.
|
|
3
|
+
// 실제로 필요한 곳은 generateToken() 하나뿐이라 그 안에서 동적 import 한다.
|
|
2
4
|
import fs from 'node:fs';
|
|
3
5
|
import path from 'node:path';
|
|
4
6
|
import os from 'node:os';
|
|
@@ -41,6 +43,7 @@ function normalizePrivateKey(raw) {
|
|
|
41
43
|
return [header, ...chunks, footer, ''].join('\n');
|
|
42
44
|
}
|
|
43
45
|
export async function generateToken(creds) {
|
|
46
|
+
const { SignJWT, importPKCS8 } = await import('jose');
|
|
44
47
|
const normalizedKey = normalizePrivateKey(creds.privateKey);
|
|
45
48
|
let key;
|
|
46
49
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { newJWT } from '../lib/google-auth-lite.js';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import os from 'node:os';
|
|
@@ -55,7 +55,7 @@ export function deleteBigQueryServiceAccountJson() {
|
|
|
55
55
|
return true;
|
|
56
56
|
}
|
|
57
57
|
function makeJwt(sa) {
|
|
58
|
-
return
|
|
58
|
+
return newJWT({ email: sa.client_email, key: sa.private_key, scopes: BQ_SCOPES });
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* BigQuery 인증 클라이언트 해석. 우선순위:
|
|
@@ -3,7 +3,7 @@ import readline from 'node:readline';
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import { saveBigQueryServiceAccountJson, getBigQueryServiceAccountKey, } from './bigquery-auth.js';
|
|
5
5
|
import * as bigquery from '../bigquery/tools.js';
|
|
6
|
-
import {
|
|
6
|
+
import { newJWT } from '../lib/google-auth-lite.js';
|
|
7
7
|
import { resolveLang } from '../lib/lang.js';
|
|
8
8
|
// ko 가 원본이고 en 은 `typeof ko` 를 만족해야 한다 — 키를 빠뜨리면 컴파일이 깨진다.
|
|
9
9
|
const ko = {
|
|
@@ -111,7 +111,7 @@ async function main() {
|
|
|
111
111
|
if (projectId) {
|
|
112
112
|
console.log(M.probing(projectId));
|
|
113
113
|
try {
|
|
114
|
-
const jwt =
|
|
114
|
+
const jwt = newJWT({
|
|
115
115
|
email: parsed.client_email,
|
|
116
116
|
key: parsed.private_key,
|
|
117
117
|
scopes: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { newJWT } from '../lib/google-auth-lite.js';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import os from 'node:os';
|
|
@@ -106,7 +106,7 @@ export function getServiceAccountClient(packageName) {
|
|
|
106
106
|
return null;
|
|
107
107
|
try {
|
|
108
108
|
const parsed = JSON.parse(json);
|
|
109
|
-
return
|
|
109
|
+
return newJWT({
|
|
110
110
|
email: parsed.client_email,
|
|
111
111
|
key: parsed.private_key,
|
|
112
112
|
// androidpublisher(edits/리스팅 등) + Developer Reporting(vitals 통계). 통계 도구가
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* google-auth-library 지연 로더 — googleapis-lite 와 같은 목적, 같은 기법.
|
|
3
|
+
*
|
|
4
|
+
* `import { JWT } from 'google-auth-library'` 는 그 자체로 ~0.6초다. 문제는 이게
|
|
5
|
+
* helpers.ts → 12개 register 로 전파돼, 도구를 하나도 호출하지 않아도 MCP 기동 때
|
|
6
|
+
* 무조건 지불된다는 점이다. 콜드 캐시에서는 이런 항목들이 합쳐져 기동이 25초까지 튀고,
|
|
7
|
+
* Claude Code 의 기본 5초 MCP 연결 타임아웃을 넘겨 서버가 통째로 등록되지 않는다.
|
|
8
|
+
*
|
|
9
|
+
* google-auth-library 는 `type: module` 도 `exports` 맵도 없는 순수 CJS 라
|
|
10
|
+
* `createRequire` 로 **동기** 로드가 된다. 덕분에 `getServiceAccountClient()` 처럼
|
|
11
|
+
* 이미 동기인 함수를 async 로 바꾸지 않고도 지연 로딩이 가능하다.
|
|
12
|
+
*
|
|
13
|
+
* 규칙:
|
|
14
|
+
* - `JWT` 를 **값으로** 쓰려면 이 파일의 `newJWT()` 를 쓴다.
|
|
15
|
+
* - 타입만 필요하면 `import type { JWT } from 'google-auth-library'` — 타입 import 는
|
|
16
|
+
* 런타임에 지워지므로 기동 비용이 0 이고 그대로 써도 된다.
|
|
17
|
+
* - 다른 파일에서 `import { JWT } from 'google-auth-library'` (값 import) 는 금지.
|
|
18
|
+
*/
|
|
19
|
+
import { createRequire } from 'node:module';
|
|
20
|
+
const require = createRequire(import.meta.url);
|
|
21
|
+
let cached;
|
|
22
|
+
function lib() {
|
|
23
|
+
cached ??= require('google-auth-library');
|
|
24
|
+
return cached;
|
|
25
|
+
}
|
|
26
|
+
/** `new JWT(opts)` 와 동일. 첫 호출에서만 google-auth-library 를 로드한다. */
|
|
27
|
+
export function newJWT(opts) {
|
|
28
|
+
return new (lib().JWT)(opts);
|
|
29
|
+
}
|
|
@@ -1,43 +1,21 @@
|
|
|
1
|
+
export type { youtube_v3 } from 'googleapis/build/src/apis/youtube/index.js';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* `import { google } from 'googleapis'` 는 import 시점에 400여 개 API 클라이언트를
|
|
5
|
-
* 전부 로드해 그것만으로 ~19초를 쓴다. 그 결과 MCP 서버 기동(21~36초)이 Claude Code 의
|
|
6
|
-
* MCP 연결 타임아웃(30초)을 상습 초과해, 세션에서 mimi-seed 도구가 아예 등록되지 않는
|
|
7
|
-
* 사고가 났다 (2026-07-24). 실제 사용하는 API 만 서브패스로 로드하면 ~1초대다.
|
|
8
|
-
*
|
|
9
|
-
* - 새 Google API 가 필요하면 여기에 import 한 줄 + google 객체에 한 줄 추가한다.
|
|
10
|
-
* - 다른 파일에서 `from 'googleapis'` 값 import 는 금지 — 반드시 이 모듈을 거친다.
|
|
11
|
-
* (googleapis 는 exports map 이 없어 서브패스 import 가 공식적으로 가능하다.)
|
|
12
|
-
* - `auth` 는 AuthPlus 인스턴스라 `google.auth.OAuth2` 등 기존 사용처가 그대로 동작한다.
|
|
3
|
+
* 기존 `google.<api>(...)` 호출부와 100% 동일하게 동작하는 지연 로딩 네임스페이스.
|
|
4
|
+
* 각 프로퍼티는 getter 라서, 실제로 그 API 를 쓰는 도구가 호출될 때까지 아무것도 로드하지 않는다.
|
|
13
5
|
*/
|
|
14
|
-
import { admob } from 'googleapis/build/src/apis/admob/index.js';
|
|
15
|
-
import { analyticsadmin } from 'googleapis/build/src/apis/analyticsadmin/index.js';
|
|
16
|
-
import { analyticsdata } from 'googleapis/build/src/apis/analyticsdata/index.js';
|
|
17
|
-
import { androidpublisher } from 'googleapis/build/src/apis/androidpublisher/index.js';
|
|
18
|
-
import { bigquery } from 'googleapis/build/src/apis/bigquery/index.js';
|
|
19
|
-
import { billingbudgets } from 'googleapis/build/src/apis/billingbudgets/index.js';
|
|
20
|
-
import { cloudbilling } from 'googleapis/build/src/apis/cloudbilling/index.js';
|
|
21
|
-
import { cloudresourcemanager } from 'googleapis/build/src/apis/cloudresourcemanager/index.js';
|
|
22
|
-
import { firebase } from 'googleapis/build/src/apis/firebase/index.js';
|
|
23
|
-
import { iam } from 'googleapis/build/src/apis/iam/index.js';
|
|
24
|
-
import { searchconsole } from 'googleapis/build/src/apis/searchconsole/index.js';
|
|
25
|
-
import { serviceusage } from 'googleapis/build/src/apis/serviceusage/index.js';
|
|
26
|
-
import { youtube } from 'googleapis/build/src/apis/youtube/index.js';
|
|
27
|
-
export type { youtube_v3 } from 'googleapis/build/src/apis/youtube/index.js';
|
|
28
6
|
export declare const google: {
|
|
29
|
-
auth: import("googleapis
|
|
30
|
-
admob: typeof admob;
|
|
31
|
-
analyticsadmin: typeof analyticsadmin;
|
|
32
|
-
analyticsdata: typeof analyticsdata;
|
|
33
|
-
androidpublisher: typeof androidpublisher;
|
|
34
|
-
bigquery: typeof bigquery;
|
|
35
|
-
billingbudgets: typeof billingbudgets;
|
|
36
|
-
cloudbilling: typeof cloudbilling;
|
|
37
|
-
cloudresourcemanager: typeof cloudresourcemanager;
|
|
38
|
-
firebase: typeof firebase;
|
|
39
|
-
iam: typeof iam;
|
|
40
|
-
searchconsole: typeof searchconsole;
|
|
41
|
-
serviceusage: typeof serviceusage;
|
|
42
|
-
youtube: typeof youtube;
|
|
7
|
+
readonly auth: typeof import("googleapis/build/src/apis/firebase/index.js").auth;
|
|
8
|
+
readonly admob: typeof import("googleapis/build/src/apis/admob/index.js").admob;
|
|
9
|
+
readonly analyticsadmin: typeof import("googleapis/build/src/apis/analyticsadmin/index.js").analyticsadmin;
|
|
10
|
+
readonly analyticsdata: typeof import("googleapis/build/src/apis/analyticsdata/index.js").analyticsdata;
|
|
11
|
+
readonly androidpublisher: typeof import("googleapis/build/src/apis/androidpublisher/index.js").androidpublisher;
|
|
12
|
+
readonly bigquery: typeof import("googleapis/build/src/apis/bigquery/index.js").bigquery;
|
|
13
|
+
readonly billingbudgets: typeof import("googleapis/build/src/apis/billingbudgets/index.js").billingbudgets;
|
|
14
|
+
readonly cloudbilling: typeof import("googleapis/build/src/apis/cloudbilling/index.js").cloudbilling;
|
|
15
|
+
readonly cloudresourcemanager: typeof import("googleapis/build/src/apis/cloudresourcemanager/index.js").cloudresourcemanager;
|
|
16
|
+
readonly firebase: typeof import("googleapis/build/src/apis/firebase/index.js").firebase;
|
|
17
|
+
readonly iam: typeof import("googleapis/build/src/apis/iam/index.js").iam;
|
|
18
|
+
readonly searchconsole: typeof import("googleapis/build/src/apis/searchconsole/index.js").searchconsole;
|
|
19
|
+
readonly serviceusage: typeof import("googleapis/build/src/apis/serviceusage/index.js").serviceusage;
|
|
20
|
+
readonly youtube: typeof import("googleapis/build/src/apis/youtube/index.js").youtube;
|
|
43
21
|
};
|
|
@@ -3,40 +3,89 @@
|
|
|
3
3
|
*
|
|
4
4
|
* `import { google } from 'googleapis'` 는 import 시점에 400여 개 API 클라이언트를
|
|
5
5
|
* 전부 로드해 그것만으로 ~19초를 쓴다. 그 결과 MCP 서버 기동(21~36초)이 Claude Code 의
|
|
6
|
-
* MCP 연결
|
|
7
|
-
* 사고가 났다 (2026-07-24). 실제 사용하는 API 만 서브패스로 로드하면 ~1초대다.
|
|
6
|
+
* MCP 연결 타임아웃을 상습 초과해, 세션에서 mimi-seed 도구가 아예 등록되지 않는
|
|
7
|
+
* 사고가 났다 (2026-07-24). 실제 사용하는 API 만 서브패스로 로드하면 ~1.4초대다.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* 그런데 그 ~1.4초도 **기동 시점에** 전부 나갔다. 서브패스를 정적 import 하면
|
|
10
|
+
* 도구를 하나도 호출하지 않아도 googleapis 공통 런타임(google-auth-library 등)이
|
|
11
|
+
* 딸려 온다. 콜드 캐시(Windows 실시간 검사 등)에서는 이게 25초까지 튀어
|
|
12
|
+
* 기본 5초 연결 타임아웃을 다시 넘겼다 (2026-08-22).
|
|
13
|
+
*
|
|
14
|
+
* 그래서 지금은 **첫 사용 시점까지 미룬다**:
|
|
15
|
+
* - googleapis 는 `type: module` 도 `exports` 맵도 없는 순수 CJS 라
|
|
16
|
+
* `createRequire` 로 **동기** 로드가 가능하다. 그래서 `google.admob(...)` 같은
|
|
17
|
+
* 기존 호출부를 async 로 바꿀 필요가 전혀 없다 — 소비자 코드는 그대로다.
|
|
18
|
+
* - 타입은 `typeof import(...)` 로 얻는다. 타입 위치의 import 는 런타임에 완전히
|
|
19
|
+
* 지워지므로 기동 비용이 0 이다. 절대 값 import 로 바꾸지 말 것 — 그 순간 이 파일의
|
|
20
|
+
* 존재 이유가 사라진다.
|
|
21
|
+
*
|
|
22
|
+
* 규칙:
|
|
23
|
+
* - 새 Google API 가 필요하면 아래 `google` 객체에 getter 한 줄을 추가한다.
|
|
10
24
|
* - 다른 파일에서 `from 'googleapis'` 값 import 는 금지 — 반드시 이 모듈을 거친다.
|
|
11
|
-
* (googleapis 는 exports map 이 없어 서브패스 import 가 공식적으로 가능하다.)
|
|
12
|
-
* - `auth` 는 AuthPlus 인스턴스라 `google.auth.OAuth2` 등 기존 사용처가 그대로 동작한다.
|
|
13
25
|
*/
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
import { createRequire } from 'node:module';
|
|
27
|
+
const require = createRequire(import.meta.url);
|
|
28
|
+
/** 서브패스 모듈 캐시 — require 자체도 캐시하지만 Map 조회가 더 싸다. */
|
|
29
|
+
const cache = new Map();
|
|
30
|
+
/**
|
|
31
|
+
* googleapis 서브패스를 첫 호출 시점에 동기 로드한다.
|
|
32
|
+
* 첫 호출이 공통 런타임까지 함께 지불하고(~1.1초), 이후 다른 서브패스는 ~20ms 다.
|
|
33
|
+
*/
|
|
34
|
+
function sub(name) {
|
|
35
|
+
let mod = cache.get(name);
|
|
36
|
+
if (mod === undefined) {
|
|
37
|
+
mod = require(`googleapis/build/src/apis/${name}/index.js`);
|
|
38
|
+
cache.set(name, mod);
|
|
39
|
+
}
|
|
40
|
+
return mod;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 기존 `google.<api>(...)` 호출부와 100% 동일하게 동작하는 지연 로딩 네임스페이스.
|
|
44
|
+
* 각 프로퍼티는 getter 라서, 실제로 그 API 를 쓰는 도구가 호출될 때까지 아무것도 로드하지 않는다.
|
|
45
|
+
*/
|
|
27
46
|
export const google = {
|
|
28
|
-
auth
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
// auth 는 AuthPlus 인스턴스. 어느 서브패스든 같은 걸 내보내지만,
|
|
48
|
+
// 기존 동작과 동일하게 firebase 서브패스에서 가져온다.
|
|
49
|
+
get auth() {
|
|
50
|
+
return sub('firebase').auth;
|
|
51
|
+
},
|
|
52
|
+
get admob() {
|
|
53
|
+
return sub('admob').admob;
|
|
54
|
+
},
|
|
55
|
+
get analyticsadmin() {
|
|
56
|
+
return sub('analyticsadmin').analyticsadmin;
|
|
57
|
+
},
|
|
58
|
+
get analyticsdata() {
|
|
59
|
+
return sub('analyticsdata').analyticsdata;
|
|
60
|
+
},
|
|
61
|
+
get androidpublisher() {
|
|
62
|
+
return sub('androidpublisher').androidpublisher;
|
|
63
|
+
},
|
|
64
|
+
get bigquery() {
|
|
65
|
+
return sub('bigquery').bigquery;
|
|
66
|
+
},
|
|
67
|
+
get billingbudgets() {
|
|
68
|
+
return sub('billingbudgets').billingbudgets;
|
|
69
|
+
},
|
|
70
|
+
get cloudbilling() {
|
|
71
|
+
return sub('cloudbilling').cloudbilling;
|
|
72
|
+
},
|
|
73
|
+
get cloudresourcemanager() {
|
|
74
|
+
return sub('cloudresourcemanager').cloudresourcemanager;
|
|
75
|
+
},
|
|
76
|
+
get firebase() {
|
|
77
|
+
return sub('firebase').firebase;
|
|
78
|
+
},
|
|
79
|
+
get iam() {
|
|
80
|
+
return sub('iam').iam;
|
|
81
|
+
},
|
|
82
|
+
get searchconsole() {
|
|
83
|
+
return sub('searchconsole').searchconsole;
|
|
84
|
+
},
|
|
85
|
+
get serviceusage() {
|
|
86
|
+
return sub('serviceusage').serviceusage;
|
|
87
|
+
},
|
|
88
|
+
get youtube() {
|
|
89
|
+
return sub('youtube').youtube;
|
|
90
|
+
},
|
|
42
91
|
};
|
|
@@ -11,7 +11,7 @@ import fs from 'node:fs';
|
|
|
11
11
|
import os from 'node:os';
|
|
12
12
|
import path from 'node:path';
|
|
13
13
|
import zlib from 'node:zlib';
|
|
14
|
-
import {
|
|
14
|
+
import { newJWT } from '../lib/google-auth-lite.js';
|
|
15
15
|
import { fetchWithTimeout, HTTP_TRANSFER_TIMEOUT_MS } from '../lib/http.js';
|
|
16
16
|
import { requireServiceAccountJson } from '../helpers.js';
|
|
17
17
|
const CONFIG_PATH = path.join(os.homedir(), '.mimi-seed', 'play-financials.json');
|
|
@@ -68,7 +68,7 @@ function normalizeBucket(raw) {
|
|
|
68
68
|
*/
|
|
69
69
|
function storageClient(packageName) {
|
|
70
70
|
const parsed = JSON.parse(requireServiceAccountJson(packageName));
|
|
71
|
-
return
|
|
71
|
+
return newJWT({
|
|
72
72
|
email: parsed.client_email,
|
|
73
73
|
key: parsed.private_key,
|
|
74
74
|
scopes: [STORAGE_SCOPE],
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { OAuth2Client } from 'google-auth-library';
|
|
2
|
-
import { JWT } from 'google-auth-library';
|
|
1
|
+
import type { OAuth2Client, JWT } from 'google-auth-library';
|
|
3
2
|
export type PlayImageType = 'featureGraphic' | 'icon' | 'phoneScreenshots' | 'promoGraphic' | 'sevenInchScreenshots' | 'tenInchScreenshots' | 'tvBanner' | 'tvScreenshots' | 'wearScreenshots';
|
|
4
3
|
/**
|
|
5
4
|
* Google Play Developer API (Android Publisher API v3) 래퍼
|
package/dist/playstore/tools.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { google } from '../lib/googleapis-lite.js';
|
|
2
|
-
import {
|
|
2
|
+
import { newJWT } from '../lib/google-auth-lite.js';
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import { extractHttpStatus } from '../lib/google-errors.js';
|
|
5
5
|
function mimeTypeFor(filePath) {
|
|
@@ -763,7 +763,7 @@ export async function verifyServiceAccountJson(serviceAccountJson, packageName)
|
|
|
763
763
|
message: `Expected type="service_account", got "${parsed.type}" — make sure you downloaded a service account key, not an OAuth client.`,
|
|
764
764
|
};
|
|
765
765
|
}
|
|
766
|
-
const jwt =
|
|
766
|
+
const jwt = newJWT({
|
|
767
767
|
email: parsed.client_email,
|
|
768
768
|
key: parsed.private_key,
|
|
769
769
|
scopes: ['https://www.googleapis.com/auth/androidpublisher'],
|
package/package.json
CHANGED