@ada-mcp/mcp-server 0.1.23 → 0.1.25

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/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.19`** 拉起本包(见 [launcher README](../ada-mcp-launcher/README.md)):
11
+ 请使用 **`@ada-mcp/launcher@0.1.24`** 拉起本包(见 [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.19"]
18
+ "args": ["dlx", "@ada-mcp/launcher@0.1.24"]
19
19
  }
20
20
  }
21
21
  }
22
22
  ```
23
23
 
24
- 本包版本:**`@ada-mcp/mcp-server@0.1.19`**(由 launcher 默认拉取;依赖锁定 `playwright@1.59.1`)。
24
+ 本包版本:**`@ada-mcp/mcp-server@0.1.24`**(由 launcher 默认拉取;依赖锁定 `playwright@1.59.1`)。
25
25
 
26
26
  直接调试本包(无 launcher 拉包前测速):
27
27
 
28
28
  ```bash
29
- pnpm dlx @ada-mcp/mcp-server@0.1.19
29
+ pnpm dlx @ada-mcp/mcp-server@0.1.24
30
30
  # npx 等价:
31
- npx -y @ada-mcp/mcp-server@0.1.19
31
+ npx -y @ada-mcp/mcp-server@0.1.24
32
32
  ```
33
33
 
34
34
  ## 启动时自动安装依赖(默认仅 Playwright)
@@ -51,7 +51,7 @@ npx -y @ada-mcp/mcp-server@0.1.19
51
51
  - `ADA_MCP_SKIP_INSTALL_DEPS=1`:跳过自动安装
52
52
  - `ADA_MCP_INSTALL_DEPS_FORCE=1`:强制重装
53
53
  - `ADA_MCP_GECKODRIVER_VERSION` / `ADA_MCP_CHROMEDRIVER_VERSION`:Selenium 驱动版本
54
- - `ADA_PLAYWRIGHT_INSTALL_TIMEOUT_MS`:浏览器下载超时(默认 15 分钟)
54
+ - `ADA_PLAYWRIGHT_INSTALL_TIMEOUT_MS`:浏览器下载超时(默认 30 分钟 / 1800000ms)
55
55
  - `ADA_INSTALL_STRATEGY_TIMEOUT_MS`:npm 装包超时(默认 2 分钟)
56
56
 
57
57
  ## 代理与镜像(`0.1.10+` 推荐)
@@ -83,27 +83,27 @@ npx -y @ada-mcp/mcp-server@0.1.19
83
83
  在标准 `args` 后追加,例如安装全部依赖:
84
84
 
85
85
  ```json
86
- "args": ["dlx", "@ada-mcp/launcher@0.1.19", "--install-deps=all"]
86
+ "args": ["dlx", "@ada-mcp/launcher@0.1.24", "--install-deps=all"]
87
87
  ```
88
88
 
89
89
  ## Cursor MCP 配置
90
90
 
91
- **pnpm(推荐)**:`pnpm` + `dlx @ada-mcp/launcher@0.1.19`
91
+ **pnpm(推荐)**:`pnpm` + `dlx @ada-mcp/launcher@0.1.24`
92
92
 
