@ada-mcp/mcp-server 0.1.20 → 0.1.22
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.cjs +71 -4
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -4709,12 +4709,25 @@ async function runAppiumDriverInstallWithPriority(config2, driver, onLogLine) {
|
|
|
4709
4709
|
for (const target of uniqueTargets) {
|
|
4710
4710
|
const installArgs = buildAppiumDriverInstallArgs(target, appiumMajor);
|
|
4711
4711
|
onLogLine?.(`[appium] \u6267\u884C: npm ${installArgs.join(" ")}`);
|
|
4712
|
+
let alreadyInstalledSeen = false;
|
|
4713
|
+
const onAppiumDriverLogLine = (line) => {
|
|
4714
|
+
const t = line.trimEnd();
|
|
4715
|
+
const normalized = t.replace(/^Error:\s*[×x]?\s*/i, "");
|
|
4716
|
+
if (/A driver named\s+\"uiautomator2\"\s+is already installed/i.test(normalized)) {
|
|
4717
|
+
alreadyInstalledSeen = true;
|
|
4718
|
+
onLogLine?.(
|
|
4719
|
+
`[deps][warn] ${normalized}\u3002\u68C0\u6D4B\u5230\u5B89\u88C5\u540E\u65E0\u9700\u518D\u6B21\u5B89\u88C5${driver}\u3002`
|
|
4720
|
+
);
|
|
4721
|
+
return;
|
|
4722
|
+
}
|
|
4723
|
+
onLogLine?.(t);
|
|
4724
|
+
};
|
|
4712
4725
|
const strategies = [
|
|
4713
4726
|
{
|
|
4714
4727
|
name: "npm",
|
|
4715
4728
|
run: () => runCommand2("npm", installArgs, {
|
|
4716
4729
|
timeoutMs: installStrategyTimeoutMs(),
|
|
4717
|
-
onLogLine
|
|
4730
|
+
onLogLine: onAppiumDriverLogLine
|
|
4718
4731
|
})
|
|
4719
4732
|
},
|
|
4720
4733
|
{
|
|
@@ -4722,7 +4735,7 @@ async function runAppiumDriverInstallWithPriority(config2, driver, onLogLine) {
|
|
|
4722
4735
|
run: () => runCommand2("npm", installArgs, {
|
|
4723
4736
|
env: { npm_config_registry: npmProxy },
|
|
4724
4737
|
timeoutMs: installStrategyTimeoutMs(),
|
|
4725
|
-
onLogLine
|
|
4738
|
+
onLogLine: onAppiumDriverLogLine
|
|
4726
4739
|
})
|
|
4727
4740
|
}
|
|
4728
4741
|
];
|
|
@@ -4740,6 +4753,10 @@ async function runAppiumDriverInstallWithPriority(config2, driver, onLogLine) {
|
|
|
4740
4753
|
progress("appium.driver.install.done", { driver, strategy: strategy.name, target });
|
|
4741
4754
|
return;
|
|
4742
4755
|
} catch (error2) {
|
|
4756
|
+
if (alreadyInstalledSeen) {
|
|
4757
|
+
progress("appium.driver.install.done", { driver, strategy: strategy.name, target });
|
|
4758
|
+
return;
|
|
4759
|
+
}
|
|
4743
4760
|
lastError = error2;
|
|
4744
4761
|
depsStructuredLog("warn", {
|
|
4745
4762
|
event: "appium.driver.install.strategy.fail",
|
|
@@ -4753,10 +4770,39 @@ async function runAppiumDriverInstallWithPriority(config2, driver, onLogLine) {
|
|
|
4753
4770
|
}
|
|
4754
4771
|
}
|
|
4755
4772
|
}
|
|
4773
|
+
if (driver === "uiautomator2") {
|
|
4774
|
+
await tryPipInstallUiautomator2(onLogLine);
|
|
4775
|
+
}
|
|
4756
4776
|
throw new Error(
|
|
4757
4777
|
`Appium driver install failed after all strategies (${driver}): ${lastError instanceof Error ? lastError.message : String(lastError)}`
|
|
4758
4778
|
);
|
|
4759
4779
|
}
|
|
4780
|
+
async function tryPipInstallUiautomator2(onLogLine) {
|
|
4781
|
+
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");
|
|
4782
|
+
const pythonVersion = await runCommandCapture2("python", ["--version"]);
|
|
4783
|
+
if (pythonVersion.code !== 0) {
|
|
4784
|
+
const py3Version = await runCommandCapture2("python3", ["--version"]);
|
|
4785
|
+
if (py3Version.code !== 0) {
|
|
4786
|
+
onLogLine?.("[appium][warn] \u672A\u68C0\u6D4B\u5230 python/python3\uFF0C\u8DF3\u8FC7 pip \u5B89\u88C5 uiautomator2\u3002");
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4789
|
+
await tryPipInstallWithPython("python3", onLogLine);
|
|
4790
|
+
return;
|
|
4791
|
+
}
|
|
4792
|
+
await tryPipInstallWithPython("python", onLogLine);
|
|
4793
|
+
}
|
|
4794
|
+
async function tryPipInstallWithPython(pythonCmd, onLogLine) {
|
|
4795
|
+
try {
|
|
4796
|
+
onLogLine?.(`[pip] \u68C0\u6D4B\u5230 ${pythonCmd}\uFF0C\u5F00\u59CB\u5B89\u88C5: ${pythonCmd} -m pip install -U uiautomator2`);
|
|
4797
|
+
await runCommand2(pythonCmd, ["-m", "pip", "install", "-U", "uiautomator2"], {
|
|
4798
|
+
timeoutMs: 15 * 6e4,
|
|
4799
|
+
onLogLine
|
|
4800
|
+
});
|
|
4801
|
+
onLogLine?.("[pip] uiautomator2 \u5B89\u88C5\u5B8C\u6210\u3002");
|
|
4802
|
+
} catch (error2) {
|
|
4803
|
+
onLogLine?.(`[pip][warn] uiautomator2 \u5B89\u88C5\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09: ${briefErrorMessage(error2)}`);
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4760
4806
|
async function verifyPlaywrightSelfTest(onLogLine) {
|
|
4761
4807
|
onLogLine?.("[playwright] \u81EA\u68C0\uFF1A\u542F\u52A8 Chromium");
|
|
4762
4808
|
try {
|
|
@@ -32815,11 +32861,24 @@ async function startMcpServer() {
|
|
|
32815
32861
|
if (passedArgs.includes("mcp")) {
|
|
32816
32862
|
console.error('[ADA-MCP] warning: standalone ada-mcp binary does not require "mcp" arg; it is safe to remove.');
|
|
32817
32863
|
}
|
|
32864
|
+
function tryReadPackageVersion(name) {
|
|
32865
|
+
try {
|
|
32866
|
+
const raw = require(`${name}/package.json`);
|
|
32867
|
+
const v = String(raw?.version ?? "").trim();
|
|
32868
|
+
return v.length > 0 ? v : null;
|
|
32869
|
+
} catch {
|
|
32870
|
+
return null;
|
|
32871
|
+
}
|
|
32872
|
+
}
|
|
32873
|
+
const launcherVersion = tryReadPackageVersion("@ada-mcp/launcher");
|
|
32874
|
+
const selfVersion = tryReadPackageVersion("@ada-mcp/mcp-server");
|
|
32875
|
+
const alignedLauncherVersion = launcherVersion || selfVersion;
|
|
32876
|
+
const launcherSpec = alignedLauncherVersion ? `@ada-mcp/launcher@${alignedLauncherVersion}` : "@ada-mcp/launcher";
|
|
32818
32877
|
const configHint = {
|
|
32819
32878
|
mcpServers: {
|
|
32820
32879
|
"ada-mcp": {
|
|
32821
32880
|
command: "pnpm",
|
|
32822
|
-
args: ["dlx",
|
|
32881
|
+
args: ["dlx", launcherSpec]
|
|
32823
32882
|
}
|
|
32824
32883
|
}
|
|
32825
32884
|
};
|
|
@@ -32833,7 +32892,7 @@ async function startMcpServer() {
|
|
|
32833
32892
|
ADA_PLAYWRIGHT_HEADLESS: "true",
|
|
32834
32893
|
ADA_MCP_INSTALL_DEPS: "playwright",
|
|
32835
32894
|
ADA_INSTALL_STRATEGY_TIMEOUT_MS: "120000",
|
|
32836
|
-
ADA_PLAYWRIGHT_INSTALL_TIMEOUT_MS: "
|
|
32895
|
+
ADA_PLAYWRIGHT_INSTALL_TIMEOUT_MS: "1800000"
|
|
32837
32896
|
}
|
|
32838
32897
|
}
|
|
32839
32898
|
}
|
|
@@ -32848,6 +32907,14 @@ async function startMcpServer() {
|
|
|
32848
32907
|
};
|
|
32849
32908
|
console.error("[ADA-MCP] config hint (npm standard):");
|
|
32850
32909
|
console.error(JSON.stringify(configHint, null, 2));
|
|
32910
|
+
if (selfVersion) {
|
|
32911
|
+
console.error(`[ADA-MCP] package version: @ada-mcp/mcp-server@${selfVersion}`);
|
|
32912
|
+
}
|
|
32913
|
+
if (launcherVersion) {
|
|
32914
|
+
console.error(`[ADA-MCP] launcher version detected: @ada-mcp/launcher@${launcherVersion}`);
|
|
32915
|
+
} else {
|
|
32916
|
+
console.error("[ADA-MCP] launcher version not detected (using tag without version).");
|
|
32917
|
+
}
|
|
32851
32918
|
console.error("[ADA-MCP] config hint (local binary):");
|
|
32852
32919
|
console.error(JSON.stringify(binaryHint, null, 2));
|
|
32853
32920
|
console.error("[ADA-MCP] note: MCP tool names use ada_snake_case (e.g. ada_install_deps, ada_invoke, ada_web_action)");
|