connectbase-client 6.23.0 → 6.25.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/dist/cli.js CHANGED
@@ -68,29 +68,381 @@ __export(cli_exports, {
68
68
  });
69
69
  module.exports = __toCommonJS(cli_exports);
70
70
  var crypto = __toESM(require("crypto"));
71
- var fs4 = __toESM(require("fs"));
71
+ var fs5 = __toESM(require("fs"));
72
72
  var http2 = __toESM(require("http"));
73
73
  var https = __toESM(require("https"));
74
74
  var os4 = __toESM(require("os"));
75
- var path4 = __toESM(require("path"));
75
+ var path5 = __toESM(require("path"));
76
76
  var readline = __toESM(require("readline"));
77
77
 
78
78
  // src/local-command.ts
79
79
  var import_node_crypto = require("crypto");
80
- var fs2 = __toESM(require("fs"));
80
+ var fs3 = __toESM(require("fs"));
81
81
  var os2 = __toESM(require("os"));
82
- var path2 = __toESM(require("path"));
82
+ var path3 = __toESM(require("path"));
83
83
 
84
- // src/local-runner.ts
84
+ // src/local-mcp-hub.ts
85
85
  var import_node_child_process = require("child_process");
86
86
  var fs = __toESM(require("fs"));
87
+ var path = __toESM(require("path"));
88
+ var LOCAL_CONFIG_FILE = "connectbase-local.json";
89
+ var CALL_TIMEOUT_MS = 1e5;
90
+ var START_TIMEOUT_MS = 6e4;
91
+ function loadLocalConfig(dir) {
92
+ const p = path.join(dir, LOCAL_CONFIG_FILE);
93
+ if (!fs.existsSync(p)) return { mcpServers: {} };
94
+ const raw = JSON.parse(fs.readFileSync(p, "utf-8"));
95
+ return { mcpServers: raw.mcpServers ?? {} };
96
+ }
97
+ function saveLocalConfig(dir, cfg) {
98
+ const p = path.join(dir, LOCAL_CONFIG_FILE);
99
+ let prev = {};
100
+ try {
101
+ prev = JSON.parse(fs.readFileSync(p, "utf-8"));
102
+ } catch {
103
+ }
104
+ fs.writeFileSync(
105
+ p,
106
+ `${JSON.stringify({ ...prev, mcpServers: cfg.mcpServers }, null, 2)}
107
+ `
108
+ );
109
+ }
110
+ function parseMcpFlag(flag) {
111
+ const eq = flag.indexOf("=");
112
+ if (eq <= 0)
113
+ throw new Error(
114
+ `--mcp \uB294 \uC774\uB984=\uBA85\uB839 \uAF34\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4 (\uC608: --mcp blender="uvx blender-mcp"): ${flag}`
115
+ );
116
+ const name = flag.slice(0, eq).trim();
117
+ const rest = flag.slice(eq + 1).trim();
118
+ if (!/^[\w.-]+$/.test(name))
119
+ throw new Error(`MCP \uC774\uB984\uC740 \uC601\uBB38, \uC22B\uC790, - _ . \uB9CC \uC501\uB2C8\uB2E4: ${name}`);
120
+ if (/^https?:\/\//.test(rest)) return { name, def: { url: rest } };
121
+ const parts = rest.match(/"[^"]*"|'[^']*'|\S+/g)?.map((p) => p.replace(/^["']|["']$/g, "")) ?? [];
122
+ if (!parts.length) throw new Error(`--mcp ${name} \uC758 \uBA85\uB839\uC774 \uBE44\uC5C8\uC2B5\uB2C8\uB2E4`);
123
+ return { name, def: { command: parts[0], args: parts.slice(1) } };
124
+ }
125
+ var StdioClient = class {
126
+ constructor(name, def, baseEnv, cwd) {
127
+ this.name = name;
128
+ this.def = def;
129
+ this.baseEnv = baseEnv;
130
+ this.cwd = cwd;
131
+ this.buf = "";
132
+ this.seq = 0;
133
+ this.pending = /* @__PURE__ */ new Map();
134
+ this.stderrTail = "";
135
+ }
136
+ alive() {
137
+ return !!this.proc && this.proc.exitCode === null && !this.proc.killed;
138
+ }
139
+ async start() {
140
+ const proc = (0, import_node_child_process.spawn)(this.def.command, this.def.args ?? [], {
141
+ cwd: this.def.cwd ? path.resolve(this.cwd, this.def.cwd) : this.cwd,
142
+ env: { ...this.baseEnv, ...this.def.env ?? {} },
143
+ stdio: ["pipe", "pipe", "pipe"],
144
+ // Windows 의 npx, uvx 는 .cmd 라 셸로 띄워야 한다
145
+ shell: process.platform === "win32",
146
+ windowsHide: true
147
+ });
148
+ this.proc = proc;
149
+ proc.stdout?.on("data", (d) => {
150
+ this.buf += d.toString();
151
+ let i = this.buf.indexOf("\n");
152
+ while (i >= 0) {
153
+ const line = this.buf.slice(0, i).trim();
154
+ this.buf = this.buf.slice(i + 1);
155
+ if (line) this.onLine(line);
156
+ i = this.buf.indexOf("\n");
157
+ }
158
+ });
159
+ proc.stderr?.on("data", (d) => {
160
+ this.stderrTail = (this.stderrTail + d.toString()).slice(-2e3);
161
+ });
162
+ const fail = (why) => {
163
+ for (const [, p] of this.pending) {
164
+ clearTimeout(p.timer);
165
+ p.reject(
166
+ new Error(
167
+ `${this.name}: ${why}${this.stderrTail ? `
168
+ ${this.stderrTail.slice(-600)}` : ""}`
169
+ )
170
+ );
171
+ }
172
+ this.pending.clear();
173
+ };
174
+ proc.on("exit", (code) => fail(`MCP \uC11C\uBC84\uAC00 \uB05D\uB0AC\uC2B5\uB2C8\uB2E4 (\uCF54\uB4DC ${code})`));
175
+ proc.on("error", (e) => fail(`\uB744\uC6B0\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${e.message}`));
176
+ }
177
+ onLine(line) {
178
+ let msg;
179
+ try {
180
+ msg = JSON.parse(line);
181
+ } catch {
182
+ return;
183
+ }
184
+ const id = msg.id;
185
+ if (id === void 0 || !this.pending.has(id)) return;
186
+ const p = this.pending.get(id);
187
+ this.pending.delete(id);
188
+ if (!p) return;
189
+ clearTimeout(p.timer);
190
+ if (msg.error)
191
+ p.reject(
192
+ new Error(`${this.name}: ${JSON.stringify(msg.error).slice(0, 500)}`)
193
+ );
194
+ else p.resolve(msg.result ?? {});
195
+ }
196
+ request(method, params, timeoutMs = CALL_TIMEOUT_MS) {
197
+ return new Promise((resolve5, reject) => {
198
+ if (!this.alive())
199
+ return reject(new Error(`${this.name}: MCP \uC11C\uBC84\uAC00 \uAEBC\uC838 \uC788\uC2B5\uB2C8\uB2E4`));
200
+ const id = ++this.seq;
201
+ const timer = setTimeout(() => {
202
+ this.pending.delete(id);
203
+ reject(
204
+ new Error(
205
+ `${this.name}: ${Math.round(timeoutMs / 1e3)}\uCD08 \uC548\uC5D0 \uB2F5\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4`
206
+ )
207
+ );
208
+ }, timeoutMs);
209
+ this.pending.set(id, { resolve: resolve5, reject, timer });
210
+ this.proc?.stdin?.write(
211
+ `${JSON.stringify({ jsonrpc: "2.0", id, method, params })}
212
+ `
213
+ );
214
+ });
215
+ }
216
+ notify(method) {
217
+ this.proc?.stdin?.write(`${JSON.stringify({ jsonrpc: "2.0", method })}
218
+ `);
219
+ }
220
+ close() {
221
+ try {
222
+ this.proc?.kill();
223
+ } catch {
224
+ }
225
+ }
226
+ };
227
+ var HttpClient = class {
228
+ constructor(name, def) {
229
+ this.name = name;
230
+ this.def = def;
231
+ this.seq = 0;
232
+ this.ok = false;
233
+ }
234
+ alive() {
235
+ return this.ok;
236
+ }
237
+ async start() {
238
+ this.ok = true;
239
+ }
240
+ async request(method, params, timeoutMs = CALL_TIMEOUT_MS) {
241
+ const headers = {
242
+ "Content-Type": "application/json",
243
+ Accept: "application/json, text/event-stream",
244
+ ...this.def.headers ?? {}
245
+ };
246
+ if (this.session) headers["Mcp-Session-Id"] = this.session;
247
+ const ctrl = new AbortController();
248
+ const t = setTimeout(() => ctrl.abort(), timeoutMs);
249
+ try {
250
+ const id = ++this.seq;
251
+ const r = await fetch(this.def.url, {
252
+ method: "POST",
253
+ headers,
254
+ body: JSON.stringify({ jsonrpc: "2.0", id, method, params }),
255
+ signal: ctrl.signal
256
+ });
257
+ const sid = r.headers.get("mcp-session-id");
258
+ if (sid) this.session = sid;
259
+ const raw = await r.text();
260
+ if (!r.ok)
261
+ throw new Error(`${this.name}: HTTP ${r.status} ${raw.slice(0, 300)}`);
262
+ const body = raw.trimStart().startsWith("{") ? raw : raw.split("\n").filter((l) => l.startsWith("data:")).map((l) => l.slice(5).trim()).filter(
263
+ (l) => l.includes(`"id":${id}`) || l.includes(`"id": ${id}`)
264
+ ).pop() ?? "{}";
265
+ const msg = JSON.parse(body);
266
+ if (msg.error)
267
+ throw new Error(
268
+ `${this.name}: ${JSON.stringify(msg.error).slice(0, 500)}`
269
+ );
270
+ return msg.result ?? {};
271
+ } catch (e) {
272
+ this.ok = !(e instanceof TypeError);
273
+ throw e instanceof Error && e.name === "AbortError" ? new Error(
274
+ `${this.name}: ${Math.round(timeoutMs / 1e3)}\uCD08 \uC548\uC5D0 \uB2F5\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4`
275
+ ) : e;
276
+ } finally {
277
+ clearTimeout(t);
278
+ }
279
+ }
280
+ notifyInitialized() {
281
+ const headers = {
282
+ "Content-Type": "application/json",
283
+ ...this.def.headers ?? {}
284
+ };
285
+ if (this.session) headers["Mcp-Session-Id"] = this.session;
286
+ void fetch(this.def.url, {
287
+ method: "POST",
288
+ headers,
289
+ body: JSON.stringify({
290
+ jsonrpc: "2.0",
291
+ method: "notifications/initialized"
292
+ })
293
+ }).catch(() => {
294
+ });
295
+ }
296
+ close() {
297
+ this.ok = false;
298
+ }
299
+ };
300
+ var LocalMcpHub = class {
301
+ constructor(dir, env, log2, reserved, onChange) {
302
+ this.dir = dir;
303
+ this.env = env;
304
+ this.log = log2;
305
+ this.reserved = reserved;
306
+ this.onChange = onChange;
307
+ this.entries = /* @__PURE__ */ new Map();
308
+ this.exposed = [];
309
+ }
310
+ /** 정의 파일을 읽어 모두 (다시) 띄운다. */
311
+ async reload() {
312
+ for (const e of this.entries.values()) e.client?.close();
313
+ this.entries.clear();
314
+ let cfg;
315
+ try {
316
+ cfg = loadLocalConfig(this.dir);
317
+ } catch (e) {
318
+ this.log(
319
+ `${LOCAL_CONFIG_FILE} \uB97C \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${e instanceof Error ? e.message : e}`
320
+ );
321
+ cfg = { mcpServers: {} };
322
+ }
323
+ await Promise.all(
324
+ Object.entries(cfg.mcpServers).filter(([, d]) => d.enabled !== false).map(([name, def]) => this.startOne(name, def))
325
+ );
326
+ this.rebuild();
327
+ this.onChange();
328
+ }
329
+ async startOne(name, def) {
330
+ const e = { name, def, tools: [] };
331
+ this.entries.set(name, e);
332
+ if (!def.command && !def.url) {
333
+ e.error = "command \uB098 url \uC774 \uC5C6\uC2B5\uB2C8\uB2E4";
334
+ return;
335
+ }
336
+ const client = def.url ? new HttpClient(name, def) : new StdioClient(name, def, this.env(), this.dir);
337
+ e.client = client;
338
+ try {
339
+ await client.start();
340
+ await client.request(
341
+ "initialize",
342
+ {
343
+ protocolVersion: "2025-06-18",
344
+ capabilities: {},
345
+ clientInfo: { name: "connectbase-local", version: "1.0.0" }
346
+ },
347
+ START_TIMEOUT_MS
348
+ );
349
+ if (client instanceof StdioClient)
350
+ client.notify("notifications/initialized");
351
+ else client.notifyInitialized();
352
+ const tools = [];
353
+ let cursor;
354
+ do {
355
+ const r = await client.request(
356
+ "tools/list",
357
+ cursor ? { cursor } : {},
358
+ START_TIMEOUT_MS
359
+ );
360
+ for (const t of r.tools ?? [])
361
+ tools.push({
362
+ name: String(t.name),
363
+ description: String(t.description ?? ""),
364
+ inputSchema: t.inputSchema ?? { type: "object" }
365
+ });
366
+ cursor = r.nextCursor;
367
+ } while (cursor);
368
+ e.tools = tools;
369
+ this.log(`MCP ${name}: \uB3C4\uAD6C ${tools.length}\uAC1C`);
370
+ } catch (err) {
371
+ e.error = err instanceof Error ? err.message : String(err);
372
+ this.log(`MCP ${name} \uC5F0\uACB0 \uC2E4\uD328: ${e.error.split("\n")[0]}`);
373
+ }
374
+ }
375
+ rebuild() {
376
+ const reserved = this.reserved();
377
+ const count = /* @__PURE__ */ new Map();
378
+ for (const e of this.entries.values())
379
+ for (const t of e.tools) count.set(t.name, (count.get(t.name) ?? 0) + 1);
380
+ this.exposed = [];
381
+ for (const e of this.entries.values())
382
+ for (const t of e.tools) {
383
+ const clash = reserved.has(t.name) || (count.get(t.name) ?? 0) > 1;
384
+ this.exposed.push({
385
+ server: e.name,
386
+ name: t.name,
387
+ exposed: clash ? `${e.name}__${t.name}` : t.name,
388
+ description: `[\uB0B4 PC MCP: ${e.name}] ${t.description}`,
389
+ inputSchema: t.inputSchema
390
+ });
391
+ }
392
+ }
393
+ tools() {
394
+ return this.exposed;
395
+ }
396
+ has(exposed) {
397
+ return this.exposed.some((t) => t.exposed === exposed);
398
+ }
399
+ /** 원래 이름으로 이 서버들 중 누가 그 도구를 갖고 있는가 (내장 BlenderMCP 대신 쓸지 정할 때). */
400
+ providesOriginal(name) {
401
+ return this.exposed.some((t) => t.name === name);
402
+ }
403
+ status() {
404
+ return [...this.entries.values()].map((e) => ({
405
+ name: e.name,
406
+ kind: e.def.url ? `http ${e.def.url}` : `${e.def.command} ${(e.def.args ?? []).join(" ")}`.trim(),
407
+ ok: !e.error && !!e.client?.alive(),
408
+ tools: e.tools.length,
409
+ ...e.error ? { error: e.error.slice(0, 400) } : {}
410
+ }));
411
+ }
412
+ async call(exposed, args) {
413
+ const t = this.exposed.find((x) => x.exposed === exposed);
414
+ if (!t) throw new Error(`\uC5C6\uB294 \uB3C4\uAD6C: ${exposed}`);
415
+ const e = this.entries.get(t.server);
416
+ if (!e?.client) throw new Error(`${t.server}: \uC5F0\uACB0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4`);
417
+ if (!e.client.alive()) {
418
+ await this.startOne(e.name, e.def);
419
+ this.rebuild();
420
+ }
421
+ const c = this.entries.get(t.server)?.client;
422
+ if (!c) throw new Error(`${t.server}: \uC5F0\uACB0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4`);
423
+ return c.request("tools/call", { name: t.name, arguments: args });
424
+ }
425
+ close() {
426
+ for (const e of this.entries.values()) e.client?.close();
427
+ }
428
+ };
429
+
430
+ // src/local-runner.ts
431
+ var import_node_child_process2 = require("child_process");
432
+ var fs2 = __toESM(require("fs"));
87
433
  var http = __toESM(require("http"));
88
434
  var net = __toESM(require("net"));
89
435
  var os = __toESM(require("os"));
90
- var path = __toESM(require("path"));
436
+ var path2 = __toESM(require("path"));
91
437
  var MAX_OUT = 24e3;
92
438
  var MAX_READ = 2e5;
