@ada-mcp/mcp-server 0.1.20 → 0.1.21

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 +61 -2
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -4740,6 +4740,15 @@ async function runAppiumDriverInstallWithPriority(config2, driver, onLogLine) {
4740
4740
  progress("appium.driver.install.done", { driver, strategy: strategy.name, target });
4741
4741
  return;
4742
4742
  } catch (error2) {
4743
+ const msg = error2 instanceof Error ? error2.message : String(error2);
4744
+ if (/already installed/i.test(msg) && /driver named/i.test(msg)) {
4745
+ const normalized = msg.replace(/^Error:\s*/i, "").trim();
4746
+ onLogLine?.(
4747
+ `[deps][warn] ${normalized}\u3002\u68C0\u6D4B\u5230\u5B89\u88C5\u540E\u65E0\u9700\u518D\u6B21\u5B89\u88C5 ${driver}\u3002`
4748
+ );
4749
+ progress("appium.driver.install.done", { driver, strategy: strategy.name, target });
4750
+ return;
4751
+ }
4743
4752
  lastError = error2;
4744
4753
  depsStructuredLog("warn", {
4745
4754
  event: "appium.driver.install.strategy.fail",
@@ -4753,10 +4762,39 @@ async function runAppiumDriverInstallWithPriority(config2, driver, onLogLine) {
4753
4762
  }
4754
4763
  }
4755
4764
  }
4765
+ if (driver === "uiautomator2") {
4766
+ await tryPipInstallUiautomator2(onLogLine);
4767
+ }
4756
4768
  throw new Error(
4757
4769
  `Appium driver install failed after all strategies (${driver}): ${lastError instanceof Error ? lastError.message : String(lastError)}`
4758
4770
  );
4759
4771
  }
4772
+ async function tryPipInstallUiautomator2(onLogLine) {
4773
+ onLogLine?.("[appium][warn] uiautomator2 \u9A71\u52A8\u5B89\u88C5\u5931\u8D25\uFF0C\u5C1D\u8BD5\u4F7F\u7528 pip \u5B89\u88C5 python-uiautomator2\uFF08\u4E0D\u4FDD\u8BC1\u53EF\u66FF\u4EE3 Appium \u9A71\u52A8\uFF09\u2026");
4774
+ const pythonVersion = await runCommandCapture2("python", ["--version"]);
4775
+ if (pythonVersion.code !== 0) {
4776
+ const py3Version = await runCommandCapture2("python3", ["--version"]);
4777
+ if (py3Version.code !== 0) {
4778
+ onLogLine?.("[appium][warn] \u672A\u68C0\u6D4B\u5230 python/python3\uFF0C\u8DF3\u8FC7 pip \u5B89\u88C5 uiautomator2\u3002");
4779
+ return;
4780
+ }
4781
+ await tryPipInstallWithPython("python3", onLogLine);
4782
+ return;
4783
+ }
4784
+ await tryPipInstallWithPython("python", onLogLine);
4785
+ }
4786
+ async function tryPipInstallWithPython(pythonCmd, onLogLine) {
4787
+ try {
4788
+ onLogLine?.(`[pip] \u68C0\u6D4B\u5230 ${pythonCmd}\uFF0C\u5F00\u59CB\u5B89\u88C5: ${pythonCmd} -m pip install -U uiautomator2`);
4789
+ await runCommand2(pythonCmd, ["-m", "pip", "install", "-U", "uiautomator2"], {
4790
+ timeoutMs: 15 * 6e4,
4791
+ onLogLine
4792
+ });
4793
+ onLogLine?.("[pip] uiautomator2 \u5B89\u88C5\u5B8C\u6210\u3002");
4794
+ } catch (error2) {
4795
+ onLogLine?.(`[pip][warn] uiautomator2 \u5B89\u88C5\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09: ${briefErrorMessage(error2)}`);
4796
+ }
4797
+ }
4760
4798
  async function verifyPlaywrightSelfTest(onLogLine) {
4761
4799
  onLogLine?.("[playwright] \u81EA\u68C0\uFF1A\u542F\u52A8 Chromium");
4762
4800
  try {
@@ -32815,11 +32853,24 @@ async function startMcpServer() {
32815
32853
  if (passedArgs.includes("mcp")) {
32816
32854
  console.error('[ADA-MCP] warning: standalone ada-mcp binary does not require "mcp" arg; it is safe to remove.');
32817
32855
  }
32856
+ function tryReadPackageVersion(name) {
32857
+ try {
32858
+ const raw = require(`${name}/package.json`);
32859
+ const v = String(raw?.version ?? "").trim();
32860
+ return v.length > 0 ? v : null;
32861
+ } catch {
32862
+ return null;
32863
+ }
32864
+ }
32865
+ const launcherVersion = tryReadPackageVersion("@ada-mcp/launcher");
32866
+ const selfVersion = tryReadPackageVersion("@ada-mcp/mcp-server");
32867
+ const alignedLauncherVersion = launcherVersion || selfVersion;
32868
+ const launcherSpec = alignedLauncherVersion ? `@ada-mcp/launcher@${alignedLauncherVersion}` : "@ada-mcp/launcher";
32818
32869
  const configHint = {
32819
32870
  mcpServers: {
32820
32871
  "ada-mcp": {
32821
32872
  command: "pnpm",
32822
- args: ["dlx", "@ada-mcp/launcher@0.1.7"]
32873
+ args: ["dlx", launcherSpec]
32823
32874
  }
32824
32875
  }
32825
32876
  };
@@ -32833,7 +32884,7 @@ async function startMcpServer() {
32833
32884
  ADA_PLAYWRIGHT_HEADLESS: "true",
32834
32885
  ADA_MCP_INSTALL_DEPS: "playwright",
32835
32886
  ADA_INSTALL_STRATEGY_TIMEOUT_MS: "120000",
32836
- ADA_PLAYWRIGHT_INSTALL_TIMEOUT_MS: "900000"
32887
+ ADA_PLAYWRIGHT_INSTALL_TIMEOUT_MS: "1800000"
32837
32888
  }
32838
32889
  }
32839
32890
  }
@@ -32848,6 +32899,14 @@ async function startMcpServer() {
32848
32899
  };
32849
32900
  console.error("[ADA-MCP] config hint (npm standard):");
32850
32901
  console.error(JSON.stringify(configHint, null, 2));
32902
+ if (selfVersion) {
32903
+ console.error(`[ADA-MCP] package version: @ada-mcp/mcp-server@${selfVersion}`);
32904
+ }
32905
+ if (launcherVersion) {
32906
+ console.error(`[ADA-MCP] launcher version detected: @ada-mcp/launcher@${launcherVersion}`);
32907
+ } else {
32908
+ console.error("[ADA-MCP] launcher version not detected (using tag without version).");
32909
+ }
32851
32910
  console.error("[ADA-MCP] config hint (local binary):");
32852
32911
  console.error(JSON.stringify(binaryHint, null, 2));
32853
32912
  console.error("[ADA-MCP] note: MCP tool names use ada_snake_case (e.g. ada_install_deps, ada_invoke, ada_web_action)");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-mcp/mcp-server",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "ADA MCP server for web/mobile automation (stdio + remote HTTP)",
5
5
  "private": false,
6
6
  "type": "commonjs",