@leadbay/mcp 0.23.3 → 0.23.5

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/bin.js CHANGED
@@ -26059,7 +26059,7 @@ ${url}
26059
26059
 
26060
26060
  // installer/install-shared.ts
26061
26061
  import { spawn } from "child_process";
26062
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
26062
+ import { existsSync as existsSync2, readFileSync as readFileSync2, readdirSync as readdirSync2 } from "fs";
26063
26063
  import { join as join3 } from "path";
26064
26064
  import { homedir as homedir3 } from "os";
26065
26065
  var HOSTED_MCP_URL = "https://leadbay-mcp-prod.fly.dev/mcp";
@@ -26116,6 +26116,15 @@ async function windowsStoreAppInstalled(packageName, appName) {
26116
26116
  child.on("error", () => resolve(false));
26117
26117
  });
26118
26118
  }
26119
+ function isClaudeStorePackagePresent(localAppData) {
26120
+ const packagesDir = join3(localAppData, "Packages");
26121
+ if (!existsSync2(packagesDir)) return false;
26122
+ try {
26123
+ return readdirSync2(packagesDir).some((name) => /^Claude_/i.test(name));
26124
+ } catch {
26125
+ return false;
26126
+ }
26127
+ }
26119
26128
  async function isClaudeDesktopInstalled(home) {
26120
26129
  if (process.platform === "darwin") {
26121
26130
  return existsSync2("/Applications/Claude.app") || existsSync2(home + "/Applications/Claude.app");
@@ -26124,12 +26133,15 @@ async function isClaudeDesktopInstalled(home) {
26124
26133
  const local = process.env.LOCALAPPDATA ?? home + "/AppData/Local";
26125
26134
  const programFiles = process.env.ProgramFiles;
26126
26135
  const programFilesX86 = process.env["ProgramFiles(x86)"];
26127
- return [
26136
+ const exeInstalled = [
26128
26137
  local + "/Programs/Claude/Claude.exe",
26129
26138
  local + "/Claude/Claude.exe",
26130
26139
  programFiles ? programFiles + "/Claude/Claude.exe" : null,
26131
26140
  programFilesX86 ? programFilesX86 + "/Claude/Claude.exe" : null
26132
26141
  ].some((candidate) => candidate !== null && existsSync2(candidate));
26142
+ if (exeInstalled) return true;
26143
+ if (isClaudeStorePackagePresent(local)) return true;
26144
+ return await windowsStoreAppInstalled("AnthropicPBC.Claude", "Claude");
26133
26145
  }
26134
26146
  const desktopBin = await findOnPath("claude-desktop");
26135
26147
  if (desktopBin) return true;
@@ -26936,7 +26948,7 @@ import { createHash as createHash5, randomBytes } from "crypto";
26936
26948
  import { createServer } from "http";
26937
26949
  import { request as httpsRequestRaw } from "https";
26938
26950
  import { spawn as spawn3 } from "child_process";
26939
- import { readdirSync as readdirSync2, existsSync as existsSync3 } from "fs";
26951
+ import { readdirSync as readdirSync3, existsSync as existsSync3 } from "fs";
26940
26952
  var LEADBAY_LOOPBACK_PORTS = [51789, 51790, 51791, 51792];
26941
26953
  var BrowserOpenFailedError = class extends Error {
26942
26954
  authorizeUrl;
@@ -27242,9 +27254,10 @@ function browserOpenCandidates(url) {
27242
27254
  if (platform2 === "win32") {
27243
27255
  const sysRoot = process.env.SystemRoot || process.env.windir || "C:\\Windows";
27244
27256
  const cmdExe = `${sysRoot}\\System32\\cmd.exe`;
27257
+ const quoted = `"${url}"`;
27245
27258
  return [
27246
- { cmd: cmdExe, args: ["/c", "start", '""', url] },
27247
- { cmd: "cmd", args: ["/c", "start", '""', url] }
27259
+ { cmd: cmdExe, args: ["/c", "start", '""', quoted] },
27260
+ { cmd: "cmd", args: ["/c", "start", '""', quoted] }
27248
27261
  ];
27249
27262
  }
27250
27263
  return [
@@ -27271,7 +27284,7 @@ function browserLaunchEnv(debug) {
27271
27284
  }
27272
27285
  if (!env.WAYLAND_DISPLAY && runtimeDir) {
27273
27286
  try {
27274
- const sock = readdirSync2(runtimeDir).find((f) => /^wayland-\d+$/.test(f));
27287
+ const sock = readdirSync3(runtimeDir).find((f) => /^wayland-\d+$/.test(f));
27275
27288
  if (sock) {
27276
27289
  env.WAYLAND_DISPLAY = sock;
27277
27290
  debug?.(`browserLaunchEnv: injected WAYLAND_DISPLAY=${sock}`);
@@ -27288,7 +27301,7 @@ function browserLaunchEnv(debug) {
27288
27301
  }
27289
27302
  if (!env.DISPLAY) {
27290
27303
  try {
27291
- const x = readdirSync2("/tmp/.X11-unix").map((f) => f.match(/^X(\d+)$/)?.[1]).filter((n) => !!n).sort((a, b) => Number(a) - Number(b))[0];
27304
+ const x = readdirSync3("/tmp/.X11-unix").map((f) => f.match(/^X(\d+)$/)?.[1]).filter((n) => !!n).sort((a, b) => Number(a) - Number(b))[0];
27292
27305
  env.DISPLAY = x !== void 0 ? `:${x}` : ":0";
27293
27306
  } catch {
27294
27307
  env.DISPLAY = ":0";
@@ -27299,7 +27312,7 @@ function browserLaunchEnv(debug) {
27299
27312
  try {
27300
27313
  let xauth;
27301
27314
  if (runtimeDir) {
27302
- const cookie = readdirSync2(runtimeDir).find(
27315
+ const cookie = readdirSync3(runtimeDir).find(
27303
27316
  (f) => /^\.mutter-Xwaylandauth\./.test(f)
27304
27317
  );
27305
27318
  if (cookie) xauth = `${runtimeDir}/${cookie}`;
@@ -27326,7 +27339,9 @@ async function openInBrowser(url, debug) {
27326
27339
  for (const { cmd, args } of candidates) {
27327
27340
  try {
27328
27341
  await new Promise((resolve, reject) => {
27329
- const child = spawn3(cmd, args, { stdio: "ignore", detached: true, env: launchEnv });
27342
+ const spawnOpts = { stdio: "ignore", detached: true, env: launchEnv };
27343
+ if (process.platform === "win32") spawnOpts.windowsVerbatimArguments = true;
27344
+ const child = spawn3(cmd, args, spawnOpts);
27330
27345
  child.on("error", reject);
27331
27346
  child.on("spawn", () => {
27332
27347
  debug?.(`spawn OK: ${cmd} (pid=${child.pid})`);
@@ -27436,7 +27451,7 @@ var OAUTH_BASE_URLS = {
27436
27451
  fr: "https://staging.api.leadbay.app"
27437
27452
  }
27438
27453
  };
27439
- var VERSION = "0.23.3";
27454
+ var VERSION = "0.23.5";
27440
27455
  var HELP = `
27441
27456
  leadbay-mcp ${VERSION} \u2014 Leadbay Model Context Protocol server
27442
27457
 
@@ -23750,7 +23750,7 @@ function parseWriteEnv(env = process.env) {
23750
23750
  }
23751
23751
 
23752
23752
  // src/http-server.ts
23753
- var VERSION = true ? "0.23.3" : "0.0.0-dev";
23753
+ var VERSION = true ? "0.23.5" : "0.0.0-dev";
23754
23754
  var PORT = Number(process.env.PORT ?? 8080);
23755
23755
  var HOST = process.env.HOST ?? "0.0.0.0";
23756
23756
  var sseSessions = /* @__PURE__ */ new Map();
@@ -399,7 +399,7 @@ var init_install_dxt = __esm({
399
399
 
400
400
  // installer/install-shared.ts
401
401
  import { spawn as spawn2 } from "child_process";
402
- import { existsSync, readFileSync } from "fs";
402
+ import { existsSync, readFileSync, readdirSync } from "fs";
403
403
  import { join } from "path";
404
404
  import { homedir } from "os";
405
405
  function formatInstallOsLabel(platform = process.platform, arch = process.arch) {
@@ -455,6 +455,15 @@ async function windowsStoreAppInstalled(packageName, appName) {
455
455
  child.on("error", () => resolve(false));
456
456
  });
457
457
  }
458
+ function isClaudeStorePackagePresent(localAppData) {
459
+ const packagesDir = join(localAppData, "Packages");
460
+ if (!existsSync(packagesDir)) return false;
461
+ try {
462
+ return readdirSync(packagesDir).some((name) => /^Claude_/i.test(name));
463
+ } catch {
464
+ return false;
465
+ }
466
+ }
458
467
  async function isClaudeDesktopInstalled(home) {
459
468
  if (process.platform === "darwin") {
460
469
  return existsSync("/Applications/Claude.app") || existsSync(home + "/Applications/Claude.app");
@@ -463,12 +472,15 @@ async function isClaudeDesktopInstalled(home) {
463
472
  const local = process.env.LOCALAPPDATA ?? home + "/AppData/Local";
464
473
  const programFiles = process.env.ProgramFiles;
465
474
  const programFilesX86 = process.env["ProgramFiles(x86)"];
466
- return [
475
+ const exeInstalled = [
467
476
  local + "/Programs/Claude/Claude.exe",
468
477
  local + "/Claude/Claude.exe",
469
478
  programFiles ? programFiles + "/Claude/Claude.exe" : null,
470
479
  programFilesX86 ? programFilesX86 + "/Claude/Claude.exe" : null
471
480
  ].some((candidate) => candidate !== null && existsSync(candidate));
481
+ if (exeInstalled) return true;
482
+ if (isClaudeStorePackagePresent(local)) return true;
483
+ return await windowsStoreAppInstalled("AnthropicPBC.Claude", "Claude");
472
484
  }
473
485
  const desktopBin = await findOnPath("claude-desktop");
474
486
  if (desktopBin) return true;
@@ -550,7 +562,7 @@ import { createHash, randomBytes } from "crypto";
550
562
  import { createServer } from "http";
551
563
  import { request as httpsRequestRaw } from "https";
552
564
  import { spawn as spawn3 } from "child_process";
553
- import { readdirSync, existsSync as existsSync2 } from "fs";
565
+ import { readdirSync as readdirSync2, existsSync as existsSync2 } from "fs";
554
566
  async function inferRegionViaStargate(opts) {
555
567
  const url = STARGATE_URLS[opts.staging ? "staging" : "prod"];
556
568
  const res = await httpsCall("GET", url, { Accept: "application/json" });
@@ -823,9 +835,10 @@ function browserOpenCandidates(url) {
823
835
  if (platform === "win32") {
824
836
  const sysRoot = process.env.SystemRoot || process.env.windir || "C:\\Windows";
825
837
  const cmdExe = `${sysRoot}\\System32\\cmd.exe`;
838
+ const quoted = `"${url}"`;
826
839
  return [
827
- { cmd: cmdExe, args: ["/c", "start", '""', url] },
828
- { cmd: "cmd", args: ["/c", "start", '""', url] }
840
+ { cmd: cmdExe, args: ["/c", "start", '""', quoted] },
841
+ { cmd: "cmd", args: ["/c", "start", '""', quoted] }
829
842
  ];
830
843
  }
831
844
  return [
@@ -852,7 +865,7 @@ function browserLaunchEnv(debug) {
852
865
  }
853
866
  if (!env.WAYLAND_DISPLAY && runtimeDir) {
854
867
  try {
855
- const sock = readdirSync(runtimeDir).find((f) => /^wayland-\d+$/.test(f));
868
+ const sock = readdirSync2(runtimeDir).find((f) => /^wayland-\d+$/.test(f));
856
869
  if (sock) {
857
870
  env.WAYLAND_DISPLAY = sock;
858
871
  debug?.(`browserLaunchEnv: injected WAYLAND_DISPLAY=${sock}`);
@@ -869,7 +882,7 @@ function browserLaunchEnv(debug) {
869
882
  }
870
883
  if (!env.DISPLAY) {
871
884
  try {
872
- const x = readdirSync("/tmp/.X11-unix").map((f) => f.match(/^X(\d+)$/)?.[1]).filter((n) => !!n).sort((a, b) => Number(a) - Number(b))[0];
885
+ const x = readdirSync2("/tmp/.X11-unix").map((f) => f.match(/^X(\d+)$/)?.[1]).filter((n) => !!n).sort((a, b) => Number(a) - Number(b))[0];
873
886
  env.DISPLAY = x !== void 0 ? `:${x}` : ":0";
874
887
  } catch {
875
888
  env.DISPLAY = ":0";
@@ -880,7 +893,7 @@ function browserLaunchEnv(debug) {
880
893
  try {
881
894
  let xauth;
882
895
  if (runtimeDir) {
883
- const cookie = readdirSync(runtimeDir).find(
896
+ const cookie = readdirSync2(runtimeDir).find(
884
897
  (f) => /^\.mutter-Xwaylandauth\./.test(f)
885
898
  );
886
899
  if (cookie) xauth = `${runtimeDir}/${cookie}`;
@@ -907,7 +920,9 @@ async function openInBrowser(url, debug) {
907
920
  for (const { cmd, args } of candidates) {
908
921
  try {
909
922
  await new Promise((resolve, reject) => {
910
- const child = spawn3(cmd, args, { stdio: "ignore", detached: true, env: launchEnv });
923
+ const spawnOpts = { stdio: "ignore", detached: true, env: launchEnv };
924
+ if (process.platform === "win32") spawnOpts.windowsVerbatimArguments = true;
925
+ const child = spawn3(cmd, args, spawnOpts);
911
926
  child.on("error", reject);
912
927
  child.on("spawn", () => {
913
928
  debug?.(`spawn OK: ${cmd} (pid=${child.pid})`);
@@ -1718,7 +1733,7 @@ var init_installer_gui = __esm({
1718
1733
  init_install_dxt();
1719
1734
  init_install_shared();
1720
1735
  init_oauth();
1721
- VERSION = true ? "0.23.3" : "0.0.0-dev";
1736
+ VERSION = true ? "0.23.5" : "0.0.0-dev";
1722
1737
  PORT = Number(process.env.LEADBAY_INSTALLER_PORT ?? 0);
1723
1738
  sessions = /* @__PURE__ */ new Map();
1724
1739
  OAUTH_BASE_URLS = {
@@ -378,7 +378,7 @@ import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
378
378
 
379
379
  // installer/install-shared.ts
380
380
  import { spawn as spawn2 } from "child_process";
381
- import { existsSync, readFileSync } from "fs";
381
+ import { existsSync, readFileSync, readdirSync } from "fs";
382
382
  import { join } from "path";
383
383
  import { homedir } from "os";
384
384
  var HOSTED_MCP_URL = "https://leadbay-mcp-prod.fly.dev/mcp";
@@ -435,6 +435,15 @@ async function windowsStoreAppInstalled(packageName, appName) {
435
435
  child.on("error", () => resolve(false));
436
436
  });
437
437
  }
438
+ function isClaudeStorePackagePresent(localAppData) {
439
+ const packagesDir = join(localAppData, "Packages");
440
+ if (!existsSync(packagesDir)) return false;
441
+ try {
442
+ return readdirSync(packagesDir).some((name) => /^Claude_/i.test(name));
443
+ } catch {
444
+ return false;
445
+ }
446
+ }
438
447
  async function isClaudeDesktopInstalled(home) {
439
448
  if (process.platform === "darwin") {
440
449
  return existsSync("/Applications/Claude.app") || existsSync(home + "/Applications/Claude.app");
@@ -443,12 +452,15 @@ async function isClaudeDesktopInstalled(home) {
443
452
  const local = process.env.LOCALAPPDATA ?? home + "/AppData/Local";
444
453
  const programFiles = process.env.ProgramFiles;
445
454
  const programFilesX86 = process.env["ProgramFiles(x86)"];
446
- return [
455
+ const exeInstalled = [
447
456
  local + "/Programs/Claude/Claude.exe",
448
457
  local + "/Claude/Claude.exe",
449
458
  programFiles ? programFiles + "/Claude/Claude.exe" : null,
450
459
  programFilesX86 ? programFilesX86 + "/Claude/Claude.exe" : null
451
460
  ].some((candidate) => candidate !== null && existsSync(candidate));
461
+ if (exeInstalled) return true;
462
+ if (isClaudeStorePackagePresent(local)) return true;
463
+ return await windowsStoreAppInstalled("AnthropicPBC.Claude", "Claude");
452
464
  }
453
465
  const desktopBin = await findOnPath("claude-desktop");
454
466
  if (desktopBin) return true;
@@ -523,7 +535,7 @@ import { createHash, randomBytes } from "crypto";
523
535
  import { createServer } from "http";
524
536
  import { request as httpsRequestRaw } from "https";
525
537
  import { spawn as spawn3 } from "child_process";
526
- import { readdirSync, existsSync as existsSync2 } from "fs";
538
+ import { readdirSync as readdirSync2, existsSync as existsSync2 } from "fs";
527
539
  var LEADBAY_LOOPBACK_PORTS = [51789, 51790, 51791, 51792];
528
540
  var BrowserOpenFailedError = class extends Error {
529
541
  authorizeUrl;
@@ -829,9 +841,10 @@ function browserOpenCandidates(url) {
829
841
  if (platform === "win32") {
830
842
  const sysRoot = process.env.SystemRoot || process.env.windir || "C:\\Windows";
831
843
  const cmdExe = `${sysRoot}\\System32\\cmd.exe`;
844
+ const quoted = `"${url}"`;
832
845
  return [
833
- { cmd: cmdExe, args: ["/c", "start", '""', url] },
834
- { cmd: "cmd", args: ["/c", "start", '""', url] }
846
+ { cmd: cmdExe, args: ["/c", "start", '""', quoted] },
847
+ { cmd: "cmd", args: ["/c", "start", '""', quoted] }
835
848
  ];
836
849
  }
837
850
  return [
@@ -858,7 +871,7 @@ function browserLaunchEnv(debug) {
858
871
  }
859
872
  if (!env.WAYLAND_DISPLAY && runtimeDir) {
860
873
  try {
861
- const sock = readdirSync(runtimeDir).find((f) => /^wayland-\d+$/.test(f));
874
+ const sock = readdirSync2(runtimeDir).find((f) => /^wayland-\d+$/.test(f));
862
875
  if (sock) {
863
876
  env.WAYLAND_DISPLAY = sock;
864
877
  debug?.(`browserLaunchEnv: injected WAYLAND_DISPLAY=${sock}`);
@@ -875,7 +888,7 @@ function browserLaunchEnv(debug) {
875
888
  }
876
889
  if (!env.DISPLAY) {
877
890
  try {
878
- const x = readdirSync("/tmp/.X11-unix").map((f) => f.match(/^X(\d+)$/)?.[1]).filter((n) => !!n).sort((a, b) => Number(a) - Number(b))[0];
891
+ const x = readdirSync2("/tmp/.X11-unix").map((f) => f.match(/^X(\d+)$/)?.[1]).filter((n) => !!n).sort((a, b) => Number(a) - Number(b))[0];
879
892
  env.DISPLAY = x !== void 0 ? `:${x}` : ":0";
880
893
  } catch {
881
894
  env.DISPLAY = ":0";
@@ -886,7 +899,7 @@ function browserLaunchEnv(debug) {
886
899
  try {
887
900
  let xauth;
888
901
  if (runtimeDir) {
889
- const cookie = readdirSync(runtimeDir).find(
902
+ const cookie = readdirSync2(runtimeDir).find(
890
903
  (f) => /^\.mutter-Xwaylandauth\./.test(f)
891
904
  );
892
905
  if (cookie) xauth = `${runtimeDir}/${cookie}`;
@@ -913,7 +926,9 @@ async function openInBrowser(url, debug) {
913
926
  for (const { cmd, args } of candidates) {
914
927
  try {
915
928
  await new Promise((resolve, reject) => {
916
- const child = spawn3(cmd, args, { stdio: "ignore", detached: true, env: launchEnv });
929
+ const spawnOpts = { stdio: "ignore", detached: true, env: launchEnv };
930
+ if (process.platform === "win32") spawnOpts.windowsVerbatimArguments = true;
931
+ const child = spawn3(cmd, args, spawnOpts);
917
932
  child.on("error", reject);
918
933
  child.on("spawn", () => {
919
934
  debug?.(`spawn OK: ${cmd} (pid=${child.pid})`);
@@ -1012,7 +1027,7 @@ async function oauthLogin(opts) {
1012
1027
  }
1013
1028
 
1014
1029
  // installer/installer-gui.ts
1015
- var VERSION = true ? "0.23.3" : "0.0.0-dev";
1030
+ var VERSION = true ? "0.23.5" : "0.0.0-dev";
1016
1031
  var PORT = Number(process.env.LEADBAY_INSTALLER_PORT ?? 0);
1017
1032
  var sessions = /* @__PURE__ */ new Map();
1018
1033
  var OAUTH_BASE_URLS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leadbay/mcp",
3
- "version": "0.23.3",
3
+ "version": "0.23.5",
4
4
  "mcpName": "io.github.leadbay/leadbay-mcp",
5
5
  "description": "Model Context Protocol (MCP) server for Leadbay — AI lead discovery, qualification, and enrichment for Claude Desktop, Cursor, and Claude Code.",
6
6
  "type": "module",