93
439
  var MAX_IMAGE = 8 * 1024 * 1024;
440
+ var BLENDER_MCP_TOOLS = /* @__PURE__ */ new Set([
441
+ "execute_blender_code",
442
+ "get_scene_info",
443
+ "get_object_info",
444
+ "get_viewport_screenshot"
445
+ ]);
94
446
  var PROTOCOL_VERSIONS = ["2025-06-18", "2025-03-26", "2024-11-05"];
95
447
  var text = (t, isError = false) => ({
96
448
  content: [{ type: "text", text: t }],
@@ -101,7 +453,7 @@ ${s.slice(-n)}` : s;
101
453
  var str = (v, d = "") => typeof v === "string" ? v : d;
102
454
  var num = (v, d) => typeof v === "number" && Number.isFinite(v) ? v : d;
103
455
  function imageMime(p) {
104
- const ext = path.extname(p).toLowerCase();
456
+ const ext = path2.extname(p).toLowerCase();
105
457
  return {
106
458
  ".png": "image/png",
107
459
  ".jpg": "image/jpeg",
@@ -112,22 +464,22 @@ function imageMime(p) {
112
464
  }
113
465
  function findPrograms() {
114
466
  const which = (names, extra = []) => {
115
- const dirs = (process.env.PATH ?? "").split(path.delimiter).filter(Boolean);
467
+ const dirs = (process.env.PATH ?? "").split(path2.delimiter).filter(Boolean);
116
468
  const exts = process.platform === "win32" ? ["", ".exe", ".cmd", ".bat"] : [""];
117
469
  for (const n of names) {
118
- if (path.isAbsolute(n) && fs.existsSync(n)) return n;
470
+ if (path2.isAbsolute(n) && fs2.existsSync(n)) return n;
119
471
  for (const d of dirs)
120
472
  for (const e of exts) {
121
- const p = path.join(d, n + e);
122
- if (fs.existsSync(p)) return p;
473
+ const p = path2.join(d, n + e);
474
+ if (fs2.existsSync(p)) return p;
123
475
  }
124
476
  }
125
- for (const p of extra) if (fs.existsSync(p)) return p;
477
+ for (const p of extra) if (fs2.existsSync(p)) return p;
126
478
  return null;
127
479
  };
128
480
  const globDirs = (root, pattern, sub) => {
129
481
  try {
130
- return fs.readdirSync(root).filter((n) => pattern.test(n)).sort().reverse().map((n) => path.join(root, n, sub));
482
+ return fs2.readdirSync(root).filter((n) => pattern.test(n)).sort().reverse().map((n) => path2.join(root, n, sub));
131
483
  } catch {
132
484
  return [];
133
485
  }
@@ -147,7 +499,7 @@ function findPrograms() {
147
499
  "ZBrush.app/Contents/MacOS/ZBrush"
148
500
  ) : process.platform === "win32" ? globDirs("C:\\Program Files", /^Maxon ZBrush/, "ZBrush.exe") : [];
149
501
  return {
150
- blender: process.env.BLENDER_BIN && fs.existsSync(process.env.BLENDER_BIN) ? process.env.BLENDER_BIN : which(["blender"], blenderExtra),
502
+ blender: process.env.BLENDER_BIN && fs2.existsSync(process.env.BLENDER_BIN) ? process.env.BLENDER_BIN : which(["blender"], blenderExtra),
151
503
  zbrush: which([], zbrushExtra),
152
504
  python: which(
153
505
  process.platform === "win32" ? ["python", "py"] : ["python3", "python"]
@@ -155,13 +507,13 @@ function findPrograms() {
155
507
  uv: which(
156
508
  ["uv"],
157
509
  [
158
- path.join(
510
+ path2.join(
159
511
  os.homedir(),
160
512
  ".local",
161
513
  "bin",
162
514
  process.platform === "win32" ? "uv.exe" : "uv"
163
515
  ),
164
- path.join(os.homedir(), ".cargo", "bin", "uv")
516
+ path2.join(os.homedir(), ".cargo", "bin", "uv")
165
517
  ]
166
518
  ),
167
519
  node: process.execPath,
@@ -176,23 +528,53 @@ var LocalRunner = class {
176
528
  this.jobs = /* @__PURE__ */ new Map();
177
529
  this.jobSeq = 0;
178
530
  this.opts = opts;
179
- this.dir = path.resolve(opts.dir);
180
- this.skillsDir = path.join(this.dir, "skills");
181
- fs.mkdirSync(this.skillsDir, { recursive: true });
531
+ this.dir = path2.resolve(opts.dir);
532
+ this.skillsDir = path2.join(this.dir, "skills");
533
+ fs2.mkdirSync(this.skillsDir, { recursive: true });
182
534
  this.programs = findPrograms();
183
535
  this.tools = this.defineTools();
536
+ this.hub = new LocalMcpHub(
537
+ this.dir,
538
+ () => this.env(),
539
+ (l) => this.log(l),
540
+ () => new Set(
541
+ this.tools.map((t) => t.name).filter((n) => !BLENDER_MCP_TOOLS.has(n))
542
+ ),
543
+ () => this.opts.onSkillsChanged?.()
544
+ );
545
+ }
546
+ /** connectbase-local.json 의 MCP 서버를 띄운다. */
547
+ startMcp() {
548
+ return this.hub.reload();
549
+ }
550
+ /** AI 에게 보이는 도구: 내장 + PC 의 MCP. PC 에 BlenderMCP 를 정의했으면 내장 대신 그것을 쓴다. */
551
+ visibleTools() {
552
+ const own = this.tools.filter(
553
+ (t) => !(BLENDER_MCP_TOOLS.has(t.name) && this.hub.providesOriginal(t.name))
554
+ ).map(({ name, description, inputSchema, annotations }) => ({
555
+ name,
556
+ description: name === "read_skill" ? this.skillIndexText() : description,
557
+ inputSchema,
558
+ ...annotations ? { annotations } : {}
559
+ }));
560
+ const fromHub = this.hub.tools().map((t) => ({
561
+ name: t.exposed,
562
+ description: t.description,
563
+ inputSchema: t.inputSchema
564
+ }));
565
+ return [...own, ...fromHub];
184
566
  }
185
567
  log(line) {
186
568
  (this.opts.log ?? console.log)(line);
187
569
  }
188
570
  /** 작업 폴더 안의 경로로 푼다. 절대 경로도 작업 폴더 안이어야 한다. */
189
571
  inDir(p) {
190
- const abs = path.resolve(
572
+ const abs = path2.resolve(
191
573
  this.dir,
192
574
  p.replace(/^~(?=$|[\\/])/, os.homedir())
193
575
  );
194
- const rel = path.relative(this.dir, abs);
195
- if (rel.startsWith("..") || path.isAbsolute(rel))
576
+ const rel = path2.relative(this.dir, abs);
577
+ if (rel.startsWith("..") || path2.isAbsolute(rel))
196
578
  throw new Error(
197
579
  `\uC791\uC5C5 \uD3F4\uB354(${this.dir}) \uBC16\uC758 \uACBD\uB85C\uB294 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${p}`
198
580
  );
@@ -228,6 +610,8 @@ var LocalRunner = class {
228
610
  work_dir: this.dir,
229
611
  skills_dir: this.skillsDir,
230
612
  installed_skills: this.listSkills().map((k) => k.name),
613
+ mcp_config: path2.join(this.dir, LOCAL_CONFIG_FILE),
614
+ mcp_servers: this.hub.status(),
231
615
  programs: this.programs,
232
616
  blender_mcp: blenderLive ? `\uC5F0\uACB0\uB428 (localhost:${this.blenderPort})` : `\uC5C6\uC74C (Blender \uC5D0\uC11C BlenderMCP \uC560\uB4DC\uC628 > Start \uB97C \uB204\uB974\uBA74 execute_blender_code \uB4F1\uC744 \uC4F8 \uC218 \uC788\uB2E4)`,
233
617
  notes: [
@@ -261,10 +645,10 @@ var LocalRunner = class {
261
645
  ${this.skillIndexText()}`,
262
646
  true
263
647
  );
264
- const body = fs.readFileSync(path.join(k.dir, "SKILL.md"), "utf-8").split("{{SKILL_DIR}}").join(k.dir);
648
+ const body = fs2.readFileSync(path2.join(k.dir, "SKILL.md"), "utf-8").split("{{SKILL_DIR}}").join(k.dir);
265
649
  const head = `> \uC2A4\uD0AC \uD3F4\uB354(skill_dir): ${k.dir}
266
650
  > \uC774 \uC2A4\uD0AC\uC740 \uC0AC\uC6A9\uC790 \uCEF4\uD4E8\uD130\uC5D0\uC11C \uB3C8\uB2E4. \uBCF8\uBB38\uC758 {{SKILL_DIR}}, ~/.claude/skills/<\uC774\uB984>, ~/.codex/skills/<\uC774\uB984> \uC740 \uC704 skill_dir(\uB2E4\uB978 \uC2A4\uD0AC\uC774\uBA74 \uADF8 \uC2A4\uD0AC \uD3F4\uB354)\uB85C \uBC14\uAFD4 \uC77D\uB294\uB2E4.
267
- > \uC178 \uBA85\uB839\uC740 run(90\uCD08 \uB118\uC73C\uBA74 background=true \uB4A4 job_status), \uD30C\uC77C\uC740 read_file, write_file, list_files, \uADF8\uB9BC \uD655\uC778\uC740 view_image, \uADF8\uB9BC \uC0DD\uC131\uC740 image_generate, \uB0B4\uB824\uBC1B\uAE30\uB294 download, \uACB0\uACFC \uAC74\uB124\uAE30\uB294 upload_to_storage, \uC2E4\uD589 \uC911\uC778 Blender \uB294 execute_blender_code \uB4F1\uC73C\uB85C \uD55C\uB2E4.
651
+ > \uC178 \uBA85\uB839\uC740 run(90\uCD08 \uB118\uC73C\uBA74 background=true \uB4A4 job_status), \uD30C\uC77C\uC740 read_file, write_file, list_files, \uADF8\uB9BC \uD655\uC778\uC740 view_image, \uADF8\uB9BC \uC0DD\uC131\uC740 image_generate, \uB0B4\uB824\uBC1B\uAE30\uB294 download, \uACB0\uACFC \uAC74\uB124\uAE30\uB294 upload_to_storage, \uC2E4\uD589 \uC911\uC778 Blender \uB294 execute_blender_code \uB4F1\uC73C\uB85C \uD55C\uB2E4. \uC2A4\uD0AC\uC774 \uC5B4\uB5A4 MCP \uC758 \uB3C4\uAD6C\uB97C \uC4F0\uB77C\uACE0 \uD558\uBA74 \uC774 PC \uC5D0 \uC815\uC758\uB41C MCP \uB3C4\uAD6C([\uB0B4 PC MCP: \uC774\uB984])\uB97C \uADF8 \uC774\uB984\uC73C\uB85C \uBD80\uB974\uACE0, \uC5C6\uC73C\uBA74 local_info \uB85C \uD655\uC778\uD55C \uB4A4 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \uADF8 MCP \uB97C connectbase-local.json \uC5D0 \uB123\uC790\uACE0 \uC548\uB0B4\uD55C\uB2E4(mcp_reload).
268
652
  > \uD544\uC694\uD55C \uD504\uB85C\uADF8\uB7A8\uC774 \uC5C6\uC73C\uBA74(local_info \uB85C \uD655\uC778) \uC124\uCE58 \uBC29\uBC95\uC744 \uC54C\uB824 \uC8FC\uACE0 \uAE30\uB2E4\uB9B0\uB2E4. \uD558\uC704 \uC5D0\uC774\uC804\uD2B8\uB85C \uAC80\uD1A0\uD558\uB77C\uB294 \uACF3\uC740 \uC2A4\uC2A4\uB85C \uC0C8 \uB208\uC73C\uB85C \uB2E4\uC2DC \uBCF8\uB2E4.
269
653
 
270
654
  `;
@@ -273,7 +657,7 @@ ${this.skillIndexText()}`,
273
657
  },
274
658
  {
275
659
  name: "skill_install",
276
- description: "\uC0AC\uC6A9\uC790\uAC00 \uC6D0\uD560 \uB54C \uC2A4\uD0AC\uC744 \uC774 \uCEF4\uD4E8\uD130\uC5D0 \uC124\uCE58\uD55C\uB2E4 (SKILL.md \uC640 references/, scripts/ \uB97C \uD1B5\uC9F8\uB85C). source: GitHub 'owner/repo' (\uC800\uC7A5\uC18C\uC758 \uC2A4\uD0AC \uBAA8\uB450), 'owner/repo/\uD3F4\uB354[@ref]' (\uADF8 \uD3F4\uB354\uC758 \uC2A4\uD0AC), github.com \uC8FC\uC18C, \uB610\uB294 \uC774 \uCEF4\uD4E8\uD130\uC758 \uD3F4\uB354 \uACBD\uB85C. update=true \uBA74 \uC774\uBBF8 \uC788\uB294 \uAC83\uB3C4 \uB2E4\uC2DC \uBC1B\uB294\uB2E4.",
660
+ description: "\uC0AC\uC6A9\uC790\uAC00 \uC6D0\uD560 \uB54C \uC2A4\uD0AC\uC744 \uC774 \uCEF4\uD4E8\uD130\uC5D0 \uC124\uCE58\uD55C\uB2E4 (SKILL.md \uC640 references/, scripts/ \uB97C \uD1B5\uC9F8\uB85C). source: GitHub 'owner/repo' (\uC800\uC7A5\uC18C\uC758 \uC2A4\uD0AC \uBAA8\uB450), 'owner/repo/\uD3F4\uB354[@ref]' (\uADF8 \uD3F4\uB354\uC758 \uC2A4\uD0AC), github.com \uC8FC\uC18C, \uB610\uB294 \uC774 \uCEF4\uD4E8\uD130\uC758 \uD3F4\uB354 \uACBD\uB85C. update=true \uBA74 \uC774\uBBF8 \uC788\uB294 \uAC83\uB3C4 \uB2E4\uC2DC \uBC1B\uB294\uB2E4. \uC124\uCE58 \uB4A4\uC5D0\uB294 \uACB0\uACFC\uC758 setup \uCCB4\uD06C\uB9AC\uC2A4\uD2B8\uB300\uB85C \uC900\uBE44\uAE4C\uC9C0 \uD55C\uB2E4: SKILL.md \uC640 README \uB97C \uC77D\uACE0 \uD544\uC694\uD55C \uAC83(\uD504\uB85C\uADF8\uB7A8, Python/Node \uD328\uD0A4\uC9C0, MCP)\uC744 \uC815\uB9AC \u2192 \uBA85\uB839\uC73C\uB85C \uC124\uCE58\uD560 \uC218 \uC788\uB294 \uD328\uD0A4\uC9C0\uB294 run \uC73C\uB85C \uC124\uCE58(uv, pip, npm) \u2192 \uC2A4\uD0AC\uC774 \uC4F0\uB294 MCP \uB294 \uC0AC\uC6A9\uC790 \uD5C8\uB77D\uC744 \uBC1B\uC544 connectbase-local.json \uC758 mcpServers \uC5D0 \uB123\uACE0 mcp_reload \u2192 Blender, ZBrush \uCC98\uB7FC \uC124\uCE58 \uD504\uB85C\uADF8\uB7A8\uC73C\uB85C \uAE4C\uB294 \uAC83\uC740 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \uC124\uCE58 \uBC29\uBC95\uC744 \uC54C\uB824 \uC900\uB2E4 \u2192 \uC900\uBE44 \uC0C1\uD0DC\uB97C \uD45C\uB85C \uBCF4\uC774\uACE0 \uAC04\uB2E8\uD55C \uC2DC\uD5D8\uC744 \uD55C \uBC88 \uB3CC\uB9B0\uB2E4.",
277
661
  inputSchema: {
278
662
  type: "object",
279
663
  properties: {
@@ -287,6 +671,32 @@ ${this.skillIndexText()}`,
287
671
  },
288
672
  run: async (a) => this.skillInstall(str(a.source), a.update === true)
289
673
  },
