@ada-mcp/mcp-server 0.1.24 → 0.1.26

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/cli.cjs +191 -84
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ if (!process.env.ADA_MCP_SERVER_ENTRY) process.env.ADA_MCP_SERVER_ENTRY = __filename;
2
3
  "use strict";
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
@@ -5555,6 +5556,66 @@ var init_src3 = __esm({
5555
5556
  }
5556
5557
  });
5557
5558
 
5559
+ // ../../packages/plugin-host/src/resolve-plugin-dir.ts
5560
+ function resolvePackagePluginDir() {
5561
+ const candidates = [];
5562
+ const push = (dir) => {
5563
+ const trimmed = dir?.trim();
5564
+ if (!trimmed) {
5565
+ return;
5566
+ }
5567
+ candidates.push(import_node_path6.default.resolve(trimmed));
5568
+ };
5569
+ push(process.env.ADA_PLUGIN_DIR);
5570
+ const entryFromEnv = process.env.ADA_MCP_SERVER_ENTRY?.trim();
5571
+ if (entryFromEnv) {
5572
+ const entryDir = import_node_path6.default.dirname(import_node_path6.default.resolve(entryFromEnv));
5573
+ push(import_node_path6.default.join(entryDir, "plugins"));
5574
+ push(import_node_path6.default.join(entryDir, "..", "plugins"));
5575
+ }
5576
+ const argv1 = process.argv[1]?.trim();
5577
+ if (argv1) {
5578
+ const entryDir = import_node_path6.default.dirname(import_node_path6.default.resolve(argv1));
5579
+ push(import_node_path6.default.join(entryDir, "plugins"));
5580
+ push(import_node_path6.default.join(entryDir, "..", "plugins"));
5581
+ }
5582
+ if (typeof __filename === "string") {
5583
+ const fromFile = import_node_path6.default.dirname(__filename);
5584
+ push(import_node_path6.default.join(fromFile, "plugins"));
5585
+ push(import_node_path6.default.join(fromFile, "..", "plugins"));
5586
+ }
5587
+ try {
5588
+ const req = (0, import_node_module2.createRequire)(typeof __filename === "string" ? __filename : process.cwd());
5589
+ for (const specifier of ["@ada-mcp/mcp-server/package.json", "@ada-mcp/mcp-server"]) {
5590
+ try {
5591
+ const resolved = req.resolve(specifier);
5592
+ const root = specifier.endsWith("package.json") ? import_node_path6.default.dirname(resolved) : import_node_path6.default.join(import_node_path6.default.dirname(resolved), "..");
5593
+ push(import_node_path6.default.join(root, "plugins"));
5594
+ } catch {
5595
+ }
5596
+ }
5597
+ } catch {
5598
+ }
5599
+ const seen = /* @__PURE__ */ new Set();
5600
+ for (const dir of candidates) {
5601
+ if (seen.has(dir) || !(0, import_node_fs2.existsSync)(dir)) {
5602
+ continue;
5603
+ }
5604
+ seen.add(dir);
5605
+ return dir;
5606
+ }
5607
+ return void 0;
5608
+ }
5609
+ var import_node_fs2, import_node_path6, import_node_module2;
5610
+ var init_resolve_plugin_dir = __esm({
5611
+ "../../packages/plugin-host/src/resolve-plugin-dir.ts"() {
5612
+ "use strict";
5613
+ import_node_fs2 = require("node:fs");
5614
+ import_node_path6 = __toESM(require("node:path"), 1);
5615
+ import_node_module2 = require("node:module");
5616
+ }
5617
+ });
5618
+
5558
5619
  // ../../packages/plugin-host/src/index.ts
