@yoonion/mimi-seed-mcp 0.33.0 → 0.34.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 +4 -0
- package/dist/core/usage.d.ts +28 -0
- package/dist/core/usage.js +73 -0
- package/dist/lib/tool-registrar.js +12 -4
- package/dist/registers/auth.js +3 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Connected app-release operations for Claude Code, Codex and other MCP clients.
|
|
4
4
|
|
|
5
|
+
Usage measurement is off by default. Run `npx mimi-seed telemetry --help` to review the shared CLI and
|
|
6
|
+
local MCP setting. With consent, successful tool activity is counted without tool names, arguments or responses.
|
|
7
|
+
See the [measurement guide](https://github.com/jeonghwanko/mimi-seed-sdk/blob/main/docs/growth/measurement.md).
|
|
8
|
+
|
|
5
9
|
Start with a lightweight, account-free check in your app repository (Node 22+):
|
|
6
10
|
|
|
7
11
|
```bash
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const PUBLIC_COLLECTOR = "https://mimi-seed.oddbout.com";
|
|
2
|
+
export declare function collectorBase(env?: NodeJS.ProcessEnv): string | null;
|
|
3
|
+
export type Consent = {
|
|
4
|
+
enabled: false;
|
|
5
|
+
} | {
|
|
6
|
+
enabled: true;
|
|
7
|
+
webBase: string;
|
|
8
|
+
installationId: string;
|
|
9
|
+
salt: string;
|
|
10
|
+
scope?: 'sdk';
|
|
11
|
+
};
|
|
12
|
+
export declare const consentPath: () => string;
|
|
13
|
+
export declare function readConsent(webBase: string): Consent;
|
|
14
|
+
export declare function isUsageCI(env: NodeJS.ProcessEnv): boolean;
|
|
15
|
+
export type Activity = 'init' | 'doctor' | 'notes' | 'review' | 'deploy' | 'remote-check' | 'mcp' | 'social-mcp';
|
|
16
|
+
type Send = (url: string, init: RequestInit, timeout: number) => Promise<{
|
|
17
|
+
ok: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
export type DailySlot = {
|
|
20
|
+
key?: string;
|
|
21
|
+
retryAfter?: number;
|
|
22
|
+
};
|
|
23
|
+
export declare function activityConsent(env: NodeJS.ProcessEnv): {
|
|
24
|
+
base: string;
|
|
25
|
+
installationId: string;
|
|
26
|
+
} | undefined;
|
|
27
|
+
export declare function beginActivity(command: Activity, env: NodeJS.ProcessEnv, send: Send, slot?: DailySlot): (() => Promise<void>) | undefined;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { randomUUID } from 'node:crypto';
|
|
5
|
+
import { consoleBase } from './console-url.js';
|
|
6
|
+
export const PUBLIC_COLLECTOR = 'https://mimi-seed.oddbout.com';
|
|
7
|
+
export function collectorBase(env = process.env) {
|
|
8
|
+
const configured = env.MIMI_SEED_WEB_BASE;
|
|
9
|
+
if (!configured || configured === PUBLIC_COLLECTOR || configured === `${PUBLIC_COLLECTOR}/`) {
|
|
10
|
+
return PUBLIC_COLLECTOR;
|
|
11
|
+
}
|
|
12
|
+
return consoleBase(configured);
|
|
13
|
+
}
|
|
14
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
15
|
+
const uuid = (value) => typeof value === 'string' && UUID.test(value);
|
|
16
|
+
export const consentPath = () => path.join(os.homedir(), ".mimi-seed", "telemetry.json");
|
|
17
|
+
export function readConsent(webBase) {
|
|
18
|
+
try {
|
|
19
|
+
const saved = JSON.parse(fs.readFileSync(consentPath(), "utf8"));
|
|
20
|
+
// Consent and pseudonymous identifiers belong to the collector the user selected.
|
|
21
|
+
// Never project unvalidated local strings into a request or repair consent during an operation.
|
|
22
|
+
if (saved.enabled === true && saved.webBase === webBase && uuid(saved.installationId)
|
|
23
|
+
&& uuid(saved.salt) && (saved.scope === undefined || saved.scope === 'sdk'))
|
|
24
|
+
return saved;
|
|
25
|
+
return { enabled: false };
|
|
26
|
+
}
|
|
27
|
+
catch { /* Missing or unreadable consent never authorizes collection. */
|
|
28
|
+
return { enabled: false };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function isUsageCI(env) {
|
|
32
|
+
return ['CI', 'GITHUB_ACTIONS', 'GITLAB_CI', 'JENKINS_URL', 'BUILD_BUILDID', 'CIRCLECI', 'BUILDKITE', 'BITBUCKET_BUILD_NUMBER', 'TF_BUILD',
|
|
33
|
+
'TEAMCITY_VERSION', 'TRAVIS', 'CODEBUILD_BUILD_ID', 'DRONE', 'VERCEL', 'NETLIFY', 'MIMI_SEED_AUTOMATED']
|
|
34
|
+
.some(key => !!env[key] && !/^(false|0)$/i.test(env[key]));
|
|
35
|
+
}
|
|
36
|
+
// A saved legacy consent covers only v1 check/setup. Environment overrides never extend it.
|
|
37
|
+
export function activityConsent(env) {
|
|
38
|
+
const base = collectorBase(env);
|
|
39
|
+
if (!base || (env.MIMI_SEED_TELEMETRY !== undefined && env.MIMI_SEED_TELEMETRY !== '1'))
|
|
40
|
+
return;
|
|
41
|
+
const saved = readConsent(base);
|
|
42
|
+
if (saved.enabled && saved.scope === 'sdk')
|
|
43
|
+
return { base, installationId: saved.installationId };
|
|
44
|
+
}
|
|
45
|
+
// Bind at start and recheck after the operation. No arguments, paths, tool names or results.
|
|
46
|
+
export function beginActivity(command, env, send, slot) {
|
|
47
|
+
const start = activityConsent(env);
|
|
48
|
+
if (!start)
|
|
49
|
+
return;
|
|
50
|
+
const ci = isUsageCI(env);
|
|
51
|
+
return async () => {
|
|
52
|
+
try {
|
|
53
|
+
const current = activityConsent(env);
|
|
54
|
+
if (!current || current.base !== start.base || current.installationId !== start.installationId)
|
|
55
|
+
return;
|
|
56
|
+
const body = JSON.stringify({ schema: 2, installationId: start.installationId, runId: randomUUID(), ci, command });
|
|
57
|
+
const now = Date.now();
|
|
58
|
+
const key = [start.base, start.installationId, ci, Math.floor(now / 86_400_000)].join('|');
|
|
59
|
+
if (slot) {
|
|
60
|
+
if (slot.key === key && now < (slot.retryAfter ?? Infinity))
|
|
61
|
+
return;
|
|
62
|
+
slot.key = key;
|
|
63
|
+
slot.retryAfter = now + 60_000;
|
|
64
|
+
}
|
|
65
|
+
const response = await send(`${start.base}/api/sdk-usage`, {
|
|
66
|
+
method: 'POST', headers: { 'content-type': 'application/json' }, body, redirect: 'error',
|
|
67
|
+
}, 800);
|
|
68
|
+
if (slot?.key === key && response.ok)
|
|
69
|
+
delete slot.retryAfter;
|
|
70
|
+
}
|
|
71
|
+
catch { /* Delivery must not affect the command or tool result. */ }
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { beginActivity } from '#core/usage.js';
|
|
3
|
+
import { fetchWithTimeout } from './http.js';
|
|
2
4
|
import { catalog } from '#core/lang.js';
|
|
3
5
|
import { approvalMode, clientCanElicit, requestHumanApproval } from './human-approval.js';
|
|
4
6
|
import { telegramConfig } from './telegram-approval.js';
|
|
@@ -231,11 +233,13 @@ export function createToolRegistrar(server, options) {
|
|
|
231
233
|
return meta;
|
|
232
234
|
};
|
|
233
235
|
const serverId = options.serverId ?? 'main';
|
|
236
|
+
const dailyActivity = {};
|
|
234
237
|
/** 읽기 도구는 남기지 않는다 — 바뀐 것이 없고, 호출이 많아 기록이 묻힌다. */
|
|
235
238
|
const audited = (meta, handler) => {
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
const audit = meta.kind !== 'read' || meta.approval;
|
|
240
|
+
const measure = meta.domain !== 'auth' && !meta.name.endsWith('_auth_status');
|
|
238
241
|
return async (args, extra) => {
|
|
242
|
+
const finish = measure ? beginActivity(serverId === 'social' ? 'social-mcp' : 'mcp', env, (url, init, timeoutMs) => fetchWithTimeout(url, init, { timeoutMs, maxAttempts: 1 }), dailyActivity) : undefined;
|
|
239
243
|
const started = Date.now();
|
|
240
244
|
const write = (outcome, message) => appendAudit({
|
|
241
245
|
ts: new Date(started).toISOString(),
|
|
@@ -253,7 +257,8 @@ export function createToolRegistrar(server, options) {
|
|
|
253
257
|
result = await handler(args, extra);
|
|
254
258
|
}
|
|
255
259
|
catch (e) {
|
|
256
|
-
|
|
260
|
+
if (audit)
|
|
261
|
+
write('threw', oneLineMessage(e instanceof Error ? e.message : String(e)));
|
|
257
262
|
throw e;
|
|
258
263
|
}
|
|
259
264
|
// refused > error > preview > ok. preview 는 "아무것도 바뀌지 않았다" 의 보장이라 확실할 때만 — 레지스트라 가드가
|
|
@@ -263,7 +268,10 @@ export function createToolRegistrar(server, options) {
|
|
|
263
268
|
: result.isError ? 'error'
|
|
264
269
|
: marked === 'preview' || isDeclaredPreview(meta.name, args ?? {}) ? 'preview'
|
|
265
270
|
: 'ok';
|
|
266
|
-
|
|
271
|
+
if (audit)
|
|
272
|
+
write(outcome, outcome === 'ok' || outcome === 'preview' ? undefined : resultMessage(result));
|
|
273
|
+
if (outcome === 'ok')
|
|
274
|
+
void finish?.();
|
|
267
275
|
return result;
|
|
268
276
|
};
|
|
269
277
|
};
|
package/dist/registers/auth.js
CHANGED
|
@@ -54,6 +54,7 @@ const A = catalog({
|
|
|
54
54
|
},
|
|
55
55
|
// ── mimi_seed_status ──
|
|
56
56
|
status: {
|
|
57
|
+
measurement: "선택적 CLI·MCP 사용량 측정은 기본 꺼짐입니다. 사용자가 직접 확인하려면 npx mimi-seed telemetry --help를 실행하세요.",
|
|
57
58
|
header: (version) => `🌱 Mimi Seed 연결 상태 — local-stdio (@yoonion/mimi-seed-mcp v${version})`,
|
|
58
59
|
accountUnknown: '계정 확인 불가 — 재로그인하면 기록됨',
|
|
59
60
|
oauthOk: (account, min, label) => `✅ Google OAuth — 연결됨 (${account}, ${min}분 남음, ${label})`,
|
|
@@ -149,6 +150,7 @@ const A = catalog({
|
|
|
149
150
|
missing: (label, suffix, fix, noteLine) => `❌ ${label} — not set up${suffix}\n → ${fix}${noteLine}`,
|
|
150
151
|
},
|
|
151
152
|
status: {
|
|
153
|
+
measurement: "Optional CLI and MCP measurement is off by default. Users can review it with npx mimi-seed telemetry --help.",
|
|
152
154
|
header: (version) => `🌱 Mimi Seed connection status — local-stdio (@yoonion/mimi-seed-mcp v${version})`,
|
|
153
155
|
accountUnknown: 'account unknown — recorded on next login',
|
|
154
156
|
oauthOk: (account, min, label) => `✅ Google OAuth — connected (${account}, ${min} min left, ${label})`,
|
|
@@ -314,6 +316,7 @@ export function registerAuthTools(server) {
|
|
|
314
316
|
`🧰 Toolsets: ${describeToolsets(server.toolsets, server.manifest)}`,
|
|
315
317
|
// 승인 게이트가 이 클라이언트에서 실제로 동작하는지 — 설정만 보고는 알 수 없다 (클라이언트 지원에 달림).
|
|
316
318
|
`🛡️ Approval: ${describeApproval(server.approvalStatus())}`,
|
|
319
|
+
m.measurement,
|
|
317
320
|
'',
|
|
318
321
|
];
|
|
319
322
|
// 1. Google OAuth
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoonion/mimi-seed-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@yoonion/mimi-seed-mcp",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.34.0",
|
|
10
10
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@googleapis/admob": "^11.0.1",
|
package/package.json
CHANGED