@browserstack/mcp-server 1.2.2 → 1.2.3-beta.1

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 (46) hide show
  1. package/README.md +225 -0
  2. package/dist/lib/instrumentation.js +2 -0
  3. package/dist/server-factory.js +1 -1
  4. package/dist/tools/accessibility.js +238 -78
  5. package/dist/tools/accessiblity-utils/auth-config.d.ts +39 -0
  6. package/dist/tools/accessiblity-utils/auth-config.js +125 -0
  7. package/dist/tools/accessiblity-utils/scanner.d.ts +1 -1
  8. package/dist/tools/accessiblity-utils/scanner.js +2 -1
  9. package/dist/tools/appautomate-utils/appium-sdk/config-generator.d.ts +1 -0
  10. package/dist/tools/appautomate-utils/appium-sdk/config-generator.js +50 -0
  11. package/dist/tools/appautomate-utils/appium-sdk/constants.d.ts +23 -0
  12. package/dist/tools/appautomate-utils/appium-sdk/constants.js +43 -0
  13. package/dist/tools/appautomate-utils/appium-sdk/formatter.d.ts +8 -0
  14. package/dist/tools/appautomate-utils/appium-sdk/formatter.js +59 -0
  15. package/dist/tools/appautomate-utils/appium-sdk/handler.d.ts +3 -0
  16. package/dist/tools/appautomate-utils/appium-sdk/handler.js +52 -0
  17. package/dist/tools/appautomate-utils/appium-sdk/index.d.ts +7 -0
  18. package/dist/tools/appautomate-utils/appium-sdk/index.js +8 -0
  19. package/dist/tools/appautomate-utils/appium-sdk/instructions.d.ts +3 -0
  20. package/dist/tools/appautomate-utils/appium-sdk/instructions.js +47 -0
  21. package/dist/tools/appautomate-utils/appium-sdk/languages/csharp.d.ts +2 -0
  22. package/dist/tools/appautomate-utils/appium-sdk/languages/csharp.js +78 -0
  23. package/dist/tools/appautomate-utils/appium-sdk/languages/java.d.ts +8 -0
  24. package/dist/tools/appautomate-utils/appium-sdk/languages/java.js +87 -0
  25. package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.d.ts +3 -0
  26. package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.js +194 -0
  27. package/dist/tools/appautomate-utils/appium-sdk/languages/python.d.ts +3 -0
  28. package/dist/tools/appautomate-utils/appium-sdk/languages/python.js +76 -0
  29. package/dist/tools/appautomate-utils/appium-sdk/languages/ruby.d.ts +2 -0
  30. package/dist/tools/appautomate-utils/appium-sdk/languages/ruby.js +85 -0
  31. package/dist/tools/appautomate-utils/appium-sdk/types.d.ts +57 -0
  32. package/dist/tools/appautomate-utils/appium-sdk/types.js +61 -0
  33. package/dist/tools/appautomate-utils/appium-sdk/utils.d.ts +17 -0
  34. package/dist/tools/appautomate-utils/appium-sdk/utils.js +61 -0
  35. package/dist/tools/appautomate-utils/{appautomate.d.ts → native-execution/appautomate.d.ts} +1 -1
  36. package/dist/tools/appautomate-utils/{appautomate.js → native-execution/appautomate.js} +2 -2
  37. package/dist/tools/appautomate-utils/native-execution/constants.d.ts +10 -0
  38. package/dist/tools/appautomate-utils/native-execution/constants.js +36 -0
  39. package/dist/tools/appautomate-utils/native-execution/types.d.ts +19 -0
  40. package/dist/tools/appautomate-utils/{types.js → native-execution/types.js} +5 -1
  41. package/dist/tools/appautomate.js +25 -40
  42. package/dist/tools/sdk-utils/constants.js +10 -0
  43. package/package.json +1 -1
  44. package/dist/tools/appautomate-utils/types.d.ts +0 -5
  45. /package/dist/tools/{getFailureLogs.d.ts → get-failure-logs.d.ts} +0 -0
  46. /package/dist/tools/{getFailureLogs.js → get-failure-logs.js} +0 -0
@@ -4,14 +4,13 @@ import { getBrowserStackAuth } from "../lib/get-auth.js";
4
4
  import { trackMCP } from "../lib/instrumentation.js";
5
5
  import { maybeCompressBase64 } from "../lib/utils.js";
6
6
  import { remote } from "webdriverio";
7
- import { AppTestPlatform } from "./appautomate-utils/types.js";
7
+ import { AppTestPlatform } from "./appautomate-utils/native-execution/types.js";
8
+ import { setupAppAutomateHandler } from "./appautomate-utils/appium-sdk/handler.js";
9
+ import { SETUP_APP_AUTOMATE_DESCRIPTION, SETUP_APP_AUTOMATE_SCHEMA, } from "./appautomate-utils/appium-sdk/constants.js";
10
+ import { Platform, } from "./appautomate-utils/native-execution/types.js";
8
11
  import { getDevicesAndBrowsers, BrowserStackProducts, } from "../lib/device-cache.js";
9
- import { findMatchingDevice, getDeviceVersions, resolveVersion, validateArgs, uploadApp, uploadEspressoApp, uploadEspressoTestSuite, triggerEspressoBuild, uploadXcuiApp, uploadXcuiTestSuite, triggerXcuiBuild, } from "./appautomate-utils/appautomate.js";
10
- var Platform;
11
- (function (Platform) {
12
- Platform["ANDROID"] = "android";
13
- Platform["IOS"] = "ios";
14
- })(Platform || (Platform = {}));
12
+ import { findMatchingDevice, getDeviceVersions, resolveVersion, validateArgs, uploadApp, uploadEspressoApp, uploadEspressoTestSuite, triggerEspressoBuild, uploadXcuiApp, uploadXcuiTestSuite, triggerXcuiBuild, } from "./appautomate-utils/native-execution/appautomate.js";
13
+ import { RUN_APP_AUTOMATE_DESCRIPTION, RUN_APP_AUTOMATE_SCHEMA, } from "./appautomate-utils/native-execution/constants.js";
15
14
  /**
16
15
  * Launches an app on a selected BrowserStack device and takes a screenshot.
17
16
  */
