@wdio/mcp 3.2.0 → 3.2.2

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/lib/server.js CHANGED
@@ -46,7 +46,7 @@ var package_default = {
46
46
  type: "git",
47
47
  url: "git://github.com/webdriverio/mcp.git"
48
48
  },
49
- version: "3.1.1",
49
+ version: "3.2.1",
50
50
  description: "MCP server with WebdriverIO for browser and mobile app automation (iOS/Android via Appium)",
51
51
  main: "./lib/server.js",
52
52
  module: "./lib/server.js",
@@ -1200,7 +1200,9 @@ function shouldIncludeElement(element, filters, isNative, automationName) {
1200
1200
  visibleOnly = true
1201
1201
  } = filters;
1202
1202
  if (!matchesTagFilters(element, includeTagNames, excludeTagNames)) {
1203
- return false;
1203
+ if (element.attributes?.clickable !== "true") {
1204
+ return false;
1205
+ }
1204
1206
  }
1205
1207
  if (!matchesAttributeFilters(element, requireAttributes, minAttributeCount)) {
1206
1208
  return false;
@@ -3244,13 +3246,17 @@ var localAppiumProvider = new LocalAppiumProvider();
3244
3246
 
3245
3247
  // src/providers/cloud/browserstack.provider.ts
3246
3248
  import { promisify } from "util";
3249
+ import { tmpdir as tmpdir2 } from "os";
3250
+ import { join as join2 } from "path";
3247
3251
  import { Local as BrowserstackTunnel } from "browserstack-local";
3248
3252
  var BrowserStackProvider = class {
3249
3253
  name = "browserstack";
3250
- getConnectionConfig(_options) {
3254
+ getConnectionConfig(options) {
3255
+ const platform2 = options.platform;
3256
+ const hostname = platform2 === "browser" ? "hub.browserstack.com" : "hub-cloud.browserstack.com";
3251
3257
  return {
3252
3258
  protocol: "https",
3253
- hostname: "hub.browserstack.com",
3259
+ hostname,
3254
3260
  port: 443,
3255
3261
  path: "/wd/hub",
3256
3262
  user: process.env.BROWSERSTACK_USERNAME,
@@ -3316,9 +3322,10 @@ var BrowserStackProvider = class {
3316
3322
  const tunnel = new BrowserstackTunnel();
3317
3323
  const start = promisify(tunnel.start.bind(tunnel));
3318
3324
  try {
3319
- await start({ key });
3325
+ const logFile = join2(tmpdir2(), "browserstack-local.log");
3326
+ await start({ key, forceLocal: true, logFile });
3320
3327
  } catch (e) {
3321
- const msg = e instanceof Error ? e.message : String(e);
3328
+ const msg = (e !== null && typeof e === "object" ? e.message : void 0) ?? String(e);
3322
3329
  if (msg.includes("another browserstack local client is running") || msg.includes("server is listening on port")) {
3323
3330
  console.error("[BrowserStack] Tunnel already running \u2014 reusing existing tunnel");
3324
3331
  return null;
@@ -3477,7 +3484,7 @@ var startSessionToolDefinition = {
3477
3484
  port: z14.number().optional(),
3478
3485
  path: z14.string().optional()
3479
3486
  }).optional().describe("Appium server connection (local provider only)"),
3480
- browserstackLocal: coerceBoolean.optional().default(false).describe("Enable BrowserStack Local tunnel for testing against local/internal URLs (BrowserStack only, default: false). When true, the tunnel is started automatically before the session and stopped when the session is closed."),
3487
+ browserstackLocal: z14.union([coerceBoolean, z14.literal("external")]).optional().default(false).describe('Enable BrowserStack Local tunnel routing (BrowserStack only, default: false). true = auto-start tunnel before session and stop on close. "external" = tunnel already running externally, set local: true in capabilities only.'),
3481
3488
  navigationUrl: z14.string().optional().describe("URL to navigate to after starting"),
3482
3489
  capabilities: z14.record(z14.string(), z14.unknown()).optional().describe("Additional capabilities to merge")
3483
3490
  }
@@ -3563,7 +3570,7 @@ async function startBrowserSession(args) {
3563
3570
  windowHeight,
3564
3571
  capabilities: userCapabilities
3565
3572
  });
3566
- const tunnelHandle = args.browserstackLocal ? await provider.startTunnel?.(args) : void 0;
3573
+ const tunnelHandle = args.browserstackLocal === true ? await provider.startTunnel?.(args) : void 0;
3567
3574
  const wdioBrowser = await remote({ ...connectionConfig, capabilities: mergedCapabilities });
3568
3575
  const { sessionId } = wdioBrowser;
3569
3576
  const sessionMetadata = {
@@ -3613,7 +3620,7 @@ async function startMobileSession(args) {
3613
3620
  const provider = getProvider(args.provider ?? "local", args.platform);
3614
3621
  const serverConfig = provider.getConnectionConfig(args);
3615
3622
  const mergedCapabilities = provider.buildCapabilities(args);
3616
- const tunnelHandle = args.browserstackLocal ? await provider.startTunnel?.(args) : void 0;
3623
+ const tunnelHandle = args.browserstackLocal === true ? await provider.startTunnel?.(args) : void 0;
3617
3624
  const browser = await remote({ ...serverConfig, capabilities: mergedCapabilities });
3618
3625
  const { sessionId } = browser;
3619
3626
  const shouldAutoDetach = provider.shouldAutoDetach(args);