5559
5620
  function assertManifest(plugin) {
5560
5621
  const m = plugin.manifest;
@@ -5578,15 +5639,60 @@ function isPluginModule(mod) {
5578
5639
  const m = mod.manifest;
5579
5640
  return !!m && typeof m.id === "string" && Array.isArray(m.platforms);
5580
5641
  }
5642
+ function entryScriptDir() {
5643
+ const argv1 = process.argv[1]?.trim();
5644
+ if (!argv1) {
5645
+ return void 0;
5646
+ }
5647
+ try {
5648
+ return import_node_path7.default.dirname(import_node_path7.default.resolve(argv1));
5649
+ } catch {
5650
+ return void 0;
5651
+ }
5652
+ }
5581
5653
  function resolvePluginDirs(explicitPluginDir) {
5582
- const fromEnv = process.env.ADA_PLUGIN_DIR?.trim();
5583
- const execDir = import_node_path6.default.dirname(process.execPath);
5654
+ const ordered = [];
5655
+ const push = (dir) => {
5656
+ const trimmed = dir?.trim();
5657
+ if (!trimmed) {
5658
+ return;
5659
+ }
5660
+ ordered.push(import_node_path7.default.resolve(trimmed));
5661
+ };
5662
+ push(explicitPluginDir);
5663
+ push(process.env.ADA_PLUGIN_DIR);
5664
+ const entryDir = entryScriptDir();
5665
+ if (entryDir) {
5666
+ push(import_node_path7.default.join(entryDir, "plugins"));
5667
+ push(import_node_path7.default.join(entryDir, "..", "plugins"));
5668
+ }
5669
+ if (typeof __filename === "string") {
5670
+ const fromModule = import_node_path7.default.dirname(__filename);
5671
+ push(import_node_path7.default.join(fromModule, "plugins"));
5672
+ push(import_node_path7.default.join(fromModule, "..", "plugins"));
5673
+ }
5674
+ const initCwd = process.env.INIT_CWD?.trim();
5675
+ if (initCwd) {
5676
+ push(import_node_path7.default.join(initCwd, "plugins"));
5677
+ push(import_node_path7.default.join(initCwd, "release", "plugins"));
5678
+ }
5584
5679
  const cwd = process.cwd();
5585
- return Array.from(
5586
- new Set(
5587
- [fromEnv, explicitPluginDir, import_node_path6.default.join(execDir, "plugins"), import_node_path6.default.join(cwd, "plugins"), import_node_path6.default.join(cwd, "release", "plugins")].filter((x) => Boolean(x && x.trim())).map((x) => import_node_path6.default.resolve(x))
5588
- )
5589
- );
5680
+ push(import_node_path7.default.join(cwd, "plugins"));
5681
+ push(import_node_path7.default.join(cwd, "release", "plugins"));
5682
+ const seen = /* @__PURE__ */ new Set();
5683
+ return ordered.filter((dir) => {
5684
+ if (seen.has(dir)) {
5685
+ return false;
5686
+ }
5687
+ seen.add(dir);
5688
+ return true;
5689
+ });
5690
+ }
5691
+ function pluginDirHasModules(pluginDir) {
5692
+ if (!import_node_fs3.default.existsSync(pluginDir)) {
5693
+ return false;
5694
+ }
5695
+ return import_node_fs3.default.readdirSync(pluginDir, { withFileTypes: true }).some((ent) => ent.isFile() && (ent.name.endsWith(".cjs") || ent.name.endsWith(".js")));
5590
5696
  }
5591
5697
  function loadPluginFromModule(requireFn, moduleId) {
5592
5698
  try {
@@ -5598,27 +5704,30 @@ function loadPluginFromModule(requireFn, moduleId) {
5598
5704
  }
5599
5705
  }
5600
5706
  function registerPluginsFromDirectory(host, pluginDir) {
5601
- if (!import_node_fs2.default.existsSync(pluginDir)) {
5707
+ if (!import_node_fs3.default.existsSync(pluginDir)) {
5602
5708
  return [];
5603
5709
  }
5604
- const entries = import_node_fs2.default.readdirSync(pluginDir, { withFileTypes: true }).filter((ent) => ent.isFile() && (ent.name.endsWith(".cjs") || ent.name.endsWith(".js"))).map((ent) => import_node_path6.default.join(pluginDir, ent.name)).sort((a, b) => a.localeCompare(b));
5710
+ const entries = import_node_fs3.default.readdirSync(pluginDir, { withFileTypes: true }).filter((ent) => ent.isFile() && (ent.name.endsWith(".cjs") || ent.name.endsWith(".js"))).map((ent) => import_node_path7.default.join(pluginDir, ent.name)).sort((a, b) => a.localeCompare(b));
5605
5711
  if (entries.length === 0) {
5606
5712
  return [];
5607
5713
  }
5608
5714
  const loaded = [];
5609
5715
  for (const file2 of entries) {
5610
- const requireFn = (0, import_node_module2.createRequire)(file2);
5716
+ const requireFn = (0, import_node_module3.createRequire)(file2);
5611
5717
  const plugin = loadPluginFromModule(requireFn, file2);
5612
5718
  if (!plugin) {
5613
5719
  continue;
5614
5720
  }
5721
+ if (host.listManifests().some((m) => m.id === plugin.manifest.id)) {
5722
+ continue;
5723
+ }
5615
5724
  host.register(plugin);
5616
5725
  loaded.push(plugin.manifest);
5617
5726
  }
5618
5727
  return loaded;
5619
5728
  }
5620
5729
  function registerPluginsFromModuleIds(host, moduleIds) {
5621
- const req = (0, import_node_module2.createRequire)(typeof __filename === "string" ? __filename : process.cwd());
5730
+ const req = (0, import_node_module3.createRequire)(typeof __filename === "string" ? __filename : process.cwd());
5622
5731
  const loaded = [];
5623
5732
  for (const moduleId of moduleIds) {
5624
5733
  const plugin = loadPluginFromModule(req, moduleId);
@@ -5631,24 +5740,27 @@ function registerPluginsFromModuleIds(host, moduleIds) {
5631
5740
  return loaded;
5632
5741
  }
5633
5742
  function registerRuntimePlugins(host, options) {
5634
- const manifests2 = [];
5635
5743
  for (const pluginDir of resolvePluginDirs(options?.pluginDir)) {
5636
- manifests2.push(...registerPluginsFromDirectory(host, pluginDir));
5637
- }
5638
- if (manifests2.length > 0) {
5639
- return manifests2;
5744
+ if (!pluginDirHasModules(pluginDir)) {
5745
+ continue;
5746
+ }
5747
+ const loaded = registerPluginsFromDirectory(host, pluginDir);
5748
+ if (loaded.length > 0) {
5749
+ return loaded;
5750
+ }
5640
5751
  }
5641
5752
  const fallbackModuleIds = options?.moduleIds?.length ? options.moduleIds : DEFAULT_PLUGIN_MODULE_IDS;
5642
5753
  return registerPluginsFromModuleIds(host, fallbackModuleIds);
5643
5754
  }
5644
- var import_node_fs2, import_node_path6, import_node_module2, PluginHost, DEFAULT_PLUGIN_MODULE_IDS;
5755
+ var import_node_fs3, import_node_path7, import_node_module3, PluginHost, DEFAULT_PLUGIN_MODULE_IDS;
5645
5756
  var init_src4 = __esm({
5646
5757
  "../../packages/plugin-host/src/index.ts"() {
5647
5758
  "use strict";
5648
5759
  init_src3();
5649
- import_node_fs2 = __toESM(require("node:fs"), 1);
5650
- import_node_path6 = __toESM(require("node:path"), 1);
5651
- import_node_module2 = require("node:module");
5760
+ import_node_fs3 = __toESM(require("node:fs"), 1);
5761
+ import_node_path7 = __toESM(require("node:path"), 1);
5762
+ import_node_module3 = require("node:module");
5763
+ init_resolve_plugin_dir();
5652
5764
  PluginHost = class {
5653
5765
  plugins = /* @__PURE__ */ new Map();
5654
5766
  webEngines = /* @__PURE__ */ new Map();
@@ -5762,12 +5874,12 @@ var init_src4 = __esm({
5762
5874
  // ../ada-agent/src/plugin-registry.ts
5763
5875
  function buildPluginHost() {
5764
5876
  const host = new PluginHost();
5765
- registerRuntimePlugins(host);
5877
+ const pluginDir = resolvePackagePluginDir();
5878
+ registerRuntimePlugins(host, pluginDir ? { pluginDir } : void 0);
5766
5879
  return host;
5767
5880
  }
5768
5881
  function listBuiltInPluginManifests() {
5769
- const host = new PluginHost();
5770
- return registerRuntimePlugins(host);
5882
+ return buildPluginHost().listManifests();
5771
5883
  }
5772
5884
  var init_plugin_registry = __esm({
5773
5885
  "../ada-agent/src/plugin-registry.ts"() {
@@ -5797,9 +5909,9 @@ async function isPortAvailable(host, port) {
5797
5909
  async function runDoctor(config2) {
5798
5910
  const root = await resolveWorkspaceRoot2(process.cwd());
5799
5911
  const queue = {
5800
- inboxDir: import_node_path7.default.resolve(root, config2.queue.inboxDir),
5801
- processedDir: import_node_path7.default.resolve(root, config2.queue.processedDir),
5802
- failedDir: import_node_path7.default.resolve(root, config2.queue.failedDir)
5912
+ inboxDir: import_node_path8.default.resolve(root, config2.queue.inboxDir),
5913
+ processedDir: import_node_path8.default.resolve(root, config2.queue.processedDir),
5914
+ failedDir: import_node_path8.default.resolve(root, config2.queue.failedDir)
5803
5915
  };
5804
5916
  const deps = await getDependencyHealth(config2);
5805
5917
  const portFree = await isPortAvailable(config2.bootstrapUI.host, config2.bootstrapUI.port);
@@ -5910,7 +6022,7 @@ async function checkNativeBootstrap(config2, root) {
5910
6022
  const hasPathHint = native.command.includes("/") || native.command.includes("\\") || native.command.startsWith(".");
5911
6023
  let reachable = false;
5912
6024
  if (hasPathHint) {
5913
- const resolved = import_node_path7.default.resolve(root, native.command);
6025
+ const resolved = import_node_path8.default.resolve(root, native.command);
5914
6026
  reachable = await fileExists2(resolved);
5915
6027
  } else {
5916
6028
  reachable = await commandExists(native.command);
@@ -5950,12 +6062,12 @@ async function checkAppiumServer(serverUrl) {
5950
6062
  };
5951
6063
  }
5952
6064
  }
5953
- var import_promises6, import_node_net, import_node_path7, import_node_url, import_node_child_process3;
6065
+ var import_promises6, import_node_net, import_node_path8, import_node_url, import_node_child_process3;
5954
6066
  var init_doctor = __esm({
5955
6067
  "../ada-agent/src/doctor.ts"() {
5956
6068
  import_promises6 = __toESM(require("node:fs/promises"));
5957
6069
  import_node_net = __toESM(require("node:net"));
5958
- import_node_path7 = __toESM(require("node:path"));
6070
+ import_node_path8 = __toESM(require("node:path"));
5959
6071
  import_node_url = require("node:url");
5960
6072
  import_node_child_process3 = require("node:child_process");
5961
6073
  init_dependency_installer();
@@ -7362,11 +7474,11 @@ function getScreenshotPath(result) {
7362
7474
  return typeof pathValue === "string" ? pathValue : null;
7363
7475
  }
7364
7476
  function buildMonitorOutputPath(config2, sourcePath, requestId, sessionId) {
7365
- const ext = import_node_path8.default.extname(sourcePath) || ".png";
7477
+ const ext = import_node_path9.default.extname(sourcePath) || ".png";
7366
7478
  if (config2.monitoring.groupBySession) {
7367
- return import_node_path8.default.join(config2.monitoring.outputDir, sessionId, `${requestId}${ext}`);
7479
+ return import_node_path9.default.join(config2.monitoring.outputDir, sessionId, `${requestId}${ext}`);
7368
7480
  }
7369
- return import_node_path8.default.join(config2.monitoring.outputDir, `${requestId}${ext}`);
7481
+ return import_node_path9.default.join(config2.monitoring.outputDir, `${requestId}${ext}`);
7370
7482
  }
7371
7483
  async function captureOperationMonitor(command, result, index, context) {
7372
7484
  if (!shouldMonitorCommand(command, context.config, index)) {
@@ -7388,7 +7500,7 @@ async function captureOperationMonitor(command, result, index, context) {
7388
7500
  return;
7389
7501
  }
7390
7502
  const targetPath = buildMonitorOutputPath(context.config, sourcePath, command.requestId, command.sessionId);
7391
- await import_promises9.default.mkdir(import_node_path8.default.dirname(targetPath), { recursive: true });
7503
+ await import_promises9.default.mkdir(import_node_path9.default.dirname(targetPath), { recursive: true });
7392
7504
  const { maxWidth, maxHeight, keepAspectRatio } = context.config.monitoring.resolution;
7393
7505
  const mw = Math.max(1, maxWidth);
7394
7506
  const mh = Math.max(1, maxHeight);
@@ -7412,12 +7524,12 @@ async function captureOperationMonitor(command, result, index, context) {
7412
7524
  }
7413
7525
  });
7414
7526
  }
7415
- var import_promises9, import_node_path8, import_jimp;
7527
+ var import_promises9, import_node_path9, import_jimp;
7416
7528
  var init_monitoring = __esm({
7417
7529
  "../ada-agent/src/monitoring.ts"() {
7418
7530
  "use strict";
7419
7531
  import_promises9 = __toESM(require("node:fs/promises"), 1);
7420
- import_node_path8 = __toESM(require("node:path"), 1);
7532
+ import_node_path9 = __toESM(require("node:path"), 1);
7421
7533
  import_jimp = require("jimp");
7422
7534
  init_logger();
7423
7535
  }
@@ -7503,16 +7615,16 @@ async function ensureDirs(config2) {
7503
7615
  }
7504
7616
  async function listTaskFiles(inboxDir) {
7505
7617
  const entries = await import_promises10.default.readdir(inboxDir, { withFileTypes: true });
7506
- return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => import_node_path9.default.join(inboxDir, entry.name)).sort((a, b) => a.localeCompare(b));
7618
+ return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => import_node_path10.default.join(inboxDir, entry.name)).sort((a, b) => a.localeCompare(b));
7507
7619
  }
7508
7620
  async function moveTo(targetDir, sourcePath) {
7509
- const fileName = import_node_path9.default.basename(sourcePath);
7510
- const destination = import_node_path9.default.join(targetDir, fileName);
7621
+ const fileName = import_node_path10.default.basename(sourcePath);
7622
+ const destination = import_node_path10.default.join(targetDir, fileName);
7511
7623
  await import_promises10.default.rename(sourcePath, destination);
7512
7624
  }
7513
7625
  async function writeFailedMeta(targetDir, sourcePath, meta3) {
7514
- const fileName = `${import_node_path9.default.basename(sourcePath)}.error.json`;
7515
- const destination = import_node_path9.default.join(targetDir, fileName);
7626
+ const fileName = `${import_node_path10.default.basename(sourcePath)}.error.json`;
7627
+ const destination = import_node_path10.default.join(targetDir, fileName);
7516
7628
  await import_promises10.default.writeFile(destination, JSON.stringify(meta3, null, 2), "utf8");
7517
7629
  }
7518
7630
  async function processQueueOnce(config2, options = {}) {
@@ -7588,11 +7700,11 @@ async function watchQueue(config2, shouldStop, options = {}) {
7588
7700
  }
7589
7701
  log("info", { event: "queue.watch.stopped" });
7590
7702
  }
7591
- var import_promises10, import_node_path9;
7703
+ var import_promises10, import_node_path10;
7592
7704
  var init_queue_runner = __esm({
7593
7705
  "../ada-agent/src/queue-runner.ts"() {
7594
7706
  import_promises10 = __toESM(require("node:fs/promises"));
7595
- import_node_path9 = __toESM(require("node:path"));
7707
+ import_node_path10 = __toESM(require("node:path"));
7596
7708
  init_task_loader();
7597
7709
  init_runtime();
7598
7710
  init_logger();
@@ -18136,64 +18248,49 @@ var init_streamableHttp = __esm({
18136
18248
  });
18137
18249
 
18138
18250
  // src/executor.ts
18139
- function ensureBundledPluginDir() {
18140
- if (process.env.ADA_PLUGIN_DIR?.trim()) {
18141
- return;
18251
+ function getPluginHost() {
18252
+ if (sharedHost) {
18253
+ return sharedHost;
18142
18254
  }
18143
- const candidates = [];
18144
- try {
18145
- const here = import_node_path11.default.dirname((0, import_node_url3.fileURLToPath)(import_meta.url));
18146
- candidates.push(import_node_path11.default.join(here, "..", "plugins"));
18147
- } catch {
18148
- }
18149
- const dirname = globalThis.__dirname;
18150
- if (typeof dirname === "string") {
18151
- candidates.push(import_node_path11.default.join(dirname, "..", "plugins"));
18152
- }
18153
- for (const dir of candidates) {
18154
- if ((0, import_node_fs4.existsSync)(dir)) {
18155
- process.env.ADA_PLUGIN_DIR = dir;
18156
- return;
18157
- }
18158
- }
18159
- }
18160
- function buildPluginHost2() {
18161
- ensureBundledPluginDir();
18255
+ const bundledDir = resolvePackagePluginDir();
18162
18256
  const host = new PluginHost();
18163
- registerRuntimePlugins(host);
18257
+ registerRuntimePlugins(host, bundledDir ? { pluginDir: bundledDir } : void 0);
18258
+ sharedHost = host;
18164
18259
  return host;
18165
18260
  }
18261
+ function getExecutor() {
18262
+ if (!sharedExecutor) {
18263
+ sharedExecutor = new TaskExecutor(getPluginHost());
18264
+ }
18265
+ return sharedExecutor;
18266
+ }
18166
18267
  async function runCommand3(command) {
18167
- return sharedExecutor.execute(command);
18268
+ return getExecutor().execute(command);
18168
18269
  }
18169
18270
  async function runTaskset2(commands) {
18170
18271
  const results = [];
18171
18272
  for (const command of commands) {
18172
- results.push(await sharedExecutor.execute(command));
18273
+ results.push(await runCommand3(command));
18173
18274
  }
18174
18275
  return results;
18175
18276
  }
18176
18277
  function listActiveSessions() {
18177
- return sharedExecutor.listSessions();
18278
+ return getExecutor().listSessions();
18178
18279
  }
18179
18280
  async function closeSession(platform, sessionId, options) {
18180
- return sharedExecutor.closeSession(platform, sessionId, options);
18281
+ return getExecutor().closeSession(platform, sessionId, options);
18181
18282
  }
18182
18283
  async function closeAllSessions() {
18183
- return sharedExecutor.closeAllSessions();
18284
+ return getExecutor().closeAllSessions();
18184
18285
  }
18185
- var import_node_fs4, import_node_path11, import_node_url3, import_meta, manifests, sharedExecutor;
18286
+ var sharedHost, sharedExecutor;
18186
18287
  var init_executor = __esm({
18187
18288
  "src/executor.ts"() {
18188
18289
  "use strict";
18189
- import_node_fs4 = require("node:fs");
18190
- import_node_path11 = __toESM(require("node:path"));
18191
- import_node_url3 = require("node:url");
18192
18290
  init_src7();
18193
18291
  init_src4();
18194
- import_meta = {};
18195
- manifests = registerRuntimePlugins(new PluginHost());
18196
- sharedExecutor = new TaskExecutor(buildPluginHost2());
18292
+ sharedHost = null;
18293
+ sharedExecutor = null;
18197
18294
  }
18198
18295
  });
18199
18296
 
@@ -31355,7 +31452,7 @@ async function isPortOpen(host, port) {
31355
31452
  });
31356
31453
  }
31357
31454
  function parseServerEndpoint(serverUrl) {
31358
- const parsed = new import_node_url4.URL(serverUrl);
31455
+ const parsed = new import_node_url3.URL(serverUrl);
31359
31456
  const host = parsed.hostname;
31360
31457
  const port = Number(parsed.port || (parsed.protocol === "https:" ? 443 : 80));
31361
31458
  return { host, port };
@@ -33011,7 +33108,7 @@ async function startMcpServer() {
33011
33108
  await server.connect(transport);
33012
33109
  console.error("[ADA-MCP] server connected");
33013
33110
  }
33014
- var import_promises13, import_node_fs5, import_node_net2, import_node_path14, import_node_child_process5, import_node_url4, appiumEnsureJob, persistedHomesCache, appiumReadyCache, APPIUM_READY_CACHE_TTL_MS, supportedCommands, riskyCommandDefaults, riskyCommandAllowlist, perfStats, PERF_MAX_SAMPLES_PER_LABEL, shuttingDown, server;
33111
+ var import_promises13, import_node_fs5, import_node_net2, import_node_path14, import_node_child_process5, import_node_url3, appiumEnsureJob, persistedHomesCache, appiumReadyCache, APPIUM_READY_CACHE_TTL_MS, supportedCommands, riskyCommandDefaults, riskyCommandAllowlist, perfStats, PERF_MAX_SAMPLES_PER_LABEL, shuttingDown, server;
33015
33112
  var init_main = __esm({
33016
33113
  "src/main.ts"() {
33017
33114
  "use strict";
@@ -33020,7 +33117,7 @@ var init_main = __esm({
33020
33117
  import_node_net2 = __toESM(require("node:net"));
33021
33118
  import_node_path14 = __toESM(require("node:path"));
33022
33119
  import_node_child_process5 = require("node:child_process");
33023
- import_node_url4 = require("node:url");
33120
+ import_node_url3 = require("node:url");
33024
33121
  init_server2();
33025
33122
  init_stdio2();
33026
33123
  init_types();
@@ -33345,9 +33442,12 @@ var init_remote_server = __esm({
33345
33442
  }
33346
33443
  });
33347
33444
 
33445
+ // src/cli.ts
33446
+ var import_node_url4 = require("node:url");
33447
+
33348
33448
  // src/bootstrap-deps.ts
33349
- var import_node_fs3 = __toESM(require("node:fs"));
33350
- var import_node_path10 = __toESM(require("node:path"));
33449
+ var import_node_fs4 = __toESM(require("node:fs"));
33450
+ var import_node_path11 = __toESM(require("node:path"));
33351
33451
  init_src8();
33352
33452
  var INSTALL_SCOPE_TOKENS = /* @__PURE__ */ new Set([
33353
33453
  "playwright",
@@ -33430,9 +33530,9 @@ function applyPreinstallPlaywrightHostFile() {
33430
33530
  (x) => typeof x === "string" && x.trim().length > 0
33431
33531
  );
33432
33532
  for (const root of roots) {
33433
- const file2 = import_node_path10.default.join(root, ".ada-mcp-playwright-host");
33533
+ const file2 = import_node_path11.default.join(root, ".ada-mcp-playwright-host");
33434
33534
  try {
33435
- const host = normalizePlaywrightHost(import_node_fs3.default.readFileSync(file2, "utf8").trim());
33535
+ const host = normalizePlaywrightHost(import_node_fs4.default.readFileSync(file2, "utf8").trim());
33436
33536
  if (host.length > 0 && PREINSTALL_PLAYWRIGHT_HOST_ALLOW.has(host)) {
33437
33537
  process.env.PLAYWRIGHT_DOWNLOAD_HOST = host;
33438
33538
  process.env.ADA_PLAYWRIGHT_HOST_FROM_PREINSTALL = "1";
@@ -33483,6 +33583,13 @@ async function runBootstrapInstallDeps(argv2) {
33483
33583
  }
33484
33584
 
33485
33585
  // src/cli.ts
33586
+ var import_meta = {};
33587
+ if (!process.env.ADA_MCP_SERVER_ENTRY?.trim()) {
33588
+ try {
33589
+ process.env.ADA_MCP_SERVER_ENTRY = (0, import_node_url4.fileURLToPath)(import_meta.url);
33590
+ } catch {
33591
+ }
33592
+ }
33486
33593
  function argValue(name, fallback = "") {
33487
33594
  const argv2 = process.argv.slice(2);
33488
33595
  const hit = argv2.find((x) => x.startsWith(`${name}=`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-mcp/mcp-server",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "ADA MCP server for web/mobile automation (stdio + remote HTTP)",
5
5
  "private": false,
6
6
  "type": "commonjs",