674
+ {
675
+ name: "skill_remove",
676
+ description: "\uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC6B0\uB77C\uACE0 \uD55C \uC2A4\uD0AC\uC744 \uC774 \uCEF4\uD4E8\uD130\uC5D0\uC11C \uC9C0\uC6B4\uB2E4 (\uC791\uC5C5 \uD3F4\uB354 skills/<\uC774\uB984> \uD3F4\uB354). \uB418\uB3CC\uB9B4 \uC218 \uC5C6\uC73C\uB2C8 \uC0AC\uC6A9\uC790\uAC00 \uC774\uB984\uC744 \uC9DA\uC5B4 \uC9C0\uC6B0\uB77C\uACE0 \uD560 \uB54C\uB9CC.",
677
+ inputSchema: {
678
+ type: "object",
679
+ properties: {
680
+ name: {
681
+ type: "string",
682
+ description: "\uC2A4\uD0AC \uC774\uB984 (read_skill \uBAA9\uB85D\uC758 \uC774\uB984)"
683
+ }
684
+ },
685
+ required: ["name"]
686
+ },
687
+ run: async (a) => {
688
+ const name = str(a.name);
689
+ if (!/^[\w.-]+$/.test(name))
690
+ return text("\uC2A4\uD0AC \uC774\uB984\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4", true);
691
+ const dir = path2.join(this.skillsDir, name);
692
+ if (!fs2.existsSync(path2.join(dir, "SKILL.md")))
693
+ return text(`\uC124\uCE58\uB41C \uC2A4\uD0AC\uC774 \uC544\uB2D9\uB2C8\uB2E4: ${name}`, true);
694
+ fs2.rmSync(dir, { recursive: true, force: true });
695
+ this.log(`\uC2A4\uD0AC \uC9C0\uC6C0: ${name}`);
696
+ this.opts.onSkillsChanged?.();
697
+ return text(`\uC9C0\uC6E0\uC2B5\uB2C8\uB2E4: ${name}`);
698
+ }
699
+ },
290
700
  {
291
701
  name: "list_files",
292
702
  description: "\uC791\uC5C5 \uD3F4\uB354 \uC548\uC758 \uD3F4\uB354 \uB0B4\uC6A9\uC744 \uBCF8\uB2E4 (path \uB294 \uC791\uC5C5 \uD3F4\uB354 \uAE30\uC900, \uC608: skills/vehicle/references). depth \uB85C \uD558\uC704 \uD3F4\uB354\uAE4C\uC9C0.",
@@ -300,15 +710,15 @@ ${this.skillIndexText()}`,
300
710
  const depth = Math.min(num(a.depth, 1), 4);
301
711
  const lines = [];
302
712
  const walk = (d, lvl) => {
303
- for (const n of fs.readdirSync(d, { withFileTypes: true }).sort((x, y) => x.name.localeCompare(y.name))) {
713
+ for (const n of fs2.readdirSync(d, { withFileTypes: true }).sort((x, y) => x.name.localeCompare(y.name))) {
304
714
  if (n.name === "node_modules" || n.name === ".git" || n.name === "__pycache__")
305
715
  continue;
306
- const p = path.join(d, n.name);
307
- const rel = path.relative(this.dir, p);
716
+ const p = path2.join(d, n.name);
717
+ const rel = path2.relative(this.dir, p);
308
718
  if (n.isDirectory()) {
309
719
  lines.push(`${rel}/`);
310
720
  if (lvl < depth) walk(p, lvl + 1);
311
- } else lines.push(`${rel} ${fs.statSync(p).size}B`);
721
+ } else lines.push(`${rel} ${fs2.statSync(p).size}B`);
312
722
  if (lines.length > 2e3) return;
313
723
  }
314
724
  };
@@ -330,7 +740,7 @@ ${this.skillIndexText()}`,
330
740
  annotations: ro,
331
741
  run: async (a) => {
332
742
  const p = this.inDir(str(a.path));
333
- const all = fs.readFileSync(p, "utf-8").split("{{SKILL_DIR}}").join(this.skillDirOf(p) ?? "{{SKILL_DIR}}");
743
+ const all = fs2.readFileSync(p, "utf-8").split("{{SKILL_DIR}}").join(this.skillDirOf(p) ?? "{{SKILL_DIR}}");
334
744
  const off = Math.max(0, num(a.offset, 0));
335
745
  const part = all.slice(off, off + MAX_READ);
336
746
  const more = off + MAX_READ < all.length ? `
@@ -349,8 +759,8 @@ ${this.skillIndexText()}`,
349
759
  },
350
760
  run: async (a) => {
351
761
  const p = this.inDir(str(a.path));
352
- fs.mkdirSync(path.dirname(p), { recursive: true });
353
- fs.writeFileSync(p, str(a.content));
762
+ fs2.mkdirSync(path2.dirname(p), { recursive: true });
763
+ fs2.writeFileSync(p, str(a.content));
354
764
  return text(`\uC37C\uC2B5\uB2C8\uB2E4: ${p} (${Buffer.byteLength(str(a.content))}B)`);
355
765
  }
356
766
  },
@@ -393,6 +803,24 @@ ${this.skillIndexText()}`,
393
803
  annotations: ro,
394
804
  run: async (a) => this.jobStatus(str(a.id), num(a.wait, 0))
395
805
  },
806
+ {
807
+ name: "mcp_reload",
808
+ description: "\uC774 PC \uC758 MCP \uC11C\uBC84 \uC815\uC758(\uC791\uC5C5 \uD3F4\uB354\uC758 connectbase-local.json, mcpServers \uD615\uC2DD \u2014 Claude Desktop/Claude Code \uC640 \uAC19\uB2E4)\uB97C \uB2E4\uC2DC \uC77D\uACE0 \uB744\uC6B4\uB2E4. \uC2A4\uD0AC\uC774 \uC5B4\uB5A4 MCP \uC758 \uB3C4\uAD6C\uB97C \uC4F0\uB77C\uACE0 \uD558\uB294\uB370 \uADF8 \uB3C4\uAD6C\uAC00 \uC5C6\uC73C\uBA74, \uC0AC\uC6A9\uC790 \uD5C8\uB77D\uC744 \uBC1B\uC544 \uADF8 MCP \uC124\uC815\uC744 \uC774 \uD30C\uC77C\uC5D0 write_file \uB85C \uB123\uACE0 \uC774\uAC78 \uBD80\uB978\uB2E4. \uACB0\uACFC\uB85C \uC11C\uBC84\uBCC4 \uC0C1\uD0DC\uC640 \uB3C4\uAD6C \uC218\uB97C \uB3CC\uB824\uC900\uB2E4.",
809
+ inputSchema: { type: "object", properties: {} },
810
+ run: async () => {
811
+ await this.hub.reload();
812
+ return text(
813
+ JSON.stringify(
814
+ {
815
+ config: path2.join(this.dir, LOCAL_CONFIG_FILE),
816
+ servers: this.hub.status()
817
+ },
818
+ null,
819
+ 2
820
+ )
821
+ );
822
+ }
823
+ },
396
824
  {
397
825
  name: "job_stop",
398
826
  description: "background \uC791\uC5C5\uC744 \uBA48\uCD98\uB2E4.",
@@ -425,7 +853,7 @@ ${this.skillIndexText()}`,
425
853
  "\uADF8\uB9BC \uD30C\uC77C(png, jpg, webp, gif)\uB9CC \uBCFC \uC218 \uC788\uC2B5\uB2C8\uB2E4",
426
854
  true
427
855
  );
428
- const buf = fs.readFileSync(p);
856
+ const buf = fs2.readFileSync(p);
429
857
  if (buf.length > MAX_IMAGE)
430
858
  return text(
431
859
  `\uADF8\uB9BC\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${buf.length}B). \uB354 \uC791\uAC8C \uB80C\uB354\uD574 \uC8FC\uC138\uC694`,
@@ -455,8 +883,8 @@ ${this.skillIndexText()}`,
455
883
  const r = await fetch(url, { redirect: "follow" });
456
884
  if (!r.ok) return text(`\uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: HTTP ${r.status}`, true);
457
885
  const buf = Buffer.from(await r.arrayBuffer());
458
- fs.mkdirSync(path.dirname(p), { recursive: true });
459
- fs.writeFileSync(p, buf);
886
+ fs2.mkdirSync(path2.dirname(p), { recursive: true });
887
+ fs2.writeFileSync(p, buf);
460
888
  return text(`\uBC1B\uC558\uC2B5\uB2C8\uB2E4: ${p} (${buf.length}B)`);
461
889
  }
462
890
  },
@@ -537,7 +965,7 @@ ${this.skillIndexText()}`,
537
965
  },
538
966
  annotations: ro,
