apiblaze 0.20.17 → 0.20.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +37 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1024,7 +1024,7 @@ var import_commander = require("commander");
1024
1024
  var import_chalk53 = __toESM(require("chalk"));
1025
1025
 
1026
1026
  // package.json
1027
- var version = "0.20.17";
1027
+ var version = "0.20.18";
1028
1028
 
1029
1029
  // src/index.ts
1030
1030
  init_types();
@@ -2390,6 +2390,24 @@ function installIntoClaude(spec2) {
2390
2390
  if (r.status === 0) return { ok: true };
2391
2391
  return { ok: false, error: (r.stderr || r.stdout || `exit ${r.status}`).trim().slice(0, 400) };
2392
2392
  }
2393
+ function claudeServerStatus(name) {
2394
+ const r = run("claude", ["mcp", "get", name]);
2395
+ const out = `${r.stdout || ""}${r.stderr || ""}`;
2396
+ const line = out.split("\n").find((l) => l.includes("Status:")) ?? "";
2397
+ if (/connected/i.test(line)) return "connected";
2398
+ if (/needs auth/i.test(line)) return "needs-auth";
2399
+ if (/failed|error|unreachable/i.test(line)) return "failed";
2400
+ return "unknown";
2401
+ }
2402
+ function waitForClaudeConnection(name, timeoutMs = 12e3) {
2403
+ const deadline = Date.now() + timeoutMs;
2404
+ let last = "unknown";
2405
+ for (; ; ) {
2406
+ last = claudeServerStatus(name);
2407
+ if (last === "connected" || Date.now() >= deadline) return last;
2408
+ (0, import_child_process.spawnSync)(process.execPath, ["-e", "setTimeout(()=>{},1200)"], { timeout: 3e3 });
2409
+ }
2410
+ }
2393
2411
  function claudeOneShot(spec2, prompt) {
2394
2412
  const argv = ["claude", "-p", prompt, "--allowedTools", `mcp__${spec2.name}__*`];
2395
2413
  const r = run(argv[0], argv.slice(1), { inherit: true });
@@ -2508,10 +2526,25 @@ async function installAndDemo(cli, spec2, getQuestion, log = console.log) {
2508
2526
  log(` ${import_chalk12.default.dim("$")} ${renderCommand(loginArgv)}`);
2509
2527
  const r = run(loginArgv[0], loginArgv.slice(1), { interactive: true });
2510
2528
  if (r.status !== 0) {
2511
- log(import_chalk12.default.yellow(` Sign-in didn't complete (exit ${r.status ?? "?"}). Run \`${renderCommand(loginArgv)}\` yourself, then chat away.`));
2512
- return true;
2529
+ log(import_chalk12.default.yellow(` Sign-in didn't complete (exit ${r.status ?? "?"}). Run \`${renderCommand(loginArgv)}\` yourself to finish it.`));
2530
+ } else {
2531
+ log(` ${import_chalk12.default.green("\u2714")} Signed in.`);
2532
+ }
2533
+ }
2534
+ if (cli.kind === "claude") {
2535
+ const status = waitForClaudeConnection(spec2.name);
2536
+ if (status !== "connected") {
2537
+ log(import_chalk12.default.yellow(`
2538
+ ${cli.label} has the MCP configured, but reports: ${status === "needs-auth" ? "needs authentication" : status === "failed" ? "failed to connect" : "unknown status"}.`));
2539
+ if (status === "needs-auth") {
2540
+ log(import_chalk12.default.dim(` Finish the sign-in with: claude mcp login ${spec2.name}`));
2541
+ } else {
2542
+ log(import_chalk12.default.dim(` Check it with: claude mcp get ${spec2.name} (or /mcp inside Claude Code)`));
2543
+ }
2544
+ log(import_chalk12.default.dim(" Chatting here instead so you still get an answer."));
2545
+ return false;
2513
2546
  }
2514
- log(` ${import_chalk12.default.green("\u2714")} Signed in.`);
2547
+ log(` ${import_chalk12.default.green("\u2714")} ${cli.label} reports the server connected.`);
2515
2548
  }
2516
2549
  const oneShot = cli.kind === "claude" ? claudeOneShot : codexOneShot;
2517
2550
  const abilities = `What are the tool abilities of the MCP server "${spec2.name}"? List them briefly.`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apiblaze",
3
- "version": "0.20.17",
3
+ "version": "0.20.18",
4
4
  "description": "APIblaze CLI — Chat with your APIs, Manage your API keys, users and groups with the APIblaze serverless proxy",
5
5
  "keywords": [
6
6
  "apiblaze",