@@ -214,39 +213,7 @@ export default function addAppAutomationTools(server, config) {
214
213
  };
215
214
  }
216
215
  });
217
- tools.runAppTestsOnBrowserStack = server.tool("runAppTestsOnBrowserStack", "Run AppAutomate tests on BrowserStack by uploading app and test suite. If running from Android Studio or Xcode, the tool will help export app and test files automatically. For other environments, you'll need to provide the paths to your pre-built app and test files.", {
218
- appPath: z
219
- .string()
220
- .describe("Path to your application file:\n" +
221
- "If in development IDE directory:\n" +
222
- "• For Android: 'gradle assembleDebug'\n" +
223
- "• For iOS:\n" +
224
- " xcodebuild clean -scheme YOUR_SCHEME && \\\n" +
225
- " xcodebuild archive -scheme YOUR_SCHEME -configuration Release -archivePath build/app.xcarchive && \\\n" +
226
- " xcodebuild -exportArchive -archivePath build/app.xcarchive -exportPath build/ipa -exportOptionsPlist exportOptions.plist\n\n" +
227
- "If in other directory, provide existing app path"),
228
- testSuitePath: z
229
- .string()
230
- .describe("Path to your test suite file:\n" +
231
- "If in development IDE directory:\n" +
232
- "• For Android: 'gradle assembleAndroidTest'\n" +
233
- "• For iOS:\n" +
234
- " xcodebuild test-without-building -scheme YOUR_SCHEME -destination 'generic/platform=iOS' && \\\n" +
235
- " cd ~/Library/Developer/Xcode/DerivedData/*/Build/Products/Debug-iphonesimulator/ && \\\n" +
236
- " zip -r Tests.zip *.xctestrun *-Runner.app\n\n" +
237
- "If in other directory, provide existing test file path"),
238
- devices: z
239
- .array(z.string())
240
- .describe("List of devices to run the test on, e.g., ['Samsung Galaxy S20-10.0', 'iPhone 12 Pro-16.0']."),
241
- project: z
242
- .string()
243
- .optional()
244
- .default("BStack-AppAutomate-Suite")
245
- .describe("Project name for organizing test runs on BrowserStack."),
246
- detectedAutomationFramework: z
247
- .string()
248
- .describe("The automation framework used in the project, such as 'espresso' (Android) or 'xcuitest' (iOS)."),
249
- }, async (args) => {
216
+ tools.runAppTestsOnBrowserStack = server.tool("runAppTestsOnBrowserStack", RUN_APP_AUTOMATE_DESCRIPTION, RUN_APP_AUTOMATE_SCHEMA, async (args) => {
250
217
  try {
251
218
  trackMCP("runAppTestsOnBrowserStack", server.server.getClientVersion(), undefined, config);
252
219
  return await runAppTestsOnBrowserStack(args, config);
@@ -265,5 +232,23 @@ export default function addAppAutomationTools(server, config) {
265
232
  };
266
233
  }
267
234
  });
235
+ tools.setupBrowserStackAppAutomateTests = server.tool("setupBrowserStackAppAutomateTests", SETUP_APP_AUTOMATE_DESCRIPTION, SETUP_APP_AUTOMATE_SCHEMA, async (args) => {
236
+ try {
237
+ return await setupAppAutomateHandler(args, config);
238
+ }
239
+ catch (error) {
240
+ const error_message = error instanceof Error ? error.message : "Unknown error";
241
+ return {
242
+ content: [
243
+ {
244
+ type: "text",
245
+ text: `Failed to bootstrap project with BrowserStack App Automate SDK. Error: ${error_message}. Please open an issue on GitHub if the problem persists`,
246
+ isError: true,
247
+ },
248
+ ],
249
+ isError: true,
250
+ };
251
+ }
252
+ });
268
253
  return tools;
269
254
  }
@@ -311,6 +311,12 @@ Add new scripts to package.json for running tests on BrowserStack:
311
311
  }
312
312
  \`\`\`
313
313
 
314
+ Example :
315
+ \`\`\`json
316
+ "scripts": {
317
+ "test:browserstack": "npx browserstack-node-sdk playwright test"
318
+ }
319
+ \`\`\`
314
320
  ---STEP---
315
321
 
316
322
  Export BrowserStack credentials as environment variables:
@@ -319,6 +325,10 @@ Set the following environment variables before running tests.
319
325
  export BROWSERSTACK_USERNAME=${username}
320
326
  export BROWSERSTACK_ACCESS_KEY=${accessKey}
321
327
  \`\`\`
328
+
329
+ ---STEP---
330
+ Run your tests:
331
+ You can now run your tests on BrowserStack using your standard command or Use the commands defined in your package.json file to run the tests.
322
332
  `;
323
333
  /**
324
334
  * ---------- EXPORT CONFIG ----------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserstack/mcp-server",
3
- "version": "1.2.2",
3
+ "version": "1.2.3-beta.1",
4
4
  "description": "BrowserStack's Official MCP Server",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -1,5 +0,0 @@
1
- export declare enum AppTestPlatform {
2
- ESPRESSO = "espresso",
3
- APPIUM = "appium",
4
- XCUITEST = "xcuitest"
5
- }