@ada-mcp/mcp-server 0.1.17 → 0.1.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 (3) hide show
  1. package/README.md +10 -10
  2. package/dist/cli.cjs +131 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -8,27 +8,27 @@ ADA MCP server package that supports:
8
8
 
9
9
  ## 标准安装(Cursor / MCP)
10
10
 
11
- 请使用 **`@ada-mcp/launcher@0.1.14`** 拉起本包(见 [launcher README](../ada-mcp-launcher/README.md)):
11
+ 请使用 **`@ada-mcp/launcher@0.1.17`** 拉起本包(见 [launcher README](../ada-mcp-launcher/README.md)):
12
12
 
13
13
  ```json
14
14
  {
15
15
  "mcpServers": {
16
16
  "ada-mcp": {
17
17
  "command": "pnpm",
18
- "args": ["dlx", "@ada-mcp/launcher@0.1.14"]
18
+ "args": ["dlx", "@ada-mcp/launcher@0.1.17"]
19
19
  }
20
20
  }
21
21
  }
22
22
  ```
23
23
 
24
- 本包版本:**`@ada-mcp/mcp-server@0.1.17`**(由 launcher 默认拉取;依赖锁定 `playwright@1.59.1`)。
24
+ 本包版本:**`@ada-mcp/mcp-server@0.1.18`**(由 launcher 默认拉取;依赖锁定 `playwright@1.59.1`)。
25
25
 
26
26
  直接调试本包(无 launcher 拉包前测速):
27
27
 
28
28
  ```bash
29
- pnpm dlx @ada-mcp/mcp-server@0.1.17
29
+ pnpm dlx @ada-mcp/mcp-server@0.1.18
30
30
  # npx 等价:
31
- npx -y @ada-mcp/mcp-server@0.1.17
31
+ npx -y @ada-mcp/mcp-server@0.1.18
32
32
  ```
33
33
 
34
34
  ## 启动时自动安装依赖(默认仅 Playwright)
@@ -83,27 +83,27 @@ npx -y @ada-mcp/mcp-server@0.1.17
83
83
  在标准 `args` 后追加,例如安装全部依赖:
84
84
 
85
85
  ```json
86
- "args": ["dlx", "@ada-mcp/launcher@0.1.14", "--install-deps=all"]
86
+ "args": ["dlx", "@ada-mcp/launcher@0.1.17", "--install-deps=all"]
87
87
  ```
88
88
 
89
89
  ## Cursor MCP 配置
90
90
 
91
- **pnpm(推荐)**:`pnpm` + `dlx @ada-mcp/launcher@0.1.14`
91
+ **pnpm(推荐)**:`pnpm` + `dlx @ada-mcp/launcher@0.1.17`
92
92
 
93
- **npx 等价**(`launcher@0.1.7+`):`npx` + `-y @ada-mcp/launcher@0.1.14`(内层同样 `npx -y` mcp-server,测速逻辑与 pnpm 一致)
93
+ **npx 等价**(`launcher@0.1.7+`):`npx` + `-y @ada-mcp/launcher@0.1.17`(内层同样 `npx -y` mcp-server,测速逻辑与 pnpm 一致)
94
94
 
95
95
  ```json
96
96
  {
97
97
  "mcpServers": {
98
98
  "ada-mcp": {
99
99
  "command": "npx",
100
- "args": ["-y", "@ada-mcp/launcher@0.1.14"]
100
+ "args": ["-y", "@ada-mcp/launcher@0.1.17"]
101
101
  }
102
102
  }
103
103
  }
104
104
  ```
105
105
 
106
- Windows 若找不到 `pnpm`,可将 `command` 改为 `pnpm.cmd` 绝对路径;无 pnpm 时只能直接 `npx -y @ada-mcp/mcp-server@0.1.17`(无 launcher 拉包测速)。
106
+ Windows 若找不到 `pnpm`,可将 `command` 改为 `pnpm.cmd` 绝对路径;无 pnpm 时只能直接 `npx -y @ada-mcp/mcp-server@0.1.18`(无 launcher 拉包测速)。
107
107
 
108
108
  ## Remote mode
109
109
 
package/dist/cli.cjs CHANGED
@@ -3671,7 +3671,132 @@ function playwrightInstallPackageSpec() {
3671
3671
  return `playwright@${fromEnv || PINNED_PLAYWRIGHT_VERSION}`;
3672
3672
  }
