@browserstack/mcp-server 1.2.11-beta.1 → 1.2.11-beta.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.
@@ -22,17 +22,27 @@ export class AccessibilityReportFetcher {
22
22
  throw new Error(`Failed to initiate report: ${initData.error || initData.data.message}`);
23
23
  }
24
24
  const taskId = initData.data.task_id;
25
- // Fetch the generated CSV link
25
+ // Poll for the generated CSV link (task is async, may take a few seconds)
26
26
  const reportUrl = `https://api-accessibility.browserstack.com/api/website-scanner/v1/scans/${scanId}/scan_runs/issues?task_id=${encodeURIComponent(taskId)}`;
27
- // Use apiClient for the report link request as well
28
- const reportResp = await apiClient.get({
29
- url: reportUrl,
30
- headers: basicAuthHeader ? { Authorization: basicAuthHeader } : undefined,
31
- });
32
- const reportData = reportResp.data;
33
- if (!reportData.success) {
34
- throw new Error(`Failed to fetch report: ${reportData.error}`);
27
+ const maxAttempts = 3;
28
+ const pollIntervalMs = 2000;
29
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
30
+ const reportResp = await apiClient.get({
31
+ url: reportUrl,
32
+ headers: basicAuthHeader
33
+ ? { Authorization: basicAuthHeader }
34
+ : undefined,
35
+ });
36
+ const reportData = reportResp.data;
37
+ if (!reportData.success) {
38
+ throw new Error(`Failed to fetch report: ${reportData.error}`);
39
+ }
40
+ const link = reportData.data?.reportLink;
41
+ if (link) {
42
+ return link;
43
+ }
44
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
35
45
  }
36
- return reportData.data.reportLink;
46
+ throw new Error(`Report link was not available after ${maxAttempts} attempts. The CSV generation may still be in progress.`);
37
47
  }
38
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserstack/mcp-server",
3
- "version": "1.2.11-beta.1",
3
+ "version": "1.2.11-beta.2",
4
4
  "description": "BrowserStack's Official MCP Server",
5
5
  "mcpName": "io.github.browserstack/mcp-server",
6
6
  "main": "dist/index.js",