539
967
  run: async (a) => {
540
- const tmp = path.join(
968
+ const tmp = path2.join(
541
969
  os.tmpdir(),
542
970
  `cb_blender_shot_${process.pid}_${Date.now()}.png`
543
971
  );
@@ -547,31 +975,31 @@ ${this.skillIndexText()}`,
547
975
  format: "png"
548
976
  });
549
977
  if (r.isError) return r;
550
- if (!fs.existsSync(tmp))
978
+ if (!fs2.existsSync(tmp))
551
979
  return text("Blender \uAC00 \uD654\uBA74\uC744 \uC800\uC7A5\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4", true);
552
- const data = fs.readFileSync(tmp).toString("base64");
553
- fs.rmSync(tmp, { force: true });
980
+ const data = fs2.readFileSync(tmp).toString("base64");
981
+ fs2.rmSync(tmp, { force: true });
554
982
  return { content: [{ type: "image", data, mimeType: "image/png" }] };
555
983
  }
556
984
  }
557
985
  ];
558
986
  }
559
987
  skillDirOf(p) {
560
- const rel = path.relative(this.skillsDir, p);
561
- if (rel.startsWith("..") || path.isAbsolute(rel)) return null;
562
- return path.join(this.skillsDir, rel.split(path.sep)[0]);
988
+ const rel = path2.relative(this.skillsDir, p);
989
+ if (rel.startsWith("..") || path2.isAbsolute(rel)) return null;
990
+ return path2.join(this.skillsDir, rel.split(path2.sep)[0]);
563
991
  }
564
992
  /** 설치된 스킬 (skills/<이름>/SKILL.md 의 머리말 name, description). */
565
993
  listSkills() {
566
- if (!fs.existsSync(this.skillsDir)) return [];
994
+ if (!fs2.existsSync(this.skillsDir)) return [];
567
995
  const out = [];
568
- for (const d of fs.readdirSync(this.skillsDir, { withFileTypes: true })) {
996
+ for (const d of fs2.readdirSync(this.skillsDir, { withFileTypes: true })) {
569
997
  if (!d.isDirectory()) continue;
570
- const dir = path.join(this.skillsDir, d.name);
571
- const md = path.join(dir, "SKILL.md");
572
- if (!fs.existsSync(md)) continue;
998
+ const dir = path2.join(this.skillsDir, d.name);
999
+ const md = path2.join(dir, "SKILL.md");
1000
+ if (!fs2.existsSync(md)) continue;
573
1001
  const head = /^---\r?\n([\s\S]*?)\r?\n---/.exec(
574
- fs.readFileSync(md, "utf-8")
1002
+ fs2.readFileSync(md, "utf-8")
575
1003
  );
576
1004
  const field = (k) => {
577
1005
  if (!head) return "";
@@ -619,8 +1047,8 @@ ${this.skillIndexText()}`,
619
1047
  */
620
1048
  async installSkills(source, update2 = false) {
621
1049
  const src0 = source.trim();
622
- const localPath = path.resolve(src0.replace(/^~(?=$|[\\/])/, os.homedir()));
623
- if (/^[.~/\\]|^[A-Za-z]:[\\/]/.test(src0) && fs.existsSync(localPath)) {
1050
+ const localPath = path2.resolve(src0.replace(/^~(?=$|[\\/])/, os.homedir()));
1051
+ if (/^[.~/\\]|^[A-Za-z]:[\\/]/.test(src0) && fs2.existsSync(localPath)) {
624
1052
  return this.copySkills(localPath, `${localPath}`, update2);
625
1053
  }
626
1054
  let s = src0.replace(/^https:\/\/github\.com\//, "").replace(/\.git$/, "");
@@ -653,17 +1081,17 @@ ${this.skillIndexText()}`,
653
1081
  throw new Error(
654
1082
  `GitHub \uC5D0\uC11C \uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: HTTP ${r.status} (${owner}/${repo}@${ref})`
655
1083
  );
656
- const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "cb_skill_"));
1084
+ const tmp = fs2.mkdtempSync(path2.join(os.tmpdir(), "cb_skill_"));
657
1085
  try {
658
- fs.writeFileSync(
659
- path.join(tmp, "src.tgz"),
1086
+ fs2.writeFileSync(
1087
+ path2.join(tmp, "src.tgz"),
660
1088
  Buffer.from(await r.arrayBuffer())
661
1089
  );
662
1090
  const x = await this.exec(`"${tarBin}" -xzf src.tgz`, tmp, 120);
663
1091
  if (x.code !== 0) throw new Error(`\uC555\uCD95\uC744 \uD480\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${x.out}`);
664
- const top = fs.readdirSync(tmp).find((n) => n !== "src.tgz");
665
- const root = top ? path.join(tmp, top, ...sub.split("/").filter(Boolean)) : "";
666
- if (!root || !fs.existsSync(root))
1092
+ const top = fs2.readdirSync(tmp).find((n) => n !== "src.tgz");
1093
+ const root = top ? path2.join(tmp, top, ...sub.split("/").filter(Boolean)) : "";
1094
+ if (!root || !fs2.existsSync(root))
667
1095
  throw new Error(`\uADF8 \uACBD\uB85C\uAC00 \uC800\uC7A5\uC18C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${sub || "(\uB9E8 \uC704)"}`);
668
1096
  return this.copySkills(
669
1097
  root,
@@ -671,20 +1099,20 @@ ${this.skillIndexText()}`,
671
1099
  update2
672
1100
  );
673
1101
  } finally {
674
- fs.rmSync(tmp, { recursive: true, force: true });
1102
+ fs2.rmSync(tmp, { recursive: true, force: true });
675
1103
  }
676
1104
  }
677
1105
  copySkills(root, origin, update2) {
678
1106
  const found = [];
679
1107
  const walk = (d, depth) => {
680
- if (fs.existsSync(path.join(d, "SKILL.md"))) {
1108
+ if (fs2.existsSync(path2.join(d, "SKILL.md"))) {
681
1109
  found.push(d);
682
1110
  return;
683
1111
  }
684
1112
  if (depth >= 4) return;
685
- for (const n of fs.readdirSync(d, { withFileTypes: true }))
1113
+ for (const n of fs2.readdirSync(d, { withFileTypes: true }))
686
1114
  if (n.isDirectory() && !n.name.startsWith(".") && n.name !== "node_modules")
687
- walk(path.join(d, n.name), depth + 1);
1115
+ walk(path2.join(d, n.name), depth + 1);
688
1116
  };
689
1117
  walk(root, 0);
690
1118
  if (!found.length)
@@ -692,17 +1120,17 @@ ${this.skillIndexText()}`,
692
1120
  const installed = [];
693
1121
  const skipped = [];
694
1122
  for (const dir of found) {
695
- const name = path.basename(dir);
696
- const dest = path.join(this.skillsDir, name);
697
- if (fs.existsSync(path.join(dest, "SKILL.md")) && !update2) {
1123
+ const name = path2.basename(dir);
1124
+ const dest = path2.join(this.skillsDir, name);
1125
+ if (fs2.existsSync(path2.join(dest, "SKILL.md")) && !update2) {
698
1126
  skipped.push(name);
699
1127
  continue;
700
1128
  }
701
- fs.rmSync(dest, { recursive: true, force: true });
702
- fs.cpSync(dir, dest, { recursive: true });
703
- const rel = path.relative(root, dir).split(path.sep).join("/");
704
- fs.writeFileSync(
705
- path.join(dest, ".source"),
1129
+ fs2.rmSync(dest, { recursive: true, force: true });
1130
+ fs2.cpSync(dir, dest, { recursive: true });
1131
+ const rel = path2.relative(root, dir).split(path2.sep).join("/");
1132
+ fs2.writeFileSync(
1133
+ path2.join(dest, ".source"),
706
1134
  `${origin}${rel ? ` (${rel})` : ""}
707
1135
  `
708
1136
  );
@@ -717,15 +1145,15 @@ ${this.skillIndexText()}`,
717
1145
  async updateSkills() {
718
1146
  const sources = /* @__PURE__ */ new Set();
719
1147
  for (const k of this.listSkills()) {
720
- const f = path.join(k.dir, ".source");
721
- if (!fs.existsSync(f)) continue;
722
- const line = fs.readFileSync(f, "utf-8").trim();
1148
+ const f = path2.join(k.dir, ".source");
1149
+ if (!fs2.existsSync(f)) continue;
1150
+ const line = fs2.readFileSync(f, "utf-8").trim();
723
1151
  const origin = line.replace(/ \(.*\)$/, "");
724
1152
  const rel = /\((.*)\)$/.exec(line)?.[1];
725
1153
  const [base, ref] = origin.split("@");
726
1154
  if (ref && /^[0-9a-f]{40}$/.test(ref)) continue;
727
1155
  sources.add(
728
- rel && !path.isAbsolute(base) ? `${base}/${rel}@${ref ?? "HEAD"}` : origin
1156
+ rel && !path2.isAbsolute(base) ? `${base}/${rel}@${ref ?? "HEAD"}` : origin
729
1157
  );
730
1158
  }
731
1159
  const done = [];
@@ -737,7 +1165,7 @@ ${this.skillIndexText()}`,
737
1165
  try {
738
1166
  const r = await this.installSkills(source, update2);
739
1167
  const names = [...r.installed, ...r.skipped];
740
- const dirs = names.map((n) => path.join(this.skillsDir, n));
1168
+ const dirs = names.map((n) => path2.join(this.skillsDir, n));
741
1169
  return text(
742
1170
  `${r.installed.length ? `\uC124\uCE58: ${r.installed.join(", ")}` : ""}${r.skipped.length ? `${r.installed.length ? "\n" : ""}\uC774\uBBF8 \uC788\uC74C(update=true \uBA74 \uB2E4\uC2DC \uBC1B\uC74C): ${r.skipped.join(", ")}` : ""}
743
1171
 
@@ -750,24 +1178,64 @@ ${this.skillIndexText()}`,
750
1178
  describeSkill(dest, head) {
751
1179
  const files = [];
752
1180
  const walk = (d) => {
753
- for (const n of fs.readdirSync(d, { withFileTypes: true })) {
754
- const p = path.join(d, n.name);
1181
+ for (const n of fs2.readdirSync(d, { withFileTypes: true })) {
1182
+ const p = path2.join(d, n.name);
755
1183
  if (n.isDirectory()) walk(p);
756
- else files.push(path.relative(dest, p));
1184
+ else files.push(path2.relative(dest, p));
757
1185
  }
758
1186
  };
759
1187
  walk(dest);
760
- const req = [
761
- "requirements.txt",
762
- "tools/package.json",
763
- "package.json"
764
- ].filter((f) => fs.existsSync(path.join(dest, f)));
1188
+ const req = files.filter(
1189
+ (f) => /(^|\/)(requirements[^/]*\.txt|pyproject\.toml|package\.json|setup\.sh|install[^/]*\.(sh|ps1))$/i.test(
1190
+ f
1191
+ )
1192
+ );
1193
+ const docs = ["SKILL.md", "README.md"].filter((f) => fs2.existsSync(path2.join(dest, f))).map((f) => fs2.readFileSync(path2.join(dest, f), "utf-8")).join("\n");
1194
+ const KNOWN = [
1195
+ ["blender", /\bblender\b/i, "blender"],
1196
+ ["zbrush", /\bzbrush\b/i, "zbrush"],
1197
+ ["python", /\bpython3?\b|\.py\b/i, "python"],
1198
+ ["uv", /\buv (run|pip|tool)\b|\buvx\b/i, "uv"],
1199
+ ["node", /\bnode(\.js)?\b|\bnpm\b|\bnpx\b/i, "node"],
1200
+ ["ffmpeg", /\bffmpeg\b|\bffprobe\b/i, "ffmpeg"],
1201
+ ["git", /\bgit (clone|pull)\b/i, "git"]
1202
+ ];
1203
+ this.programs = findPrograms();
1204
+ const mentioned = KNOWN.filter(([, re]) => re.test(docs)).map(([n]) => n);
1205
+ const missing = mentioned.filter((n) => !this.programs[n]);
1206
+ const others = [
1207
+ "unity",
1208
+ "unreal",
1209
+ "godot",
1210
+ "maya",
1211
+ "houdini",
1212
+ "substance",
1213
+ "photoshop",
1214
+ "krita",
1215
+ "gimp",
1216
+ "davinci",
1217
+ "obs"
1218
+ ].filter((n) => new RegExp(`\\b${n}\\b`, "i").test(docs));
1219
+ const mcp = /\bmcp\b/i.test(docs);
765
1220
  return JSON.stringify(
766
1221
  {
767
1222
  result: head,
768
1223
  skill_dir: dest,
769
1224
  note: "\uC2A4\uD0AC \uBB38\uC11C\uC758 {{SKILL_DIR}}, ~/.claude/skills/<\uC774\uB984>, ~/.codex/skills/<\uC774\uB984> \uC740 skill_dir \uB85C \uBC14\uAFD4 \uC4F4\uB2E4. \uD30C\uC77C\uC740 read_file \uB85C \uC77D\uACE0 \uC2A4\uD06C\uB9BD\uD2B8\uB294 run \uC73C\uB85C \uB3CC\uB9B0\uB2E4.",
770
1225
  dependency_files: req,
1226
+ setup: {
1227
+ mentioned_programs: [...mentioned, ...others],
1228
+ missing_on_this_pc: missing,
1229
+ other_programs_to_check: others,
1230
+ mentions_mcp: mcp,
1231
+ steps: [
1232
+ "SKILL.md \uC640 README \uB97C \uB05D\uAE4C\uC9C0 \uC77D\uACE0 \uD544\uC694\uD55C \uAC83(\uD504\uB85C\uADF8\uB7A8, \uBC84\uC804, \uD328\uD0A4\uC9C0, MCP, OS \uC81C\uD55C)\uC744 \uC815\uB9AC\uD55C\uB2E4",
1233
+ "dependency_files \uAC00 \uC788\uC73C\uBA74 run \uC73C\uB85C \uD328\uD0A4\uC9C0\uB97C \uC124\uCE58\uD55C\uB2E4 (\uC608: uv pip install -r requirements.txt, npm ci)",
1234
+ "missing_on_this_pc, other_programs_to_check \uB294 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \uC124\uCE58 \uBC29\uBC95\uC744 \uC54C\uB824 \uC900\uB2E4 (\uC124\uCE58 \uD504\uB85C\uADF8\uB7A8\uC73C\uB85C \uAE4C\uB294 \uAC83\uC740 \uC9C1\uC811 \uD558\uAC8C)",
1235
+ mcp ? "\uC2A4\uD0AC\uC774 MCP \uB97C \uC4F0\uBA74 \uADF8 \uC124\uC815\uC744 \uC0AC\uC6A9\uC790 \uD5C8\uB77D\uC744 \uBC1B\uACE0 connectbase-local.json \uC758 mcpServers \uC5D0 \uB123\uACE0 mcp_reload \uD55C\uB2E4" : "MCP \uC5B8\uAE09\uC740 \uC5C6\uB2E4",
1236
+ "\uC900\uBE44 \uC0C1\uD0DC\uB97C \uD45C\uB85C \uBCF4\uC774\uACE0, \uC2A4\uD0AC\uC758 \uAC00\uC7A5 \uAC04\uB2E8\uD55C \uB3D9\uC791\uC744 \uD55C \uBC88 \uC2DC\uD5D8\uD55C\uB2E4"
1237
+ ]
1238
+ },
771
1239
  files: files.sort().slice(0, 400)
772
1240
  },
773
1241
  null,
@@ -775,8 +1243,8 @@ ${this.skillIndexText()}`,
775
1243
  );
776
1244
  }
777
1245
  exec(command, cwd, timeoutSec) {
778
- return new Promise((resolve4) => {
779
- const child = (0, import_node_child_process.spawn)(command, {
1246
+ return new Promise((resolve5) => {
1247
+ const child = (0, import_node_child_process2.spawn)(command, {
780
1248
  cwd,
781
1249
  shell: true,
782
1250
  env: this.env(),
@@ -796,24 +1264,24 @@ ${this.skillIndexText()}`,
796
1264
  }, timeoutSec * 1e3);
797
1265
  child.on("close", (code) => {
798
1266
  clearTimeout(t);
799
- resolve4({ code, out, timedOut });
1267
+ resolve5({ code, out, timedOut });
800
1268
  });
801
1269
  child.on("error", (e) => {
802
1270
  clearTimeout(t);
803
- resolve4({ code: -1, out: out + String(e), timedOut });
1271
+ resolve5({ code: -1, out: out + String(e), timedOut });
804
1272
  });
805
1273
  });
806
1274
  }
807
1275
  async run(command, cwd, timeout, background) {
808
1276
  if (!command.trim()) return text("command \uAC00 \uBE44\uC5C8\uC2B5\uB2C8\uB2E4", true);
809
1277
  const dir = this.inDir(cwd || ".");
810
- fs.mkdirSync(dir, { recursive: true });
1278
+ fs2.mkdirSync(dir, { recursive: true });
811
1279
  this.log(
812
- `\uC2E4\uD589${background ? " (\uBC31\uADF8\uB77C\uC6B4\uB4DC)" : ""}: ${command} [${path.relative(this.dir, dir) || "."}]`
1280
+ `\uC2E4\uD589${background ? " (\uBC31\uADF8\uB77C\uC6B4\uB4DC)" : ""}: ${command} [${path2.relative(this.dir, dir) || "."}]`
813
1281
  );
814
1282
  if (background) {
815
1283
  const id = `job${++this.jobSeq}`;
816
- const child = (0, import_node_child_process.spawn)(command, {
1284
+ const child = (0, import_node_child_process2.spawn)(command, {
817
1285
  cwd: dir,
818
1286
  shell: true,
819
1287
  env: this.env(),
@@ -883,7 +1351,7 @@ ${tail(j.out)}`,
883
1351
  return this.opts.blenderMcpPort ?? (Number(process.env.BLENDER_MCP_PORT) || 9876);
884
1352
  }
885
1353
  blenderSend(type, params, timeoutMs = 18e4) {
886
- return new Promise((resolve4, reject) => {
1354
+ return new Promise((resolve5, reject) => {
887
1355
  const sock = net.createConnection({
888
1356
  host: "127.0.0.1",
889
1357
  port: this.blenderPort
@@ -904,7 +1372,7 @@ ${tail(j.out)}`,
904
1372
  const obj = JSON.parse(buf.toString("utf-8"));
905
1373
  clearTimeout(timer);
906
1374
  sock.end();
907
- resolve4(obj);
1375
+ resolve5(obj);
908
1376
  } catch {
909
1377
  }
910
1378
  });
@@ -939,12 +1407,12 @@ Blender \uC5D0 BlenderMCP \uC560\uB4DC\uC628(github.com/ahujasid/blender-mcp \uC
939
1407
  }
940
1408
  async uploadToStorage(p, folder) {
941
1409
  const abs = this.inDir(p);
942
- if (!fs.existsSync(abs)) return text(`\uD30C\uC77C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4: ${p}`, true);
1410
+ if (!fs2.existsSync(abs)) return text(`\uD30C\uC77C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4: ${p}`, true);
943
1411
  try {
944
1412
  const url = await uploadFile(this.opts, abs, folder);
945
- this.log(`\uC62C\uB9BC: ${path.basename(abs)} \u2192 ${url}`);
1413
+ this.log(`\uC62C\uB9BC: ${path2.basename(abs)} \u2192 ${url}`);
946
1414
  return text(
947
- JSON.stringify({ uploaded: path.basename(abs), url }, null, 2)
1415
+ JSON.stringify({ uploaded: path2.basename(abs), url }, null, 2)
948
1416
  );
949
1417
  } catch (e) {
950
1418
  return text(e instanceof Error ? e.message : String(e), true);
@@ -959,7 +1427,7 @@ Blender \uC5D0 BlenderMCP \uC560\uB4DC\uC628(github.com/ahujasid/blender-mcp \uC
959
1427
  parts.push({
960
1428
  type: "image_url",
961
1429
  image_url: {
962
- url: `data:${mime};base64,${fs.readFileSync(abs).toString("base64")}`
1430
+ url: `data:${mime};base64,${fs2.readFileSync(abs).toString("base64")}`
963
1431
  }
964
1432
  });
965
1433
  }
@@ -998,8 +1466,8 @@ Blender \uC5D0 BlenderMCP \uC560\uB4DC\uC628(github.com/ahujasid/blender-mcp \uC
998
1466
  );
999
1467
  const src = str(images[0].url);
1000
1468
  const buf = src.startsWith("data:") ? Buffer.from(src.split(",", 2)[1], "base64") : Buffer.from(await (await fetch(src)).arrayBuffer());
1001
- fs.mkdirSync(path.dirname(out), { recursive: true });
1002
- fs.writeFileSync(out, buf);
1469
+ fs2.mkdirSync(path2.dirname(out), { recursive: true });
1470
+ fs2.writeFileSync(out, buf);
1003
1471
  return text(
1004
1472
  `\uC800\uC7A5\uD588\uC2B5\uB2C8\uB2E4: ${out} (${buf.length}B). view_image \uB85C \uD655\uC778\uD558\uC138\uC694.`
1005
1473
  );
@@ -1025,24 +1493,33 @@ Blender \uC5D0 BlenderMCP \uC560\uB4DC\uC628(github.com/ahujasid/blender-mcp \uC
1025
1493
  protocolVersion: PROTOCOL_VERSIONS.includes(want) ? want : PROTOCOL_VERSIONS[0],
1026
1494
  capabilities: { tools: { listChanged: false } },
1027
1495
  serverInfo: { name: "connectbase-local", version: "1.0.0" },
1028
- instructions: "\uC0AC\uC6A9\uC790 \uCEF4\uD4E8\uD130\uC758 \uB85C\uCEEC \uC2E4\uD589\uAE30. \uC774 \uCEF4\uD4E8\uD130\uC5D0 \uC124\uCE58\uB41C \uC2A4\uD0AC(read_skill \uC124\uBA85\uC758 \uBAA9\uB85D)\uC744 \uC77D\uACE0, \uADF8 \uC2A4\uD0AC\uC774 \uC694\uAD6C\uD558\uB294 \uC2A4\uD06C\uB9BD\uD2B8 \uC2E4\uD589, Blender(\uD5E4\uB4DC\uB9AC\uC2A4/\uC2E4\uD589 \uC911), ZBrush \uBE0C\uB9AC\uC9C0, \uADF8\uB9BC \uBCF4\uAE30\uB97C \uC5EC\uAE30\uC11C \uD55C\uB2E4. \uD504\uB85C\uADF8\uB7A8 \uD655\uC778\uC740 local_info."
1496
+ instructions: "\uC0AC\uC6A9\uC790 \uCEF4\uD4E8\uD130\uC758 \uB85C\uCEEC \uC2E4\uD589\uAE30. \uC774 \uCEF4\uD4E8\uD130\uC5D0 \uC124\uCE58\uB41C \uC2A4\uD0AC(read_skill \uC124\uBA85\uC758 \uBAA9\uB85D)\uC744 \uC77D\uACE0, \uADF8 \uC2A4\uD0AC\uC774 \uC694\uAD6C\uD558\uB294 \uC2A4\uD06C\uB9BD\uD2B8 \uC2E4\uD589, \uC774 PC \uC5D0 \uC815\uC758\uB41C MCP \uC11C\uBC84\uC758 \uB3C4\uAD6C(\uC124\uBA85\uC774 [\uB0B4 PC MCP: \uC774\uB984] \uC73C\uB85C \uC2DC\uC791), \uADF8\uB9BC \uBCF4\uAE30\uB97C \uC5EC\uAE30\uC11C \uD55C\uB2E4. \uD504\uB85C\uADF8\uB7A8\uACFC MCP \uC0C1\uD0DC \uD655\uC778\uC740 local_info."
1029
1497
  });
1030
1498
  }
1031
1499
  case "ping":
1032
1500
  return ok({});
1033
1501
  case "tools/list":
1034
- return ok({
1035
- tools: this.tools.map(
1036
- ({ name, description, inputSchema, annotations }) => ({
1037
- name,
1038
- description: name === "read_skill" ? this.skillIndexText() : description,
1039
- inputSchema,
1040
- ...annotations ? { annotations } : {}
1041
- })
1042
- )
1043
- });
1502
+ return ok({ tools: this.visibleTools() });
1044
1503
  case "tools/call": {
1045
1504
  const p = msg.params ?? {};
1505
+ if (this.hub.has(str(p.name))) {
1506
+ this.log(`MCP \uB3C4\uAD6C: ${str(p.name)}`);
1507
+ try {
1508
+ const r = await this.hub.call(
1509
+ str(p.name),
1510
+ p.arguments ?? {}
1511
+ );
1512
+ const content = (r.content ?? []).map(
1513
+ (c) => c.type === "text" || c.type === "image" ? c : { type: "text", text: JSON.stringify(c).slice(0, 2e4) }
1514
+ );
1515
+ return ok({
1516
+ content: content.length ? content : [{ type: "text", text: "(\uBE48 \uACB0\uACFC)" }],
1517
+ ...r.isError ? { isError: true } : {}
1518
+ });
1519
+ } catch (e) {
1520
+ return ok(text(e instanceof Error ? e.message : String(e), true));
1521
+ }
1522
+ }
1046
1523
  const tool = this.tools.find((t) => t.name === p.name);
1047
1524
  if (!tool) return fail(-32602, `\uC5C6\uB294 \uB3C4\uAD6C: ${str(p.name)}`);
1048
1525
  try {
@@ -1093,9 +1570,9 @@ Blender \uC5D0 BlenderMCP \uC560\uB4DC\uC628(github.com/ahujasid/blender-mcp \uC
1093
1570
  "Mcp-Session-Id": "local"
1094
1571
  }).end(out);
1095
1572
  });
1096
- return new Promise((resolve4, reject) => {
1573
+ return new Promise((resolve5, reject) => {
1097
1574
  server.once("error", reject);
1098
- server.listen(this.opts.port, "127.0.0.1", () => resolve4(server));
1575
+ server.listen(this.opts.port, "127.0.0.1", () => resolve5(server));
1099
1576
  });
1100
1577
  }
1101
1578
  };
@@ -1103,7 +1580,7 @@ function killTree(pid) {
1103
1580
  if (!pid) return;
1104
1581
  try {
1105
1582
  if (process.platform === "win32")
1106
- (0, import_node_child_process.spawn)("taskkill", ["/pid", String(pid), "/T", "/F"], {
1583
+ (0, import_node_child_process2.spawn)("taskkill", ["/pid", String(pid), "/T", "/F"], {
1107
1584
  windowsHide: true
1108
1585
  });
1109
1586
  else process.kill(pid, "SIGTERM");
@@ -1119,18 +1596,18 @@ function setUploader(fn) {
1119
1596
 
1120
1597
  // src/local-command.ts
1121
1598
  var LOCAL_SERVER_NAME = "\uB0B4 \uCEF4\uD4E8\uD130 (\uB85C\uCEEC \uC2E4\uD589\uAE30)";
1122
- var STATE_PATH = path2.join(os2.homedir(), ".connectbase", "local-runner.json");
1599
+ var STATE_PATH = path3.join(os2.homedir(), ".connectbase", "local-runner.json");
1123
1600
  function loadState() {
1124
1601
  try {
1125
- const s = JSON.parse(fs2.readFileSync(STATE_PATH, "utf-8"));
1602
+ const s = JSON.parse(fs3.readFileSync(STATE_PATH, "utf-8"));
1126
1603
  return { apps: s.apps ?? {}, token: s.token };
1127
1604
  } catch {
1128
1605
  return { apps: {} };
1129
1606
  }
1130
1607
  }
1131
1608
  function saveState(s) {
1132
- fs2.mkdirSync(path2.dirname(STATE_PATH), { recursive: true });
1133
- fs2.writeFileSync(STATE_PATH, `${JSON.stringify(s, null, 2)}
1609
+ fs3.mkdirSync(path3.dirname(STATE_PATH), { recursive: true });
1610
+ fs3.writeFileSync(STATE_PATH, `${JSON.stringify(s, null, 2)}
1134
1611
  `, {
1135
1612
  mode: 384
1136
1613
  });
@@ -1299,8 +1776,8 @@ function makeUploader(mcpUrl, getSt, save) {
1299
1776
  }
1300
1777
  save();
1301
1778
  }
1302
- const buf = fs2.readFileSync(abs);
1303
- const name = path2.basename(abs);
1779
+ const buf = fs3.readFileSync(abs);
1780
+ const name = path3.basename(abs);
1304
1781
  const mime = {
1305
1782
  ".glb": "model/gltf-binary",
1306
1783
  ".gltf": "model/gltf+json",
@@ -1312,7 +1789,7 @@ function makeUploader(mcpUrl, getSt, save) {
1312
1789
  ".fbx": "application/octet-stream",
1313
1790
  ".obj": "text/plain",
1314
1791
  ".json": "application/json"
1315
- }[path2.extname(name).toLowerCase()] ?? "application/octet-stream";
1792
+ }[path3.extname(name).toLowerCase()] ?? "application/octet-stream";
1316
1793
  const base = `${o.baseUrl}/v1/public/storages/files/${st.storageId}`;
1317
1794
  const presign = () => fetch(
1318
1795
  `${base}/presigned-url/path/${encodeURIComponent(folder)}/${encodeURIComponent(name)}`,
@@ -1360,8 +1837,8 @@ function makeUploader(mcpUrl, getSt, save) {
1360
1837
  };
1361
1838
  }
1362
1839
  async function runLocal(config, opts, startTunnel2, out) {
1363
- const dir = path2.resolve(
1364
- opts.dir || path2.join(os2.homedir(), "ConnectBaseLocal")
1840
+ const dir = path3.resolve(
1841
+ opts.dir || path3.join(os2.homedir(), "ConnectBaseLocal")
1365
1842
  );
1366
1843
  const port = opts.port || 47800;
1367
1844
  let syncTools = () => {
@@ -1393,6 +1870,22 @@ async function runLocal(config, opts, startTunnel2, out) {
1393
1870
  out.warn(`\uC2A4\uD0AC \uAC31\uC2E0 \uC2E4\uD328: ${e instanceof Error ? e.message : e}`);
1394
1871
  }
1395
1872
  }
1873
+ for (const flag of (opts.mcp ?? "").split("\0").filter(Boolean)) {
1874
+ try {
1875
+ const { name, def } = parseMcpFlag(flag);
1876
+ const cfg = loadLocalConfig(dir);
1877
+ cfg.mcpServers[name] = def;
1878
+ saveLocalConfig(dir, cfg);
1879
+ out.success(`MCP ${name} \uB97C ${LOCAL_CONFIG_FILE} \uC5D0 \uB123\uC5C8\uC2B5\uB2C8\uB2E4`);
1880
+ } catch (e) {
1881
+ out.warn(e instanceof Error ? e.message : String(e));
1882
+ }
1883
+ }
1884
+ await runner.startMcp();
1885
+ const mcp = runner.hub.status();
1886
+ out.info(
1887
+ mcp.length ? `\uC774 PC \uC758 MCP ${mcp.length}\uAC1C: ${mcp.map((m) => `${m.name}(${m.ok ? `\uB3C4\uAD6C ${m.tools}\uAC1C` : "\uC5F0\uACB0 \uC2E4\uD328"})`).join(", ")}` : `\uC774 PC \uC758 MCP \uC5C6\uC74C (\uC2A4\uD0AC\uC774 MCP \uB97C \uC4F0\uBA74: --mcp \uC774\uB984="\uBA85\uB839" \uB610\uB294 ${path3.join(dir, LOCAL_CONFIG_FILE)} \uC5D0 mcpServers)`
1888
+ );
1396
1889
  await runner.listen();
1397
1890
  const skills = runner.listSkills().map((k) => k.name);
1398
1891
  out.info(
@@ -1478,13 +1971,13 @@ async function runLocal(config, opts, startTunnel2, out) {
1478
1971
  }
1479
1972
 
1480
1973
  // src/tunnel-utils.ts
1481
- var fs3 = __toESM(require("fs"));
1974
+ var fs4 = __toESM(require("fs"));
1482
1975
  var os3 = __toESM(require("os"));
1483
- var path3 = __toESM(require("path"));
1976
+ var path4 = __toESM(require("path"));
1484
1977
  function getTunnelLockDir() {
1485
1978
  const platform2 = os3.platform();
1486
1979
  if (platform2 === "darwin") {
1487
- return path3.join(
1980
+ return path4.join(
1488
1981
  os3.homedir(),
1489
1982
  "Library",
1490
1983
  "Application Support",
@@ -1492,14 +1985,14 @@ function getTunnelLockDir() {
1492
1985
  "tunnel-locks"
1493
1986
  );
1494
1987
  } else if (platform2 === "win32") {
1495
- return path3.join(
1496
- process.env.LOCALAPPDATA || path3.join(os3.homedir(), "AppData", "Local"),
1988
+ return path4.join(
1989
+ process.env.LOCALAPPDATA || path4.join(os3.homedir(), "AppData", "Local"),
1497
1990
  "connectbase",
1498
1991
  "tunnel-locks"
1499
1992
  );
1500
1993
  }
1501
- const stateHome = process.env.XDG_STATE_HOME || path3.join(os3.homedir(), ".local", "state");
1502
- return path3.join(stateHome, "connectbase", "tunnel-locks");
1994
+ const stateHome = process.env.XDG_STATE_HOME || path4.join(os3.homedir(), ".local", "state");
1995
+ return path4.join(stateHome, "connectbase", "tunnel-locks");
1503
1996
  }
1504
1997
  function isProcessAlive(pid) {
1505
1998
  try {
@@ -1511,8 +2004,8 @@ function isProcessAlive(pid) {
1511
2004
  }
1512
2005
  function acquireTunnelLock(appID, port, force, version) {
1513
2006
  const lockDir = getTunnelLockDir();
1514
- fs3.mkdirSync(lockDir, { recursive: true });
1515
- const lockPath = path3.join(lockDir, `${appID}-${port}.lock`);
2007
+ fs4.mkdirSync(lockDir, { recursive: true });
2008
+ const lockPath = path4.join(lockDir, `${appID}-${port}.lock`);
1516
2009
  const lockData = {
1517
2010
  pid: process.pid,
1518
2011
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -1523,9 +2016,9 @@ function acquireTunnelLock(appID, port, force, version) {
1523
2016
  };
1524
2017
  if (!force) {
1525
2018
  try {
1526
- const fd = fs3.openSync(lockPath, "wx");
1527
- fs3.writeSync(fd, JSON.stringify(lockData, null, 2));
1528
- fs3.closeSync(fd);
2019
+ const fd = fs4.openSync(lockPath, "wx");
2020
+ fs4.writeSync(fd, JSON.stringify(lockData, null, 2));
2021
+ fs4.closeSync(fd);
1529
2022
  return lockPath;
1530
2023
  } catch (e) {
1531
2024
  if (e.code !== "EEXIST") {
@@ -1534,7 +2027,7 @@ function acquireTunnelLock(appID, port, force, version) {
1534
2027
  }
1535
2028
  try {
1536
2029
  const existing = JSON.parse(
1537
- fs3.readFileSync(lockPath, "utf-8")
2030
+ fs4.readFileSync(lockPath, "utf-8")
1538
2031
  );
1539
2032
  if (isProcessAlive(existing.pid)) {
1540
2033
  return `LOCKED:${existing.pid}:${existing.startedAt}:${existing.host}`;
@@ -1542,12 +2035,12 @@ function acquireTunnelLock(appID, port, force, version) {
1542
2035
  } catch {
1543
2036
  }
1544
2037
  }
1545
- fs3.writeFileSync(lockPath, JSON.stringify(lockData, null, 2));
2038
+ fs4.writeFileSync(lockPath, JSON.stringify(lockData, null, 2));
1546
2039
  return lockPath;
1547
2040
  }
1548
2041
  function releaseTunnelLock(lockPath) {
1549
2042
  try {
1550
- fs3.unlinkSync(lockPath);
2043
+ fs4.unlinkSync(lockPath);
1551
2044
  } catch {
1552
2045
  }
1553
2046
  }
@@ -1578,7 +2071,7 @@ function handleTunnelError(msg, appId, localPort) {
1578
2071
  }
1579
2072
 
1580
2073
  // src/cli.ts
1581
- var VERSION = "6.23.0" ? "6.23.0" : getPackageVersion();
2074
+ var VERSION = "6.25.0" ? "6.25.0" : getPackageVersion();
1582
2075
  var DEFAULT_BASE_URL = "https://api.connectbase.world";
1583
2076
  var colors = {
1584
2077
  reset: "\x1B[0m",
@@ -1717,23 +2210,23 @@ var MIME_BY_EXT = {
1717
2210
  ".safetensors": "application/octet-stream"
1718
2211
  };
1719
2212
  function guessMimeType(filePath) {
1720
- if (ALLOWED_EXTENSIONLESS_FILES.has(path4.basename(filePath))) {
2213
+ if (ALLOWED_EXTENSIONLESS_FILES.has(path5.basename(filePath))) {
1721
2214
  return "text/plain; charset=utf-8";
1722
2215
  }
1723
- return MIME_BY_EXT[path4.extname(filePath).toLowerCase()] || "application/octet-stream";
2216
+ return MIME_BY_EXT[path5.extname(filePath).toLowerCase()] || "application/octet-stream";
1724
2217
  }
1725
2218
  function isAllowedDeployExt(filePath) {
1726
- if (ALLOWED_EXTENSIONLESS_FILES.has(path4.basename(filePath))) {
2219
+ if (ALLOWED_EXTENSIONLESS_FILES.has(path5.basename(filePath))) {
1727
2220
  return true;
1728
2221
  }
1729
- return ALLOWED_EXTENSIONS.has(path4.extname(filePath).toLowerCase());
2222
+ return ALLOWED_EXTENSIONS.has(path5.extname(filePath).toLowerCase());
1730
2223
  }
1731
2224
  function isBinaryDeployExt(filePath) {
1732
- return BINARY_EXTENSIONS.has(path4.extname(filePath).toLowerCase());
2225
+ return BINARY_EXTENSIONS.has(path5.extname(filePath).toLowerCase());
1733
2226
  }
1734
2227
  function isExtensionlessDataFile(filePath) {
1735
- const base = path4.basename(filePath);
1736
- return path4.extname(base) === "" && !ALLOWED_EXTENSIONLESS_FILES.has(base);
2228
+ const base = path5.basename(filePath);
2229
+ return path5.extname(base) === "" && !ALLOWED_EXTENSIONLESS_FILES.has(base);
1737
2230
  }
1738
2231
  var WEB_FILE_MAX_STORED_BYTES = 6 * 1024 * 1024 - 64 * 1024;
1739
2232
  var DEPLOY_REQUEST_BUDGET_BYTES = 96 * 1024 * 1024;
@@ -1814,10 +2307,10 @@ function loadConfig() {
1814
2307
  baseUrl: envBaseUrl || DEFAULT_BASE_URL,
1815
2308
  baseUrlFromRepo: false
1816
2309
  };
1817
- const rcPath = path4.join(process.cwd(), ".connectbaserc");
1818
- if (fs4.existsSync(rcPath)) {
2310
+ const rcPath = path5.join(process.cwd(), ".connectbaserc");
2311
+ if (fs5.existsSync(rcPath)) {
1819
2312
  try {
1820
- const rcContent = JSON.parse(fs4.readFileSync(rcPath, "utf-8"));
2313
+ const rcContent = JSON.parse(fs5.readFileSync(rcPath, "utf-8"));
1821
2314
  if (rcContent.publicKey) config.publicKey = rcContent.publicKey;
1822
2315
  if (rcContent.secretKey) config.secretKey = rcContent.secretKey;
1823
2316
  if (rcContent.storageId) config.storageId = rcContent.storageId;
@@ -1842,16 +2335,16 @@ function collectDeployFiles(dir, options = {}) {
1842
2335
  }
1843
2336
  function collectFiles(dir, baseDir, skipped, options) {
1844
2337
  const files = [];
1845
- const entries = fs4.readdirSync(dir, { withFileTypes: true });
2338
+ const entries = fs5.readdirSync(dir, { withFileTypes: true });
1846
2339
  for (const entry of entries) {
1847
- const fullPath = path4.join(dir, entry.name);
1848
- const relativePath = path4.relative(baseDir, fullPath);
2340
+ const fullPath = path5.join(dir, entry.name);
2341
+ const relativePath = path5.relative(baseDir, fullPath);
1849
2342
  if (entry.isDirectory()) {
1850
2343
  if (!entry.name.startsWith(".")) {
1851
2344
  files.push(...collectFiles(fullPath, baseDir, skipped, options));
1852
2345
  }
1853
2346
  } else if (entry.isFile()) {
1854
- const ext = path4.extname(entry.name).toLowerCase();
2347
+ const ext = path5.extname(entry.name).toLowerCase();
1855
2348
  if (entry.name.startsWith(".")) {
1856
2349
  continue;
1857
2350
  }
@@ -1863,9 +2356,9 @@ function collectFiles(dir, baseDir, skipped, options) {
1863
2356
  const isBinary = extensionlessData || BINARY_EXTENSIONS.has(ext);
1864
2357
  let content;
1865
2358
  if (isBinary) {
1866
- content = fs4.readFileSync(fullPath).toString("base64");
2359
+ content = fs5.readFileSync(fullPath).toString("base64");
1867
2360
  } else {
1868
- content = fs4.readFileSync(fullPath, "utf-8");
2361
+ content = fs5.readFileSync(fullPath, "utf-8");
1869
2362
  }
1870
2363
  const normalized = normalizeRelativePath(relativePath);
1871
2364
  files.push({
@@ -1891,7 +2384,7 @@ function formatSkippedFilesReport(skipped, limit = SKIPPED_FILES_LIST_LIMIT) {
1891
2384
  }
1892
2385
  const byExt = /* @__PURE__ */ new Map();
1893
2386
  for (const p of skipped) {
1894
- const ext = path4.extname(p).toLowerCase() || "(\uD655\uC7A5\uC790 \uC5C6\uC74C)";
2387
+ const ext = path5.extname(p).toLowerCase() || "(\uD655\uC7A5\uC790 \uC5C6\uC74C)";
1895
2388
  byExt.set(ext, (byExt.get(ext) ?? 0) + 1);
1896
2389
  }
1897
2390
  const extSummary = [...byExt.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([ext, n]) => `${ext} ${n}\uAC1C`).join(", ");
@@ -1971,7 +2464,7 @@ async function requestDeployPresign(baseStorageUrl, headers, files, timeoutMs) {
1971
2464
  return parsed?.urls ?? [];
1972
2465
  }
1973
2466
  function putToPresignedUrl(uploadUrl, body, contentType, timeoutMs) {
1974
- return new Promise((resolve4, reject) => {
2467
+ return new Promise((resolve5, reject) => {
1975
2468
  let parsed;
1976
2469
  try {
1977
2470
  parsed = new URL(uploadUrl);
@@ -2002,7 +2495,7 @@ function putToPresignedUrl(uploadUrl, body, contentType, timeoutMs) {
2002
2495
  res.on("end", () => {
2003
2496
  const status = res.statusCode || 0;
2004
2497
  if (status >= 200 && status < 300) {
2005
- resolve4();
2498
+ resolve5();
2006
2499
  return;
2007
2500
  }
2008
2501
  reject(
@@ -2154,7 +2647,7 @@ function apiErrorMessage(data, status) {
2154
2647
  return suggestion ? `${message} (${suggestion})` : message;
2155
2648
  }
2156
2649
  async function makeRequest(url, method, headers, body, reqOpts = {}) {
2157
- return new Promise((resolve4, reject) => {
2650
+ return new Promise((resolve5, reject) => {
2158
2651
  const parsedUrl = new URL(url);
2159
2652
  const isHttps = parsedUrl.protocol === "https:";
2160
2653
  const lib = isHttps ? https : http2;
@@ -2180,12 +2673,12 @@ async function makeRequest(url, method, headers, body, reqOpts = {}) {
2180
2673
  res.on("end", () => {
2181
2674
  const data = Buffer.concat(chunks).toString("utf8");
2182
2675
  try {
2183
- resolve4({
2676
+ resolve5({
2184
2677
  status: res.statusCode || 0,
2185
2678
  data: data ? JSON.parse(data) : null
2186
2679
  });
2187
2680
  } catch {
2188
- resolve4({ status: res.statusCode || 0, data });
2681
+ resolve5({ status: res.statusCode || 0, data });
2189
2682
  }
2190
2683
  });
2191
2684
  });
@@ -2218,27 +2711,27 @@ function computeDeployTimeout(totalBytes, override) {
2218
2711
  return Math.max(DEPLOY_TIMEOUT_MIN_MS, DEPLOY_TIMEOUT_BASE_MS + sizeBased);
2219
2712
  }
2220
2713
  async function deploy(directory, config, isDev = false, deployOpts = {}) {
2221
- const dir = path4.resolve(directory);
2222
- if (!fs4.existsSync(dir)) {
2714
+ const dir = path5.resolve(directory);
2715
+ if (!fs5.existsSync(dir)) {
2223
2716
  error(`\uB514\uB809\uD1A0\uB9AC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${dir}`);
2224
2717
  process.exit(1);
2225
2718
  }
2226
- const pkgPath = path4.join(process.cwd(), "package.json");
2227
- if (fs4.existsSync(pkgPath)) {
2719
+ const pkgPath = path5.join(process.cwd(), "package.json");
2720
+ if (fs5.existsSync(pkgPath)) {
2228
2721
  try {
2229
- const pkg = JSON.parse(fs4.readFileSync(pkgPath, "utf-8"));
2722
+ const pkg = JSON.parse(fs5.readFileSync(pkgPath, "utf-8"));
2230
2723
  const pm = packageManagerCommands(detectPackageManager(process.cwd()));
2231
2724
  const inside = runningInsidePackageScript(pkg.scripts ?? {});
2232
2725
  for (const line of buildFirstHint(pkg, pm, inside)) warn(line);
2233
2726
  } catch {
2234
2727
  }
2235
2728
  }
2236
- if (!fs4.statSync(dir).isDirectory()) {
2729
+ if (!fs5.statSync(dir).isDirectory()) {
2237
2730
  error(`${dir}\uB294 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC544\uB2D9\uB2C8\uB2E4`);
2238
2731
  process.exit(1);
2239
2732
  }
2240
- const indexPath = path4.join(dir, "index.html");
2241
- if (!fs4.existsSync(indexPath)) {
2733
+ const indexPath = path5.join(dir, "index.html");
2734
+ if (!fs5.existsSync(indexPath)) {
2242
2735
  error("index.html \uD30C\uC77C\uC774 \uD544\uC694\uD569\uB2C8\uB2E4");
2243
2736
  process.exit(1);
2244
2737
  }
@@ -2597,15 +3090,15 @@ function prompt(question) {
2597
3090
  input: process.stdin,
2598
3091
  output: process.stdout
2599
3092
  });
2600
- return new Promise((resolve4) => {
3093
+ return new Promise((resolve5) => {
2601
3094
  rl.question(question, (answer) => {
2602
3095
  rl.close();
2603
- resolve4(answer.trim());
3096
+ resolve5(answer.trim());
2604
3097
  });
2605
3098
  });
2606
3099
  }
2607
3100
  function promptSecret(question) {
2608
- return new Promise((resolve4) => {
3101
+ return new Promise((resolve5) => {
2609
3102
  process.stdout.write(question);
2610
3103
  const input = [];
2611
3104
  if (!process.stdin.isTTY) {
@@ -2615,7 +3108,7 @@ function promptSecret(question) {
2615
3108
  });
2616
3109
  rl.question("", (answer) => {
2617
3110
  rl.close();
2618
- resolve4(answer.trim());
3111
+ resolve5(answer.trim());
2619
3112
  });
2620
3113
  return;
2621
3114
  }
@@ -2630,7 +3123,7 @@ function promptSecret(question) {
2630
3123
  process.stdin.pause();
2631
3124
  process.stdin.removeListener("data", onData);
2632
3125
  process.stdout.write("\n");
2633
- resolve4(input.join("").trim());
3126
+ resolve5(input.join("").trim());
2634
3127
  return;
2635
3128
  } else if (code === 3) {
2636
3129
  process.stdin.setRawMode(false);
@@ -2681,8 +3174,8 @@ function browserOpenCommand(url, platform2 = process.platform) {
2681
3174
  function openBrowser(url) {
2682
3175
  const opener = browserOpenCommand(url);
2683
3176
  if (!opener) return;
2684
- const { spawn: spawn2 } = require("child_process");
2685
- const child = spawn2(opener.command, opener.args, {
3177
+ const { spawn: spawn3 } = require("child_process");
3178
+ const child = spawn3(opener.command, opener.args, {
2686
3179
  stdio: "ignore",
2687
3180
  detached: true
2688
3181
  });
@@ -2749,7 +3242,7 @@ ${colors.cyan}\uBE0C\uB77C\uC6B0\uC800\uC5D0\uC11C \uB85C\uADF8\uC778\uD558\uC13
2749
3242
  process.stdout.write(
2750
3243
  `\r${colors.blue}${frame}${colors.reset} \uBE0C\uB77C\uC6B0\uC800\uC5D0\uC11C \uC2B9\uC778 \uB300\uAE30 \uC911...`
2751
3244
  );
2752
- await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
3245
+ await new Promise((resolve5) => setTimeout(resolve5, pollInterval));
2753
3246
  try {
2754
3247
  const pollRes = await makeRequest(
2755
3248
  `${baseUrl}/v1/public/cli-auth/poll/${session_id}`,
@@ -2844,11 +3337,11 @@ ${colors.dim}\uC778\uC99D \uBC29\uC2DD\uC744 \uC120\uD0DD\uD558\uC138\uC694:${co
2844
3337
  return entered;
2845
3338
  }
2846
3339
  function saveSecretKeyToRc(secretKey, dir = process.cwd()) {
2847
- const rcPath = path4.join(dir, ".connectbaserc");
3340
+ const rcPath = path5.join(dir, ".connectbaserc");
2848
3341
  let rcData = {};
2849
- if (fs4.existsSync(rcPath)) {
3342
+ if (fs5.existsSync(rcPath)) {
2850
3343
  try {
2851
- rcData = JSON.parse(fs4.readFileSync(rcPath, "utf-8"));
3344
+ rcData = JSON.parse(fs5.readFileSync(rcPath, "utf-8"));
2852
3345
  } catch {
2853
3346
  }
2854
3347
  }
@@ -2886,11 +3379,11 @@ ${colors.cyan}Connect Base \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654${colors.r
2886
3379
  );
2887
3380
  process.exit(1);
2888
3381
  }
2889
- const rcPath = path4.join(cwd, ".connectbaserc");
3382
+ const rcPath = path5.join(cwd, ".connectbaserc");
2890
3383
  let existingRc = {};
2891
- if (fs4.existsSync(rcPath)) {
3384
+ if (fs5.existsSync(rcPath)) {
2892
3385
  try {
2893
- existingRc = JSON.parse(fs4.readFileSync(rcPath, "utf-8"));
3386
+ existingRc = JSON.parse(fs5.readFileSync(rcPath, "utf-8"));
2894
3387
  } catch {
2895
3388
  }
2896
3389
  if (nonInteractive) {
@@ -2933,7 +3426,7 @@ ${colors.cyan}Connect Base \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654${colors.r
2933
3426
  }
2934
3427
  let appId = "";
2935
3428
  let publicKey = "";
2936
- const projectName = path4.basename(cwd);
3429
+ const projectName = path5.basename(cwd);
2937
3430
  const reuseKeyIfSameApp = (selectedAppId) => {
2938
3431
  if (existingRc.appId === selectedAppId && existingRc.publicKey?.startsWith("cb_pk_")) {
2939
3432
  publicKey = existingRc.publicKey;
@@ -3208,17 +3701,17 @@ ${colors.dim}Claude Code\uC5D0\uC11C MCP\uAC00 \uC790\uB3D9 \uC5F0\uACB0\uB429\u
3208
3701
  `);
3209
3702
  }
3210
3703
  function detectBuildDir() {
3211
- if (fs4.existsSync(path4.join(process.cwd(), "dist"))) return "./dist";
3212
- if (fs4.existsSync(path4.join(process.cwd(), "build"))) return "./build";
3213
- if (fs4.existsSync(path4.join(process.cwd(), "out"))) return "./out";
3214
- const nextConfig = ["next.config.js", "next.config.mjs", "next.config.ts"].map((f) => path4.join(process.cwd(), f)).find((f) => fs4.existsSync(f));
3215
- if (nextConfig || fs4.existsSync(path4.join(process.cwd(), ".next"))) {
3704
+ if (fs5.existsSync(path5.join(process.cwd(), "dist"))) return "./dist";
3705
+ if (fs5.existsSync(path5.join(process.cwd(), "build"))) return "./build";
3706
+ if (fs5.existsSync(path5.join(process.cwd(), "out"))) return "./out";
3707
+ const nextConfig = ["next.config.js", "next.config.mjs", "next.config.ts"].map((f) => path5.join(process.cwd(), f)).find((f) => fs5.existsSync(f));
3708
+ if (nextConfig || fs5.existsSync(path5.join(process.cwd(), ".next"))) {
3216
3709
  if (nextConfig) {
3217
3710
  try {
3218
- const src = fs4.readFileSync(nextConfig, "utf-8");
3711
+ const src = fs5.readFileSync(nextConfig, "utf-8");
3219
3712
  if (!/output\s*:\s*['"]export['"]/.test(src)) {
3220
3713
  warn(
3221
- `Next.js \uAC10\uC9C0: \uC815\uC801 \uBC30\uD3EC\uD558\uB824\uBA74 ${path4.basename(nextConfig)}\uC5D0 output: 'export' \uC124\uC815\uC774 \uD544\uC694\uD569\uB2C8\uB2E4`
3714
+ `Next.js \uAC10\uC9C0: \uC815\uC801 \uBC30\uD3EC\uD558\uB824\uBA74 ${path5.basename(nextConfig)}\uC5D0 output: 'export' \uC124\uC815\uC774 \uD544\uC694\uD569\uB2C8\uB2E4`
3222
3715
  );
3223
3716
  }
3224
3717
  } catch {
@@ -3226,25 +3719,25 @@ function detectBuildDir() {
3226
3719
  }
3227
3720
  return "./out";
3228
3721
  }
3229
- if (fs4.existsSync(path4.join(process.cwd(), "vite.config.ts")) || fs4.existsSync(path4.join(process.cwd(), "vite.config.js")))
3722
+ if (fs5.existsSync(path5.join(process.cwd(), "vite.config.ts")) || fs5.existsSync(path5.join(process.cwd(), "vite.config.js")))
3230
3723
  return "./dist";
3231
3724
  return "./dist";
3232
3725
  }
3233
3726
  function writeSecretFile(filePath, content) {
3234
3727
  try {
3235
- if (fs4.existsSync(filePath)) fs4.chmodSync(filePath, 384);
3728
+ if (fs5.existsSync(filePath)) fs5.chmodSync(filePath, 384);
3236
3729
  } catch {
3237
3730
  }
3238
- fs4.writeFileSync(filePath, content, { mode: 384 });
3731
+ fs5.writeFileSync(filePath, content, { mode: 384 });
3239
3732
  }
3240
3733
  function addToGitignore(entry, basePath) {
3241
3734
  const dir = basePath || process.cwd();
3242
- const gitignorePath = path4.join(dir, ".gitignore");
3243
- if (fs4.existsSync(gitignorePath)) {
3244
- const content = fs4.readFileSync(gitignorePath, "utf-8");
3735
+ const gitignorePath = path5.join(dir, ".gitignore");
3736
+ if (fs5.existsSync(gitignorePath)) {
3737
+ const content = fs5.readFileSync(gitignorePath, "utf-8");
3245
3738
  const lines = content.split(/\r?\n/).map((l) => l.trim());
3246
3739
  if (!lines.includes(entry)) {
3247
- fs4.appendFileSync(gitignorePath, `
3740
+ fs5.appendFileSync(gitignorePath, `
3248
3741
  # Connect Base
3249
3742
  ${entry}
3250
3743
  `);
@@ -3253,7 +3746,7 @@ ${entry}
3253
3746
  info(`.gitignore\uC5D0 \uC774\uBBF8 ${entry}\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4`);
3254
3747
  }
3255
3748
  } else {
3256
- fs4.writeFileSync(gitignorePath, `# Connect Base
3749
+ fs5.writeFileSync(gitignorePath, `# Connect Base
3257
3750
  ${entry}
3258
3751
  `);
3259
3752
  success(".gitignore \uC0DD\uC131 \uC644\uB8CC");
@@ -3284,8 +3777,8 @@ function ancestorCommandLines(maxDepth = 8) {
3284
3777
  let ppid = 0;
3285
3778
  try {
3286
3779
  if (process.platform === "linux") {
3287
- cmd = fs4.readFileSync(`/proc/${pid}/cmdline`).toString("utf8").replace(/\0/g, " ").trim();
3288
- const stat = fs4.readFileSync(`/proc/${pid}/stat`, "utf8");
3780
+ cmd = fs5.readFileSync(`/proc/${pid}/cmdline`).toString("utf8").replace(/\0/g, " ").trim();
3781
+ const stat = fs5.readFileSync(`/proc/${pid}/stat`, "utf8");
3289
3782
  ppid = parseInt(
3290
3783
  stat.slice(stat.lastIndexOf(")") + 2).split(" ")[1],
3291
3784
  10
@@ -3329,7 +3822,7 @@ function buildFirstHint(pkg, pm, insideScript) {
3329
3822
  function detectPackageManager(startDir = process.cwd()) {
3330
3823
  try {
3331
3824
  const pkg = JSON.parse(
3332
- fs4.readFileSync(path4.join(startDir, "package.json"), "utf-8")
3825
+ fs5.readFileSync(path5.join(startDir, "package.json"), "utf-8")
3333
3826
  );
3334
3827
  const declared = typeof pkg.packageManager === "string" ? pkg.packageManager.split("@")[0] : "";
3335
3828
  if (declared === "npm" || declared === "pnpm" || declared === "yarn" || declared === "bun") {
@@ -3345,13 +3838,13 @@ function detectPackageManager(startDir = process.cwd()) {
3345
3838
  ["package-lock.json", "npm"],
3346
3839
  ["npm-shrinkwrap.json", "npm"]
3347
3840
  ];
3348
- let dir = path4.resolve(startDir);
3841
+ let dir = path5.resolve(startDir);
3349
3842
  for (; ; ) {
3350
3843
  for (const [file, pm] of lockfiles) {
3351
- if (fs4.existsSync(path4.join(dir, file))) return pm;
3844
+ if (fs5.existsSync(path5.join(dir, file))) return pm;
3352
3845
  }
3353
- if (fs4.existsSync(path4.join(dir, ".git"))) break;
3354
- const parent = path4.dirname(dir);
3846
+ if (fs5.existsSync(path5.join(dir, ".git"))) break;
3847
+ const parent = path5.dirname(dir);
3355
3848
  if (parent === dir) break;
3356
3849
  dir = parent;
3357
3850
  }
@@ -3365,13 +3858,13 @@ function packageManagerCommands(pm) {
3365
3858
  };
3366
3859
  }
3367
3860
  function addDeployScript(deployDir, pm) {
3368
- const pkgPath = path4.join(process.cwd(), "package.json");
3369
- if (!fs4.existsSync(pkgPath)) {
3861
+ const pkgPath = path5.join(process.cwd(), "package.json");
3862
+ if (!fs5.existsSync(pkgPath)) {
3370
3863
  warn("package.json\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC5B4 deploy \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uCD94\uAC00\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4");
3371
3864
  return { needsInstall: false };
3372
3865
  }
3373
3866
  try {
3374
- const pkg = JSON.parse(fs4.readFileSync(pkgPath, "utf-8"));
3867
+ const pkg = JSON.parse(fs5.readFileSync(pkgPath, "utf-8"));
3375
3868
  if (!pkg.scripts) pkg.scripts = {};
3376
3869
  const declared = (name) => Boolean(pkg.dependencies?.[name] || pkg.devDependencies?.[name]);
3377
3870
  let needsInstall = false;
@@ -3389,7 +3882,7 @@ function addDeployScript(deployDir, pm) {
3389
3882
  pkg.scripts.deploy = pkg.scripts.build ? `${pm.run("build")} && ${deployCmd}` : deployCmd;
3390
3883
  success("package.json\uC5D0 deploy \uC2A4\uD06C\uB9BD\uD2B8 \uCD94\uAC00 \uC644\uB8CC");
3391
3884
  }
3392
- fs4.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
3885
+ fs5.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
3393
3886
  `);
3394
3887
  if (needsInstall) {
3395
3888
  success(
@@ -3420,32 +3913,32 @@ function detectMonorepo(gitRoot) {
3420
3913
  root: gitRoot,
3421
3914
  isSubPackage: false
3422
3915
  };
3423
- if (fs4.existsSync(path4.join(gitRoot, "pnpm-workspace.yaml"))) {
3916
+ if (fs5.existsSync(path5.join(gitRoot, "pnpm-workspace.yaml"))) {
3424
3917
  result.type = "pnpm";
3425
- } else if (fs4.existsSync(path4.join(gitRoot, "turbo.json"))) {
3918
+ } else if (fs5.existsSync(path5.join(gitRoot, "turbo.json"))) {
3426
3919
  result.type = "turborepo";
3427
- } else if (fs4.existsSync(path4.join(gitRoot, "nx.json"))) {
3920
+ } else if (fs5.existsSync(path5.join(gitRoot, "nx.json"))) {
3428
3921
  result.type = "nx";
3429
- } else if (fs4.existsSync(path4.join(gitRoot, "lerna.json"))) {
3922
+ } else if (fs5.existsSync(path5.join(gitRoot, "lerna.json"))) {
3430
3923
  result.type = "lerna";
3431
3924
  } else {
3432
- const rootPkgPath = path4.join(gitRoot, "package.json");
3433
- if (fs4.existsSync(rootPkgPath)) {
3925
+ const rootPkgPath = path5.join(gitRoot, "package.json");
3926
+ if (fs5.existsSync(rootPkgPath)) {
3434
3927
  try {
3435
- const pkg = JSON.parse(fs4.readFileSync(rootPkgPath, "utf-8"));
3928
+ const pkg = JSON.parse(fs5.readFileSync(rootPkgPath, "utf-8"));
3436
3929
  if (pkg.workspaces) {
3437
- result.type = fs4.existsSync(path4.join(gitRoot, "yarn.lock")) ? "yarn" : "npm";
3930
+ result.type = fs5.existsSync(path5.join(gitRoot, "yarn.lock")) ? "yarn" : "npm";
3438
3931
  }
3439
3932
  } catch {
3440
3933
  }
3441
3934
  }
3442
3935
  }
3443
3936
  if (result.type !== "none" && cwd !== gitRoot) {
3444
- const cwdPkgPath = path4.join(cwd, "package.json");
3445
- if (fs4.existsSync(cwdPkgPath)) {
3937
+ const cwdPkgPath = path5.join(cwd, "package.json");
3938
+ if (fs5.existsSync(cwdPkgPath)) {
3446
3939
  result.isSubPackage = true;
3447
3940
  try {
3448
- const pkg = JSON.parse(fs4.readFileSync(cwdPkgPath, "utf-8"));
3941
+ const pkg = JSON.parse(fs5.readFileSync(cwdPkgPath, "utf-8"));
3449
3942
  result.subPackageName = pkg.name;
3450
3943
  } catch {
3451
3944
  }
@@ -3457,7 +3950,7 @@ var DOCS_MANIFEST_FILE = ".connectbase-manifest.json";
3457
3950
  function readDocsManifest(docsDir) {
3458
3951
  try {
3459
3952
  const parsed = JSON.parse(
3460
- fs4.readFileSync(path4.join(docsDir, DOCS_MANIFEST_FILE), "utf-8")
3953
+ fs5.readFileSync(path5.join(docsDir, DOCS_MANIFEST_FILE), "utf-8")
3461
3954
  );
3462
3955
  if (parsed && Array.isArray(parsed.files)) return parsed;
3463
3956
  } catch {
@@ -3519,14 +4012,14 @@ async function downloadDocs(baseDir, opts = {}) {
3519
4012
  info(`\uBAA8\uB178\uB808\uD3EC \uAC10\uC9C0: ${monorepo.type} (\uB8E8\uD2B8: ${gitRoot})`);
3520
4013
  if (monorepo.isSubPackage) {
3521
4014
  info(
3522
- `\uD604\uC7AC \uC11C\uBE0C \uD328\uD0A4\uC9C0: ${monorepo.subPackageName || path4.basename(process.cwd())}`
4015
+ `\uD604\uC7AC \uC11C\uBE0C \uD328\uD0A4\uC9C0: ${monorepo.subPackageName || path5.basename(process.cwd())}`
3523
4016
  );
3524
4017
  }
3525
4018
  }
3526
- const docsDir = path4.join(gitRoot, ".claude", "docs");
3527
- const rootClaudeMd = path4.join(gitRoot, "CLAUDE.md");
3528
- if (!fs4.existsSync(docsDir)) {
3529
- fs4.mkdirSync(docsDir, { recursive: true });
4019
+ const docsDir = path5.join(gitRoot, ".claude", "docs");
4020
+ const rootClaudeMd = path5.join(gitRoot, "CLAUDE.md");
4021
+ if (!fs5.existsSync(docsDir)) {
4022
+ fs5.mkdirSync(docsDir, { recursive: true });
3530
4023
  }
3531
4024
  if (!quiet) info("SDK \uAC1C\uBC1C \uAC00\uC774\uB4DC \uB2E4\uC6B4\uB85C\uB4DC \uC911...");
3532
4025
  try {
@@ -3543,21 +4036,21 @@ async function downloadDocs(baseDir, opts = {}) {
3543
4036
  const hasher = crypto.createHash("sha256");
3544
4037
  const newFiles = [];
3545
4038
  for (const section of sections) {
3546
- const safeName = path4.basename(section.filename);
4039
+ const safeName = path5.basename(section.filename);
3547
4040
  newFiles.push(safeName);
3548
4041
  hasher.update(safeName).update("\0").update(section.content).update("\0");
3549
4042
  }
3550
4043
  const contentHash = hasher.digest("hex");
3551
4044
  const prevManifest = readDocsManifest(docsDir);
3552
4045
  const allPresent = newFiles.every(
3553
- (f) => fs4.existsSync(path4.join(docsDir, f))
4046
+ (f) => fs5.existsSync(path5.join(docsDir, f))
3554
4047
  );
3555
4048
  if (prevManifest && prevManifest.contentHash === contentHash && allPresent) {
3556
4049
  if (!quiet) success("SDK \uBB38\uC11C\uAC00 \uC774\uBBF8 \uCD5C\uC2E0\uC785\uB2C8\uB2E4");
3557
4050
  updateRootClaudeMd(rootClaudeMd, quiet);
3558
4051
  if (monorepo.isSubPackage) {
3559
4052
  createSubPackageClaudeMd(
3560
- path4.join(process.cwd(), "CLAUDE.md"),
4053
+ path5.join(process.cwd(), "CLAUDE.md"),
3561
4054
  gitRoot,
3562
4055
  quiet
3563
4056
  );
@@ -3568,16 +4061,16 @@ async function downloadDocs(baseDir, opts = {}) {
3568
4061
 
3569
4062
  `;
3570
4063
  for (const section of sections) {
3571
- const safeName = path4.basename(section.filename);
3572
- fs4.writeFileSync(path4.join(docsDir, safeName), stamp + section.content);
4064
+ const safeName = path5.basename(section.filename);
4065
+ fs5.writeFileSync(path5.join(docsDir, safeName), stamp + section.content);
3573
4066
  }
3574
- const staleCandidates = prevManifest ? prevManifest.files.map((f) => path4.basename(f)) : LEGACY_DOC_FILES;
4067
+ const staleCandidates = prevManifest ? prevManifest.files.map((f) => path5.basename(f)) : LEGACY_DOC_FILES;
3575
4068
  for (const old of staleCandidates) {
3576
4069
  if (newFiles.includes(old)) continue;
3577
- const oldPath = path4.join(docsDir, old);
3578
- if (fs4.existsSync(oldPath)) {
4070
+ const oldPath = path5.join(docsDir, old);
4071
+ if (fs5.existsSync(oldPath)) {
3579
4072
  try {
3580
- fs4.unlinkSync(oldPath);
4073
+ fs5.unlinkSync(oldPath);
3581
4074
  if (!quiet) info(`\uC2A4\uD14C\uC77C \uBB38\uC11C \uC0AD\uC81C: ${old}`);
3582
4075
  } catch {
3583
4076
  }
@@ -3589,8 +4082,8 @@ async function downloadDocs(baseDir, opts = {}) {
3589
4082
  contentHash,
3590
4083
  files: newFiles
3591
4084
  };
3592
- fs4.writeFileSync(
3593
- path4.join(docsDir, DOCS_MANIFEST_FILE),
4085
+ fs5.writeFileSync(
4086
+ path5.join(docsDir, DOCS_MANIFEST_FILE),
3594
4087
  `${JSON.stringify(manifest, null, 2)}
3595
4088
  `
3596
4089
  );
@@ -3601,7 +4094,7 @@ async function downloadDocs(baseDir, opts = {}) {
3601
4094
  updateRootClaudeMd(rootClaudeMd, quiet);
3602
4095
  if (monorepo.isSubPackage) {
3603
4096
  createSubPackageClaudeMd(
3604
- path4.join(process.cwd(), "CLAUDE.md"),
4097
+ path5.join(process.cwd(), "CLAUDE.md"),
3605
4098
  gitRoot,
3606
4099
  quiet
3607
4100
  );
@@ -3620,10 +4113,10 @@ async function downloadDocs(baseDir, opts = {}) {
3620
4113
 
3621
4114
  \uC0C1\uC138 \uAD6C\uD604\uBC95\uC740 MCP \`search_sdk_docs\` \uB3C4\uAD6C\uB85C \uAC80\uC0C9\uD558\uC138\uC694.
3622
4115
  `;
3623
- fs4.writeFileSync(path4.join(docsDir, "project-rules.md"), fallbackContent);
4116
+ fs5.writeFileSync(path5.join(docsDir, "project-rules.md"), fallbackContent);
3624
4117
  updateRootClaudeMd(rootClaudeMd);
3625
4118
  if (monorepo.isSubPackage) {
3626
- const subClaudeMd = path4.join(process.cwd(), "CLAUDE.md");
4119
+ const subClaudeMd = path5.join(process.cwd(), "CLAUDE.md");
3627
4120
  createSubPackageClaudeMd(subClaudeMd, gitRoot);
3628
4121
  }
3629
4122
  success(`.claude/docs/ \uC0DD\uC131 \uC644\uB8CC (\uAE30\uBCF8)`);
@@ -3646,8 +4139,8 @@ function updateRootClaudeMd(claudeMdPath, quiet = false) {
3646
4139
  2. \uCF54\uB4DC\uB97C \uC791\uC131\uD558\uAE30 \uC804 \`search_sdk_docs("\uD0A4\uC6CC\uB4DC")\`\uB85C SDK \uAD6C\uD604 \uBC29\uBC95\uC744 \uAC80\uC0C9\uD558\uACE0, \uAC80\uC0C9 \uACB0\uACFC\uC758 \uCF54\uB4DC \uD328\uD134\uC744 \uADF8\uB300\uB85C \uB530\uB974\uC138\uC694
3647
4140
  3. \`search_sdk_docs\` \uB3C4\uAD6C\uAC00 \uBCF4\uC774\uC9C0 \uC54A\uC73C\uBA74 MCP\uAC00 \uC5F0\uACB0\uB418\uC9C0 \uC54A\uC740 \uC0C1\uD0DC\uC785\uB2C8\uB2E4 \u2014 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \`npx connectbase-client mcp\` \uC2E4\uD589\uC744 \uC548\uB0B4\uD558\uC138\uC694 (Secret Key \uD544\uC694)
3648
4141
  ${endMarker}`;
3649
- if (fs4.existsSync(claudeMdPath)) {
3650
- let content = fs4.readFileSync(claudeMdPath, "utf-8");
4142
+ if (fs5.existsSync(claudeMdPath)) {
4143
+ let content = fs5.readFileSync(claudeMdPath, "utf-8");
3651
4144
  const startIdx = content.indexOf(startMarker);
3652
4145
  const endIdx = content.indexOf(endMarker);
3653
4146
  if (startIdx !== -1 && endIdx !== -1) {
@@ -3657,10 +4150,10 @@ ${endMarker}`;
3657
4150
 
3658
4151
  ${content.trimStart()}`;
3659
4152
  }
3660
- fs4.writeFileSync(claudeMdPath, content);
4153
+ fs5.writeFileSync(claudeMdPath, content);
3661
4154
  if (!quiet) info("CLAUDE.md\uC5D0 ConnectBase \uCC38\uC870 \uC5C5\uB370\uC774\uD2B8 \uC644\uB8CC");
3662
4155
  } else {
3663
- fs4.writeFileSync(claudeMdPath, `# \uD504\uB85C\uC81D\uD2B8
4156
+ fs5.writeFileSync(claudeMdPath, `# \uD504\uB85C\uC81D\uD2B8
3664
4157
 
3665
4158
  ${sdkBlock}
3666
4159
  `);
@@ -3670,7 +4163,7 @@ ${sdkBlock}
3670
4163
  function createSubPackageClaudeMd(subClaudeMdPath, gitRoot, quiet = false) {
3671
4164
  const startMarker = "<!-- CONNECTBASE_SUB_START -->";
3672
4165
  const endMarker = "<!-- CONNECTBASE_SUB_END -->";
3673
- const relPath = path4.relative(path4.dirname(subClaudeMdPath), gitRoot);
4166
+ const relPath = path5.relative(path5.dirname(subClaudeMdPath), gitRoot);
3674
4167
  const subBlock = `${startMarker}
3675
4168
  ## ConnectBase SDK
3676
4169
 
@@ -3682,8 +4175,8 @@ function createSubPackageClaudeMd(subClaudeMdPath, gitRoot, quiet = false) {
3682
4175
  2. \uCF54\uB4DC\uB97C \uC791\uC131\uD558\uAE30 \uC804 \`search_sdk_docs("\uD0A4\uC6CC\uB4DC")\`\uB85C SDK \uAD6C\uD604 \uBC29\uBC95\uC744 \uAC80\uC0C9\uD558\uC138\uC694
3683
4176
  3. \`search_sdk_docs\` \uB3C4\uAD6C\uAC00 \uBCF4\uC774\uC9C0 \uC54A\uC73C\uBA74 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \`npx connectbase-client mcp\` \uC2E4\uD589\uC744 \uC548\uB0B4\uD558\uC138\uC694
3684
4177
  ${endMarker}`;
3685
- if (fs4.existsSync(subClaudeMdPath)) {
3686
- let content = fs4.readFileSync(subClaudeMdPath, "utf-8");
4178
+ if (fs5.existsSync(subClaudeMdPath)) {
4179
+ let content = fs5.readFileSync(subClaudeMdPath, "utf-8");
3687
4180
  const startIdx = content.indexOf(startMarker);
3688
4181
  const endIdx = content.indexOf(endMarker);
3689
4182
  if (startIdx !== -1 && endIdx !== -1) {
@@ -3696,11 +4189,11 @@ ${subBlock}
3696
4189
  } else {
3697
4190
  return;
3698
4191
  }
3699
- fs4.writeFileSync(subClaudeMdPath, content);
4192
+ fs5.writeFileSync(subClaudeMdPath, content);
3700
4193
  } else {
3701
- fs4.writeFileSync(
4194
+ fs5.writeFileSync(
3702
4195
  subClaudeMdPath,
3703
- `# ${path4.basename(path4.dirname(subClaudeMdPath))}
4196
+ `# ${path5.basename(path5.dirname(subClaudeMdPath))}
3704
4197
 
3705
4198
  ${subBlock}
3706
4199
  `
@@ -3718,7 +4211,7 @@ async function setupMcp(secretKey, baseUrl = DEFAULT_BASE_URL) {
3718
4211
  info(`MCP \uC124\uC815\uC740 \uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8(${root})\uC5D0 \uC0DD\uC131\uB429\uB2C8\uB2E4`);
3719
4212
  }
3720
4213
  }
3721
- const mcpConfigPath = path4.join(root, ".mcp.json");
4214
+ const mcpConfigPath = path5.join(root, ".mcp.json");
3722
4215
  if (secretKey) {
3723
4216
  const check = await fetchAppsWithSecretKey(baseUrl, secretKey).catch(
3724
4217
  () => null
@@ -3753,17 +4246,17 @@ async function setupMcp(secretKey, baseUrl = DEFAULT_BASE_URL) {
3753
4246
  }
3754
4247
  };
3755
4248
  let mcpConfig = { mcpServers: {} };
3756
- if (fs4.existsSync(mcpConfigPath)) {
4249
+ if (fs5.existsSync(mcpConfigPath)) {
3757
4250
  try {
3758
- mcpConfig = JSON.parse(fs4.readFileSync(mcpConfigPath, "utf-8"));
4251
+ mcpConfig = JSON.parse(fs5.readFileSync(mcpConfigPath, "utf-8"));
3759
4252
  if (!mcpConfig.mcpServers || typeof mcpConfig.mcpServers !== "object") {
3760
4253
  mcpConfig.mcpServers = {};
3761
4254
  }
3762
4255
  } catch {
3763
4256
  const backupPath = `${mcpConfigPath}.backup`;
3764
- fs4.copyFileSync(mcpConfigPath, backupPath);
4257
+ fs5.copyFileSync(mcpConfigPath, backupPath);
3765
4258
  try {
3766
- fs4.chmodSync(backupPath, 384);
4259
+ fs5.chmodSync(backupPath, 384);
3767
4260
  } catch {
3768
4261
  }
3769
4262
  warn(`.mcp.json \uD30C\uC2F1 \uC2E4\uD328, \uBC31\uC5C5 \uC0DD\uC131: ${backupPath}`);
@@ -3824,14 +4317,14 @@ function findSubPackagesWithConfig(gitRoot) {
3824
4317
  const results = [];
3825
4318
  const candidates = ["apps", "packages", "projects", "services", "libs"];
3826
4319
  for (const candidate of candidates) {
3827
- const dir = path4.join(gitRoot, candidate);
3828
- if (!fs4.existsSync(dir)) continue;
4320
+ const dir = path5.join(gitRoot, candidate);
4321
+ if (!fs5.existsSync(dir)) continue;
3829
4322
  try {
3830
- const entries = fs4.readdirSync(dir, { withFileTypes: true });
4323
+ const entries = fs5.readdirSync(dir, { withFileTypes: true });
3831
4324
  for (const entry of entries) {
3832
4325
  if (!entry.isDirectory() || entry.name.startsWith(".")) continue;
3833
- const subDir = path4.join(dir, entry.name);
3834
- if (fs4.existsSync(path4.join(subDir, ".connectbaserc"))) {
4326
+ const subDir = path5.join(dir, entry.name);
4327
+ if (fs5.existsSync(path5.join(subDir, ".connectbaserc"))) {
3835
4328
  results.push(subDir);
3836
4329
  }
3837
4330
  }
@@ -3839,13 +4332,13 @@ function findSubPackagesWithConfig(gitRoot) {
3839
4332
  }
3840
4333
  }
3841
4334
  try {
3842
- const entries = fs4.readdirSync(gitRoot, { withFileTypes: true });
4335
+ const entries = fs5.readdirSync(gitRoot, { withFileTypes: true });
3843
4336
  for (const entry of entries) {
3844
4337
  if (!entry.isDirectory() || entry.name.startsWith(".") || candidates.includes(entry.name))
3845
4338
  continue;
3846
4339
  if (entry.name === "node_modules") continue;
3847
- const subDir = path4.join(gitRoot, entry.name);
3848
- if (fs4.existsSync(path4.join(subDir, ".connectbaserc")) && !results.includes(subDir)) {
4340
+ const subDir = path5.join(gitRoot, entry.name);
4341
+ if (fs5.existsSync(path5.join(subDir, ".connectbaserc")) && !results.includes(subDir)) {
3849
4342
  results.push(subDir);
3850
4343
  }
3851
4344
  }
@@ -3889,7 +4382,7 @@ ${colors.cyan}ConnectBase Update${colors.reset}
3889
4382
  info(`ConnectBase\uB97C \uC0AC\uC6A9\uD558\uB294 \uC11C\uBE0C \uD328\uD0A4\uC9C0 ${subPackages.length}\uAC1C \uBC1C\uACAC:`);
3890
4383
  for (const sp of subPackages) {
3891
4384
  log(
3892
- ` ${colors.dim}\u2022 ${path4.relative(projectRoot, sp)}${colors.reset}`
4385
+ ` ${colors.dim}\u2022 ${path5.relative(projectRoot, sp)}${colors.reset}`
3893
4386
  );
3894
4387
  }
3895
4388
  }
@@ -3901,14 +4394,14 @@ ${colors.cyan}ConnectBase Update${colors.reset}
3901
4394
  }
3902
4395
  if (!opts.skipMcp) {
3903
4396
  log("");
3904
- const mcpConfigPath = path4.join(projectRoot, ".mcp.json");
3905
- if (fs4.existsSync(mcpConfigPath)) {
4397
+ const mcpConfigPath = path5.join(projectRoot, ".mcp.json");
4398
+ if (fs5.existsSync(mcpConfigPath)) {
3906
4399
  let secretKey = config.secretKey;
3907
4400
  if (!secretKey) {
3908
- const rootRcPath = path4.join(projectRoot, ".connectbaserc");
3909
- if (fs4.existsSync(rootRcPath)) {
4401
+ const rootRcPath = path5.join(projectRoot, ".connectbaserc");
4402
+ if (fs5.existsSync(rootRcPath)) {
3910
4403
  try {
3911
- const rc = JSON.parse(fs4.readFileSync(rootRcPath, "utf-8"));
4404
+ const rc = JSON.parse(fs5.readFileSync(rootRcPath, "utf-8"));
3912
4405
  secretKey = rc.secretKey;
3913
4406
  } catch {
3914
4407
  }
@@ -3919,7 +4412,7 @@ ${colors.cyan}ConnectBase Update${colors.reset}
3919
4412
  for (const sp of subPackages) {
3920
4413
  try {
3921
4414
  const rc = JSON.parse(
3922
- fs4.readFileSync(path4.join(sp, ".connectbaserc"), "utf-8")
4415
+ fs5.readFileSync(path5.join(sp, ".connectbaserc"), "utf-8")
3923
4416
  );
3924
4417
  if (rc.secretKey) {
3925
4418
  secretKey = rc.secretKey;
@@ -3931,7 +4424,7 @@ ${colors.cyan}ConnectBase Update${colors.reset}
3931
4424
  }
3932
4425
  if (secretKey) {
3933
4426
  try {
3934
- const mcpConfig = JSON.parse(fs4.readFileSync(mcpConfigPath, "utf-8"));
4427
+ const mcpConfig = JSON.parse(fs5.readFileSync(mcpConfigPath, "utf-8"));
3935
4428
  const servers = mcpConfig.mcpServers || {};
3936
4429
  if (servers["connect-base"]) {
3937
4430
  servers["connect-base"] = {
@@ -3970,15 +4463,15 @@ ${colors.green}\uC5C5\uB370\uC774\uD2B8 \uC644\uB8CC!${colors.reset}
3970
4463
  `);
3971
4464
  }
3972
4465
  function setupMonorepoRoot(projectRoot, monorepo) {
3973
- const rootPkgPath = path4.join(projectRoot, "package.json");
3974
- if (!fs4.existsSync(rootPkgPath)) {
4466
+ const rootPkgPath = path5.join(projectRoot, "package.json");
4467
+ if (!fs5.existsSync(rootPkgPath)) {
3975
4468
  warn(
3976
4469
  "\uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8\uC5D0 package.json\uC774 \uC5C6\uC5B4 \uD3B8\uC758 \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uCD94\uAC00\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4"
3977
4470
  );
3978
4471
  return;
3979
4472
  }
3980
4473
  try {
3981
- const pkg = JSON.parse(fs4.readFileSync(rootPkgPath, "utf-8"));
4474
+ const pkg = JSON.parse(fs5.readFileSync(rootPkgPath, "utf-8"));
3982
4475
  if (!pkg.scripts) pkg.scripts = {};
3983
4476
  let changed = false;
3984
4477
  if (!pkg.scripts["cb:update"]) {
@@ -3994,7 +4487,7 @@ function setupMonorepoRoot(projectRoot, monorepo) {
3994
4487
  changed = true;
3995
4488
  }
3996
4489
  if (changed) {
3997
- fs4.writeFileSync(rootPkgPath, `${JSON.stringify(pkg, null, 2)}
4490
+ fs5.writeFileSync(rootPkgPath, `${JSON.stringify(pkg, null, 2)}
3998
4491
  `);
3999
4492
  success("\uBAA8\uB178\uB808\uD3EC \uB8E8\uD2B8\uC5D0 \uD3B8\uC758 \uC2A4\uD06C\uB9BD\uD2B8 \uCD94\uAC00 \uC644\uB8CC");
4000
4493
  log(` ${colors.dim}\uC0AC\uC6A9\uBC95:${colors.reset}`);
@@ -4399,7 +4892,7 @@ ${colors.blue}?${colors.reset} \uC571 \uC120\uD0DD (\uBC88\uD638): `
4399
4892
  success(`\uC120\uD0DD\uB428: ${apps[num2 - 1].name}`);
4400
4893
  return { appId: apps[num2 - 1].id };
4401
4894
  }
4402
- const projectName = path4.basename(process.cwd());
4895
+ const projectName = path5.basename(process.cwd());
4403
4896
  const appName = await prompt(
4404
4897
  `${colors.blue}?${colors.reset} \uC571 \uC774\uB984 (${projectName}): `
4405
4898
  ) || projectName;
@@ -4482,11 +4975,11 @@ async function startTunnel(port, config, tunnelOpts) {
4482
4975
  info("Secret Key\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. \uBE0C\uB77C\uC6B0\uC800 \uB85C\uADF8\uC778\uC73C\uB85C \uBC1C\uAE09\uD569\uB2C8\uB2E4...");
4483
4976
  try {
4484
4977
  const sk = await browserAuthFlow();
4485
- const rcPath2 = path4.join(process.cwd(), ".connectbaserc");
4978
+ const rcPath2 = path5.join(process.cwd(), ".connectbaserc");
4486
4979
  let rcData = {};
4487
- if (fs4.existsSync(rcPath2)) {
4980
+ if (fs5.existsSync(rcPath2)) {
4488
4981
  try {
4489
- rcData = JSON.parse(fs4.readFileSync(rcPath2, "utf-8"));
4982
+ rcData = JSON.parse(fs5.readFileSync(rcPath2, "utf-8"));
4490
4983
  } catch {
4491
4984
  }
4492
4985
  }
@@ -4505,11 +4998,11 @@ async function startTunnel(port, config, tunnelOpts) {
4505
4998
  } else {
4506
4999
  config.secretKey = tunnelKey;
4507
5000
  }
4508
- const rcPath = path4.join(process.cwd(), ".connectbaserc");
5001
+ const rcPath = path5.join(process.cwd(), ".connectbaserc");
4509
5002
  let savedAppId = tunnelOpts?.appId || "";
4510
5003
  if (!savedAppId) {
4511
5004
  try {
4512
- const rc = JSON.parse(fs4.readFileSync(rcPath, "utf-8"));
5005
+ const rc = JSON.parse(fs5.readFileSync(rcPath, "utf-8"));
4513
5006
  if (rc.tunnelAppId) savedAppId = rc.tunnelAppId;
4514
5007
  } catch {
4515
5008
  }
@@ -4517,9 +5010,9 @@ async function startTunnel(port, config, tunnelOpts) {
4517
5010
  const { appId } = await resolveApp(tunnelKey, config.baseUrl, savedAppId);
4518
5011
  try {
4519
5012
  let rcData = {};
4520
- if (fs4.existsSync(rcPath)) {
5013
+ if (fs5.existsSync(rcPath)) {
4521
5014
  try {
4522
- rcData = JSON.parse(fs4.readFileSync(rcPath, "utf-8"));
5015
+ rcData = JSON.parse(fs5.readFileSync(rcPath, "utf-8"));
4523
5016
  } catch {
4524
5017
  }
4525
5018
  }
@@ -5278,6 +5771,8 @@ ${colors.yellow}\uBA85\uB839\uC5B4:${colors.reset}
5278
5771
  tunnel <port> \uB85C\uCEEC \uC11C\uBE44\uC2A4\uB97C \uC778\uD130\uB137\uC5D0 \uB178\uCD9C
5279
5772
  local \uC124\uCE58\uAC00 \uD544\uC694\uD55C \uC2A4\uD0AC\uC744 \uB0B4 PC \uC5D0\uC11C \uC4F0\uAC8C \uC5F0\uACB0 (\uB85C\uCEEC \uC2E4\uD589\uAE30: Blender, ZBrush, Python \u2026)
5280
5773
  --add <GitHub owner/repo[/\uD3F4\uB354][@ref] | \uC8FC\uC18C | \uD3F4\uB354> \uC2A4\uD0AC \uC124\uCE58 (\uC5EC\uB7EC \uBC88 \uAC00\uB2A5)
5774
+ --mcp <\uC774\uB984>="<\uBA85\uB839>" | <\uC774\uB984>=<http \uC8FC\uC18C> \uC2A4\uD0AC\uC774 \uC4F0\uB294 PC \uC758 MCP \uC11C\uBC84 \uCD94\uAC00 (\uC5EC\uB7EC \uBC88 \uAC00\uB2A5,
5775
+ \uC791\uC5C5 \uD3F4\uB354\uC758 connectbase-local.json mcpServers \uC5D0 \uC800\uC7A5. Claude Desktop \uACFC \uAC19\uC740 \uD615\uC2DD)
5281
5776
  --update \uC124\uCE58\uB41C \uC2A4\uD0AC \uB2E4\uC2DC \uBC1B\uAE30 --dir <\uD3F4\uB354> \uC791\uC5C5 \uD3F4\uB354 (\uAE30\uBCF8 ~/ConnectBaseLocal)
5282
5777
  \uC608: npx connectbase-client local --add yorusd1/yoruskills
5283
5778
 
@@ -5421,8 +5916,8 @@ async function enforceBaseUrlPolicy(baseUrl, opts) {
5421
5916
  process.exit(1);
5422
5917
  }
5423
5918
  function isOutsideProject(dir, root) {
5424
- const relative3 = path4.relative(path4.resolve(root), path4.resolve(root, dir));
5425
- return relative3 === ".." || relative3.startsWith(`..${path4.sep}`) || path4.isAbsolute(relative3);
5919
+ const relative3 = path5.relative(path5.resolve(root), path5.resolve(root, dir));
5920
+ return relative3 === ".." || relative3.startsWith(`..${path5.sep}`) || path5.isAbsolute(relative3);
5426
5921
  }
5427
5922
  function parseArgs(args) {
5428
5923
  const result = {
@@ -5462,6 +5957,8 @@ function parseArgs(args) {
5462
5957
  result.options.add = result.options.add ? `${result.options.add},${args[++i]}` : args[++i];
5463
5958
  } else if (arg === "--update") {
5464
5959
  result.options.update = "true";
5960
+ } else if (arg === "--mcp") {
5961
+ result.options.mcp = result.options.mcp ? `${result.options.mcp}\0${args[++i]}` : args[++i];
5465
5962
  } else if (arg === "--force") {
5466
5963
  result.options.force = "true";
5467
5964
  } else if (arg === "-y" || arg === "--yes") {
@@ -5576,8 +6073,8 @@ async function main() {
5576
6073
  if (parsed.options.skipDocs !== "true") {
5577
6074
  try {
5578
6075
  const docsRoot = getGitRoot() || getProjectRoot();
5579
- if (fs4.existsSync(
5580
- path4.join(docsRoot, ".claude", "docs", DOCS_MANIFEST_FILE)
6076
+ if (fs5.existsSync(
6077
+ path5.join(docsRoot, ".claude", "docs", DOCS_MANIFEST_FILE)
5581
6078
  )) {
5582
6079
  const refreshed = await downloadDocs(docsRoot, {
5583
6080
  quiet: true,
@@ -5622,7 +6119,8 @@ async function main() {
5622
6119
  appId: parsed.options.appId,
5623
6120
  force: parsed.options.force === "true",
5624
6121
  add: parsed.options.add,
5625
- update: parsed.options.update === "true"
6122
+ update: parsed.options.update === "true",
6123
+ mcp: parsed.options.mcp
5626
6124
  },
5627
6125
  (p, c, o) => startTunnel(p, c, o),
5628
6126
  { info, success, warn }