3673
3673
  function resolveInstallPackageSpecs(packages) {
3674
- return packages.map((pkg) => pkg === "playwright" ? playwrightInstallPackageSpec() : pkg);
3674
+ const out = [];
3675
+ for (const pkg of packages) {
3676
+ if (pkg === "playwright") {
3677
+ out.push(playwrightInstallPackageSpec());
3678
+ continue;
3679
+ }
3680
+ if (pkg === "zod") {
3681
+ const fromEnv = process.env.ADA_ZOD_VERSION?.trim();
3682
+ out.push(`zod@${fromEnv || PINNED_ZOD_VERSION}`);
3683
+ continue;
3684
+ }
3685
+ out.push(pkg);
3686
+ }
3687
+ return out;
3688
+ }
3689
+ function skipConflictRemoval() {
3690
+ const v = process.env.ADA_DEPS_SKIP_CONFLICT_REMOVAL?.trim().toLowerCase();
3691
+ return v === "1" || v === "true" || v === "yes";
3692
+ }
3693
+ function readInstalledPackageVersion(packageName) {
3694
+ try {
3695
+ const pkgPath = require2.resolve(`${packageName}/package.json`);
3696
+ const raw = (0, import_node_fs.readFileSync)(pkgPath, "utf8");
3697
+ return String(JSON.parse(raw).version ?? "").trim() || void 0;
3698
+ } catch {
3699
+ return void 0;
3700
+ }
3701
+ }
3702
+ function zodExportsV3Subpath(version2) {
3703
+ try {
3704
+ const pkgPath = require2.resolve("zod/package.json");
3705
+ const raw = (0, import_node_fs.readFileSync)(pkgPath, "utf8");
3706
+ const exportsField = JSON.parse(raw).exports;
3707
+ if (exportsField && "./v3" in exportsField) {
3708
+ return true;
3709
+ }
3710
+ } catch {
3711
+ }
3712
+ const major = Number(version2.split(".")[0]);
3713
+ const minor = Number(version2.split(".")[1]);
3714
+ if (major > 3) {
3715
+ return true;
3716
+ }
3717
+ return major === 3 && minor >= 25;
3718
+ }
3719
+ function detectWorkspacePackageConflicts(packages) {
3720
+ const conflicts = [];
3721
+ const expectedPlaywright = process.env.ADA_PLAYWRIGHT_VERSION?.trim() || PINNED_PLAYWRIGHT_VERSION;
3722
+ const expectedZod = process.env.ADA_ZOD_VERSION?.trim() || PINNED_ZOD_VERSION;
3723
+ if (packages.includes("playwright") && hasPackage("playwright")) {
3724
+ const installed = readInstalledPackageVersion("playwright");
3725
+ if (installed && installed !== expectedPlaywright) {
3726
+ conflicts.push({
3727
+ name: "playwright",
3728
+ installed,
3729
+ expected: expectedPlaywright,
3730
+ reason: "\u4E0E ADA \u9501\u5B9A\u7684 Playwright \u6D4F\u89C8\u5668\u5305\u7248\u672C\u4E0D\u4E00\u81F4"
3731
+ });
3732
+ }
3733
+ }
3734
+ if (hasPackage("@modelcontextprotocol/sdk") && hasPackage("zod")) {
3735
+ const zodVer = readInstalledPackageVersion("zod");
3736
+ if (zodVer && !zodExportsV3Subpath(zodVer)) {
3737
+ conflicts.push({
3738
+ name: "zod",
3739
+ installed: zodVer,
3740
+ expected: expectedZod,
3741
+ reason: "\u5F53\u524D zod \u4E0D\u652F\u6301 zod/v3\uFF0C\u4E0E @modelcontextprotocol/sdk \u51B2\u7A81"
3742
+ });
3743
+ }
3744
+ }
3745
+ return conflicts;
3746
+ }
3747
+ function packagesToRemoveForConflicts(conflicts) {
3748
+ const names = /* @__PURE__ */ new Set();
3749
+ for (const c of conflicts) {
3750
+ names.add(c.name);
3751
+ if (c.name === "playwright") {
3752
+ names.add("playwright-core");
3753
+ }
3754
+ }
3755
+ return Array.from(names);
3756
+ }
3757
+ async function removeWorkspacePackages(names, onLogLine) {
3758
+ const unique = Array.from(new Set(names)).filter(Boolean);
3759
+ if (unique.length === 0) {
3760
+ return true;
3761
+ }
3762
+ const timeoutMs = installStrategyTimeoutMs();
3763
+ const attempts = [
3764
+ { tool: "pnpm", args: ["remove", ...unique] },
3765
+ { tool: "npm", args: ["uninstall", ...unique] }
3766
+ ];
3767
+ for (const { tool, args } of attempts) {
3768
+ try {
3769
+ await runCommand2(tool, args, { timeoutMs, onLogLine });
3770
+ return true;
3771
+ } catch {
3772
+ }
3773
+ }
3774
+ return false;
3775
+ }
3776
+ async function reconcileWorkspacePackageConflicts(packages, onLogLine) {
3777
+ if (skipConflictRemoval()) {
3778
+ return [];
3779
+ }
3780
+ const conflicts = detectWorkspacePackageConflicts(packages);
3781
+ if (conflicts.length === 0) {
3782
+ return [];
3783
+ }
3784
+ for (const c of conflicts) {
3785
+ onLogLine?.(`[deps] \u68C0\u6D4B\u5230\u51B2\u7A81 ${c.name}@${c.installed}\uFF0C\u76EE\u6807 ${c.expected}\uFF08${c.reason}\uFF09`);
3786
+ }
3787
+ const toRemove = packagesToRemoveForConflicts(conflicts);
3788
+ onLogLine?.(`[deps] \u6B63\u5728\u5378\u8F7D: ${toRemove.join(", ")}`);
3789
+ const removed = await removeWorkspacePackages(toRemove, onLogLine);
3790
+ if (!removed) {
3791
+ onLogLine?.("[deps][warn] \u81EA\u52A8\u5378\u8F7D\u672A\u5B8C\u6210\uFF0C\u8BF7\u624B\u52A8\u6267\u884C: pnpm remove " + toRemove.join(" "));
3792
+ } else {
3793
+ onLogLine?.("[deps] \u51B2\u7A81\u5305\u5DF2\u5378\u8F7D\uFF0C\u5C06\u5B89\u88C5\u9501\u5B9A\u7248\u672C");
3794
+ }
3795
+ const extraInstall = [];
3796
+ if (conflicts.some((c) => c.name === "zod") && hasPackage("@modelcontextprotocol/sdk")) {
3797
+ extraInstall.push("zod");
3798
+ }
3799
+ return extraInstall;
3675
3800
  }