93
- **npx 等价**(`launcher@0.1.7+`):`npx` + `-y @ada-mcp/launcher@0.1.19`(内层同样 `npx -y` mcp-server,测速逻辑与 pnpm 一致)
93
+ **npx 等价**(`launcher@0.1.7+`):`npx` + `-y @ada-mcp/launcher@0.1.24`(内层同样 `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.19"]
100
+ "args": ["-y", "@ada-mcp/launcher@0.1.24"]
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.19`(无 launcher 拉包测速)。
106
+ Windows 若找不到 `pnpm`,可将 `command` 改为 `pnpm.cmd` 绝对路径;无 pnpm 时只能直接 `npx -y @ada-mcp/mcp-server@0.1.24`(无 launcher 拉包测速)。
107
107
 
108
108
  ## Remote mode
109
109
 
package/dist/cli.cjs CHANGED
@@ -3556,7 +3556,7 @@ async function downloadGeckodriver(driversDir, versionInput, onLogLine) {
3556
3556
  downloaded = true;
3557
3557
  } catch (mirrorError) {
3558
3558
  onLogLine?.(
3559
- `[selenium][warn] ?????????: ${mirrorError instanceof Error ? mirrorError.message : String(mirrorError)}`
3559
+ `[selenium][warn] ??????: ${mirrorError instanceof Error ? mirrorError.message : String(mirrorError)}`
3560
3560
  );
3561
3561
  onLogLine?.(`[selenium] ?? GitHub: ${github}`);
3562
3562
  await downloadToFile(github, archivePath);
@@ -3756,8 +3756,8 @@ var init_src2 = __esm({
3756
3756
  {
3757
3757
  browser: "Firefox",
3758
3758
  platforms: "Windows/Linux/macOS",
3759
- vendor: "Mozilla / ?????",
3760
- url: `${DEFAULT_GECKODRIVER_MIRROR}/v0.36.0/?????????????? ${GITHUB_GECKODRIVER_RELEASES}?`
3759
+ vendor: "Mozilla",
3760
+ url: `${DEFAULT_GECKODRIVER_MIRROR}/v0.36.0/????????? ${GITHUB_GECKODRIVER_RELEASES}`
3761
3761
  },
3762
3762
  {
3763
3763
  browser: "Edge",
@@ -5578,15 +5578,60 @@ function isPluginModule(mod) {
5578
5578
  const m = mod.manifest;
5579
5579
  return !!m && typeof m.id === "string" && Array.isArray(m.platforms);
5580
5580
  }
5581
+ function entryScriptDir() {
5582
+ const argv1 = process.argv[1]?.trim();
5583
+ if (!argv1) {
5584
+ return void 0;
5585
+ }
5586
+ try {
5587
+ return import_node_path6.default.dirname(import_node_path6.default.resolve(argv1));
5588
+ } catch {
5589
+ return void 0;
5590
+ }
5591
+ }
5581
5592
  function resolvePluginDirs(explicitPluginDir) {
5582
- const fromEnv = process.env.ADA_PLUGIN_DIR?.trim();
5583
- const execDir = import_node_path6.default.dirname(process.execPath);
5593
+ const ordered = [];
5594
+ const push = (dir) => {
5595
+ const trimmed = dir?.trim();
5596
+ if (!trimmed) {
5597
+ return;
5598
+ }
5599
+ ordered.push(import_node_path6.default.resolve(trimmed));
5600
+ };
5601
+ push(explicitPluginDir);
5602
+ push(process.env.ADA_PLUGIN_DIR);
5603
+ const entryDir = entryScriptDir();
5604
+ if (entryDir) {
5605
+ push(import_node_path6.default.join(entryDir, "plugins"));
5606
+ push(import_node_path6.default.join(entryDir, "..", "plugins"));
5607
+ }
5608
+ if (typeof __filename === "string") {
5609
+ const fromModule = import_node_path6.default.dirname(__filename);
5610
+ push(import_node_path6.default.join(fromModule, "plugins"));
5611
+ push(import_node_path6.default.join(fromModule, "..", "plugins"));
5612
+ }
5613
+ const initCwd = process.env.INIT_CWD?.trim();
5614
+ if (initCwd) {
5615
+ push(import_node_path6.default.join(initCwd, "plugins"));
5616
+ push(import_node_path6.default.join(initCwd, "release", "plugins"));
5617
+ }
5584
5618
  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
- );
5619
+ push(import_node_path6.default.join(cwd, "plugins"));
5620
+ push(import_node_path6.default.join(cwd, "release", "plugins"));
5621
+ const seen = /* @__PURE__ */ new Set();
5622
+ return ordered.filter((dir) => {
5623
+ if (seen.has(dir)) {
5624
+ return false;
5625
+ }
5626
+ seen.add(dir);
5627
+ return true;
5628
+ });
5629
+ }
5630
+ function pluginDirHasModules(pluginDir) {
5631
+ if (!import_node_fs2.default.existsSync(pluginDir)) {
5632
+ return false;
5633
+ }
5634
+ return import_node_fs2.default.readdirSync(pluginDir, { withFileTypes: true }).some((ent) => ent.isFile() && (ent.name.endsWith(".cjs") || ent.name.endsWith(".js")));
5590
5635
  }
5591
5636
  function loadPluginFromModule(requireFn, moduleId) {
5592
5637
  try {
@@ -5612,6 +5657,9 @@ function registerPluginsFromDirectory(host, pluginDir) {
5612
5657
  if (!plugin) {
5613
5658
  continue;
5614
5659
  }
5660
+ if (host.listManifests().some((m) => m.id === plugin.manifest.id)) {
5661
+ continue;
5662
+ }
5615
5663
  host.register(plugin);
5616
5664
  loaded.push(plugin.manifest);
5617
5665
  }
@@ -5631,12 +5679,14 @@ function registerPluginsFromModuleIds(host, moduleIds) {
5631
5679
  return loaded;
5632
5680
  }
5633
5681
  function registerRuntimePlugins(host, options) {
5634
- const manifests2 = [];
5635
5682
  for (const pluginDir of resolvePluginDirs(options?.pluginDir)) {
5636
- manifests2.push(...registerPluginsFromDirectory(host, pluginDir));
5637
- }
5638
- if (manifests2.length > 0) {
5639
- return manifests2;
5683
+ if (!pluginDirHasModules(pluginDir)) {
5684
+ continue;
5685
+ }
5686
+ const loaded = registerPluginsFromDirectory(host, pluginDir);
5687
+ if (loaded.length > 0) {
5688
+ return loaded;
5689
+ }
5640
5690
  }
5641
5691
  const fallbackModuleIds = options?.moduleIds?.length ? options.moduleIds : DEFAULT_PLUGIN_MODULE_IDS;
5642
5692
  return registerPluginsFromModuleIds(host, fallbackModuleIds);
@@ -18136,53 +18186,72 @@ var init_streamableHttp = __esm({
18136
18186
  });
18137
18187
 
18138
18188
  // src/executor.ts
18139
- function ensureBundledPluginDir() {
18140
- if (process.env.ADA_PLUGIN_DIR?.trim()) {
18141
- return;
18142
- }
18189
+ function resolveBundledPluginDir() {
18143
18190
  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 {
18191
+ const argv1 = process.argv[1]?.trim();
18192
+ if (argv1) {
18193
+ const entryDir = import_node_path11.default.dirname(import_node_path11.default.resolve(argv1));
18194
+ candidates.push(import_node_path11.default.join(entryDir, "plugins"));
18195
+ candidates.push(import_node_path11.default.join(entryDir, "..", "plugins"));
18148
18196
  }
18149
18197
  const dirname = globalThis.__dirname;
18150
18198
  if (typeof dirname === "string") {
18199
+ candidates.push(import_node_path11.default.join(dirname, "plugins"));
18151
18200
  candidates.push(import_node_path11.default.join(dirname, "..", "plugins"));
18152
18201
  }
18202
+ try {
18203
+ const here = import_node_path11.default.dirname((0, import_node_url3.fileURLToPath)(import_meta.url));
18204
+ candidates.push(import_node_path11.default.join(here, "plugins"));
18205
+ candidates.push(import_node_path11.default.join(here, "..", "plugins"));
18206
+ } catch {
18207
+ }
18208
+ const seen = /* @__PURE__ */ new Set();
18153
18209
  for (const dir of candidates) {
18154
- if ((0, import_node_fs4.existsSync)(dir)) {
18155
- process.env.ADA_PLUGIN_DIR = dir;
18156
- return;
18210
+ const resolved = import_node_path11.default.resolve(dir);
18211
+ if (seen.has(resolved) || !(0, import_node_fs4.existsSync)(resolved)) {
18212
+ continue;
18157
18213
  }
18214
+ seen.add(resolved);
18215
+ return resolved;
18158
18216
  }
18217
+ return void 0;
18159
18218
  }
18160
- function buildPluginHost2() {
18161
- ensureBundledPluginDir();
18219
+ function getPluginHost() {
18220
+ if (sharedHost) {
18221
+ return sharedHost;
18222
+ }
18223
+ const bundledDir = resolveBundledPluginDir();
18162
18224
  const host = new PluginHost();
18163
- registerRuntimePlugins(host);
18225
+ registerRuntimePlugins(host, bundledDir ? { pluginDir: bundledDir } : void 0);
18226
+ sharedHost = host;
18164
18227
  return host;
18165
18228
  }
18229
+ function getExecutor() {
18230
+ if (!sharedExecutor) {
18231
+ sharedExecutor = new TaskExecutor(getPluginHost());
18232
+ }
18233
+ return sharedExecutor;
18234
+ }
18166
18235
  async function runCommand3(command) {
18167
- return sharedExecutor.execute(command);
18236
+ return getExecutor().execute(command);
18168
18237
  }
18169
18238
  async function runTaskset2(commands) {
18170
18239
  const results = [];
18171
18240
  for (const command of commands) {
18172
- results.push(await sharedExecutor.execute(command));
18241
+ results.push(await runCommand3(command));
18173
18242
  }
18174
18243
  return results;
18175
18244
  }
18176
18245
  function listActiveSessions() {
18177
- return sharedExecutor.listSessions();
18246
+ return getExecutor().listSessions();
18178
18247
  }
18179
18248
  async function closeSession(platform, sessionId, options) {
18180
- return sharedExecutor.closeSession(platform, sessionId, options);
18249
+ return getExecutor().closeSession(platform, sessionId, options);
18181
18250
  }
18182
18251
  async function closeAllSessions() {
18183
- return sharedExecutor.closeAllSessions();
18252
+ return getExecutor().closeAllSessions();
18184
18253
  }
18185
- var import_node_fs4, import_node_path11, import_node_url3, import_meta, manifests, sharedExecutor;
18254
+ var import_node_fs4, import_node_path11, import_node_url3, import_meta, sharedHost, sharedExecutor;
18186
18255
  var init_executor = __esm({
18187
18256
  "src/executor.ts"() {
18188
18257
  "use strict";
@@ -18192,8 +18261,8 @@ var init_executor = __esm({
18192
18261
  init_src7();
18193
18262
  init_src4();
18194
18263
  import_meta = {};
18195
- manifests = registerRuntimePlugins(new PluginHost());
18196
- sharedExecutor = new TaskExecutor(buildPluginHost2());
18264
+ sharedHost = null;
18265
+ sharedExecutor = null;
18197
18266
  }
18198
18267
  });
18199
18268
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-mcp/mcp-server",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "ADA MCP server for web/mobile automation (stdio + remote HTTP)",
5
5
  "private": false,
6
6
  "type": "commonjs",
@@ -244,8 +244,8 @@ var SELENIUM_DRIVER_MANUAL_DOWNLOAD_REFERENCES = [
244
244
  {
245
245
  browser: "Firefox",
246
246
  platforms: "Windows/Linux/macOS",
247
- vendor: "Mozilla / ?????",
248
- url: `${DEFAULT_GECKODRIVER_MIRROR}/v0.36.0/?????????????? ${GITHUB_GECKODRIVER_RELEASES}?`
247
+ vendor: "Mozilla",
248
+ url: `${DEFAULT_GECKODRIVER_MIRROR}/v0.36.0/????????? ${GITHUB_GECKODRIVER_RELEASES}`
249
249
  },
250
250
  {
251
251
  browser: "Edge",