@yoonion/mimi-seed-mcp 0.3.17 → 0.3.19

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/LICENSE ADDED
@@ -0,0 +1,75 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ Required Notice: Copyright 2026 Pryzm GG (https://mimi-seed.pryzm.gg)
6
+
7
+ ## Acceptance
8
+
9
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
14
+
15
+ ## Distribution License
16
+
17
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
18
+
19
+ ## Notices
20
+
21
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
22
+
23
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
24
+
25
+ ## Changes and New Works License
26
+
27
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
28
+
29
+ ## Patent License
30
+
31
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
32
+
33
+ ## Noncommercial Purposes
34
+
35
+ Any noncommercial purpose is a permitted purpose.
36
+
37
+ ## Personal Uses
38
+
39
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
40
+
41
+ ## Noncommercial Organizations
42
+
43
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
44
+
45
+ ## Fair Use
46
+
47
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
48
+
49
+ ## No Other Rights
50
+
51
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
52
+
53
+ ## Patent Defense
54
+
55
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
56
+
57
+ ## Violations
58
+
59
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
60
+
61
+ ## No Liability
62
+
63
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
64
+
65
+ ## Definitions
66
+
67
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
68
+
69
+ **You** refers to the individual or entity agreeing to these terms.
70
+
71
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
72
+
73
+ **Your licenses** are all the licenses granted to you for the software under these terms.
74
+
75
+ **Use** means anything you do with the software requiring one of your licenses.
package/dist/auth/cli.js CHANGED
@@ -3,7 +3,7 @@ import readline from 'node:readline';
3
3
  import open from 'open';
4
4
  import { startAuth, getStoredTokens, ensureFreshAccessToken, } from './google-auth.js';
5
5
  import { AuthError, classifyError } from './errors.js';
6
- import { MIMI_SEED_CLIENT_ID, MIMI_SEED_CLIENT_SECRET } from './constants.js';
6
+ import { getMcpOAuthClient } from './constants.js';
7
7
  const args = process.argv.slice(2);
8
8
  const hasFlag = (name) => args.includes(`--${name}`);
9
9
  const flagValue = (name) => {
@@ -158,7 +158,8 @@ async function cmdLogin() {
158
158
  let url;
159
159
  let wait;
160
160
  try {
161
- const r = startAuth(MIMI_SEED_CLIENT_ID, MIMI_SEED_CLIENT_SECRET, {
161
+ const { clientId, clientSecret } = await getMcpOAuthClient();
162
+ const r = startAuth(clientId, clientSecret, {
162
163
  timeoutMs: timeoutSec * 1000,
163
164
  });
164
165
  url = r.url;
@@ -1,2 +1,4 @@
1
- export declare const MIMI_SEED_CLIENT_ID: string;
2
- export declare const MIMI_SEED_CLIENT_SECRET: string;
1
+ export declare function getMcpOAuthClient(): Promise<{
2
+ clientId: string;
3
+ clientSecret: string;
4
+ }>;
@@ -1,11 +1,17 @@
1
- // Mimi Seed 내장 OAuth 클라이언트
2
- // 유저가 직접 만들 필요 없음 — `npx -y @yoonion/mimi-seed-mcp mimi-seed-auth`
3
- // (또는 로컬 dev 중엔 `npm run auth`) 한 줄이면 끝
4
- // 환경변수 MIMI_SEED_GOOGLE_CLIENT_ID / MIMI_SEED_GOOGLE_CLIENT_SECRET 로 오버라이드 가능
5
- // (레거시 PRESEED_GOOGLE_CLIENT_ID / PRESEED_GOOGLE_CLIENT_SECRET 도 계속 인식)
6
- export const MIMI_SEED_CLIENT_ID = process.env.MIMI_SEED_GOOGLE_CLIENT_ID ??
7
- process.env.PRESEED_GOOGLE_CLIENT_ID ??
8
- '980022244769-b6qugfe22pvfadg6ccaq699pc7nuju70.apps.googleusercontent.com';
9
- export const MIMI_SEED_CLIENT_SECRET = process.env.MIMI_SEED_GOOGLE_CLIENT_SECRET ??
10
- process.env.PRESEED_GOOGLE_CLIENT_SECRET ??
11
- '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';
1
+ const WEB_BASE = process.env.MIMI_SEED_WEB_BASE ?? 'https://mimi-seed.pryzm.gg';
2
+ let _cached = null;
3
+ export async function getMcpOAuthClient() {
4
+ const id = process.env.MIMI_SEED_GOOGLE_CLIENT_ID ??
5
+ process.env.PRESEED_GOOGLE_CLIENT_ID;
6
+ const secret = process.env.MIMI_SEED_GOOGLE_CLIENT_SECRET ??
7
+ process.env.PRESEED_GOOGLE_CLIENT_SECRET;
8
+ if (id && secret)
9
+ return { clientId: id, clientSecret: secret };
10
+ if (_cached)
11
+ return _cached;
12
+ const res = await fetch(`${WEB_BASE}/api/mcp-auth-config`);
13
+ if (!res.ok)
14
+ throw new Error(`mcp-auth-config fetch failed (${res.status})`);
15
+ _cached = (await res.json());
16
+ return _cached;
17
+ }
@@ -4,7 +4,7 @@ import open from 'open';
4
4
  import fs from 'node:fs';
5
5
  import path from 'node:path';
6
6
  import os from 'node:os';
7
- import { MIMI_SEED_CLIENT_ID, MIMI_SEED_CLIENT_SECRET } from './constants.js';
7
+ import { getMcpOAuthClient } from './constants.js';
8
8
  import { AuthError, classifyError } from './errors.js';
9
9
  const SCOPES = [
10
10
  'https://www.googleapis.com/auth/firebase',
@@ -285,10 +285,11 @@ export async function ensureFreshAccessToken(marginMs = 60_000) {
285
285
  },
286
286
  };
287
287
  }
288
- // refresh 시도 — credentials.json 우선, 없으면 내장 클라이언트 사용
288
+ // refresh 시도 — credentials.json 우선, 없으면 원격에서 클라이언트 조회
289
289
  const stored = getStoredCredentials();
290
- const clientId = stored?.clientId ?? MIMI_SEED_CLIENT_ID;
291
- const clientSecret = stored?.clientSecret ?? MIMI_SEED_CLIENT_SECRET;
290
+ const { clientId: defaultId, clientSecret: defaultSecret } = await getMcpOAuthClient();
291
+ const clientId = stored?.clientId ?? defaultId;
292
+ const clientSecret = stored?.clientSecret ?? defaultSecret;
292
293
  const client = createOAuth2Client(clientId, clientSecret);
293
294
  client.setCredentials({ refresh_token: tokens.refresh_token });
294
295
  try {
@@ -0,0 +1,8 @@
1
+ import { ensureFreshAccessToken } from './auth/google-auth.js';
2
+ export { ensureFreshAccessToken };
3
+ export declare function requireAuth(): import("google-auth-library").OAuth2Client;
4
+ export declare const PLAY_AUTH_HINT: string;
5
+ export declare const APPSTORE_AUTH_HINT: string;
6
+ export declare function requirePlayStoreAuth(packageName?: string): import("google-auth-library").JWT;
7
+ export declare function requireServiceAccountJson(packageName?: string): string;
8
+ export declare function requireAppStoreCreds(): import("./appstore/auth.js").AppStoreCredentials;
@@ -0,0 +1,58 @@
1
+ import { getAuthenticatedClient, ensureFreshAccessToken } from './auth/google-auth.js';
2
+ import { getServiceAccountClient, getServiceAccountJson } from './auth/playstore-auth.js';
3
+ import { getAppStoreCredentials } from './appstore/auth.js';
4
+ export { ensureFreshAccessToken };
5
+ export function requireAuth() {
6
+ const client = getAuthenticatedClient();
7
+ if (!client) {
8
+ throw new Error([
9
+ '❌ Google 계정이 연결되지 않았어.',
10
+ '',
11
+ '터미널에서 이것만 실행하면 돼:',
12
+ '',
13
+ ' npx -y @yoonion/mimi-seed-mcp mimi-seed-auth',
14
+ '',
15
+ '브라우저가 열리면 Google 로그인 → 끝.',
16
+ '그 다음에 다시 물어봐줘.',
17
+ ].join('\n'));
18
+ }
19
+ return client;
20
+ }
21
+ export const PLAY_AUTH_HINT = [
22
+ '❌ Google Play 서비스 계정이 연결되지 않았어.',
23
+ '',
24
+ '터미널에서 이것만 실행하면 돼:',
25
+ '',
26
+ ' npx -y @yoonion/mimi-seed-mcp mimi-seed-playstore-auth',
27
+ '',
28
+ '서비스 계정 JSON 파일 경로를 입력하면 저장 완료.',
29
+ '그 다음에 다시 물어봐줘.',
30
+ ].join('\n');
31
+ export const APPSTORE_AUTH_HINT = [
32
+ '❌ App Store Connect 인증이 설정되지 않았어.',
33
+ '',
34
+ '터미널에서 이것만 실행하면 돼:',
35
+ '',
36
+ ' npx -y @yoonion/mimi-seed-mcp mimi-seed-appstore-auth',
37
+ '',
38
+ 'Issuer ID, Key ID, .p8 파일 경로를 입력하면 저장 완료.',
39
+ '그 다음에 다시 물어봐줘.',
40
+ ].join('\n');
41
+ export function requirePlayStoreAuth(packageName) {
42
+ const client = getServiceAccountClient(packageName);
43
+ if (!client)
44
+ throw new Error(PLAY_AUTH_HINT);
45
+ return client;
46
+ }
47
+ export function requireServiceAccountJson(packageName) {
48
+ const json = getServiceAccountJson(packageName);
49
+ if (!json)
50
+ throw new Error(PLAY_AUTH_HINT);
51
+ return json;
52
+ }
53
+ export function requireAppStoreCreds() {
54
+ const creds = getAppStoreCredentials();
55
+ if (!creds)
56
+ throw new Error(APPSTORE_AUTH_HINT);
57
+ return creds;
58
+ }