3676
3801
  function shouldUseShell(command) {
3677
3802
  if (process.platform !== "win32") {
@@ -4236,7 +4361,9 @@ async function rankPlaywrightHosts(config2) {
4236
4361
  return ranked.length > 0 ? ranked : [...candidates];
4237
4362
  }
4238
4363
  async function runInstallWithPriority(config2, packages, onLogLine) {
4239
- const specs = resolveInstallPackageSpecs(packages);
4364
+ const extraFromReconcile = await reconcileWorkspacePackageConflicts(packages, onLogLine);
4365
+ const allPackages = Array.from(/* @__PURE__ */ new Set([...packages, ...extraFromReconcile]));
4366
+ const specs = resolveInstallPackageSpecs(allPackages);
4240
4367
  const npmProxy = await detectBestRegistry(config2, npmProxyRegistry());
4241
4368
  const pnpmProxy = await detectBestRegistry(config2, pnpmProxyRegistry());
4242
4369
  progress("packages.install.start", { packages: specs, npmProxy, pnpmProxy });
@@ -4925,7 +5052,7 @@ async function getDependencyHealth(config2) {
4925
5052
  missingAppiumDrivers
4926
5053
  };
4927
5054
  }
4928
- var import_node_module, import_node_fs, import_node_child_process2, import_promises5, import_node_path5, require2, PINNED_PLAYWRIGHT_VERSION, depsHumanLog, DEFAULT_NPM_REGISTRY_CANDIDATES, detectedBestRegistryByKey, PROGRESS_STEPS, PROGRESS_HUMAN_LABELS, DEFAULT_PLAYWRIGHT_HOST_CANDIDATES, PLAYWRIGHT_HOST_FALLBACK, PW_INSTALL_TARGETS;
5055
+ var import_node_module, import_node_fs, import_node_child_process2, import_promises5, import_node_path5, require2, PINNED_PLAYWRIGHT_VERSION, PINNED_ZOD_VERSION, depsHumanLog, DEFAULT_NPM_REGISTRY_CANDIDATES, detectedBestRegistryByKey, PROGRESS_STEPS, PROGRESS_HUMAN_LABELS, DEFAULT_PLAYWRIGHT_HOST_CANDIDATES, PLAYWRIGHT_HOST_FALLBACK, PW_INSTALL_TARGETS;
4929
5056
  var init_dependency_installer = __esm({
4930
5057
  "../ada-agent/src/dependency-installer.ts"() {
4931
5058
  import_node_module = require("node:module");
@@ -4938,6 +5065,7 @@ var init_dependency_installer = __esm({
4938
5065
  init_src2();
4939
5066
  require2 = (0, import_node_module.createRequire)(import_node_path5.default.join(process.cwd(), "package.json"));
4940
5067
  PINNED_PLAYWRIGHT_VERSION = "1.59.1";
5068
+ PINNED_ZOD_VERSION = "3.25.76";
4941
5069
  DEFAULT_NPM_REGISTRY_CANDIDATES = [
4942
5070
  "https://registry.npmmirror.com",
4943
5071
  "https://mirrors.cloud.tencent.com/npm",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-mcp/mcp-server",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "ADA MCP server for web/mobile automation (stdio + remote HTTP)",
5
5
  "private": false,
6
6
  "type": "commonjs",