@browserstack/mcp-server 1.4.0-beta.3 → 1.4.0
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 +43 -29
- package/dist/lib/constants.d.ts +3 -0
- package/dist/lib/constants.js +3 -0
- package/dist/lib/untrusted-content.d.ts +15 -0
- package/dist/lib/untrusted-content.js +24 -0
- package/dist/lib/version-resolver.d.ts +0 -5
- package/dist/lib/version-resolver.js +8 -2
- package/dist/logger.js +1 -10
- package/dist/tools/accessibility.js +4 -3
- package/dist/tools/accessiblity-utils/accessibility-rag.js +3 -1
- package/dist/tools/automate-utils/list-session-ids.d.ts +28 -0
- package/dist/tools/automate-utils/list-session-ids.js +87 -0
- package/dist/tools/automate-utils/resolve-hashed-build-id.d.ts +30 -0
- package/dist/tools/automate-utils/resolve-hashed-build-id.js +124 -0
- package/dist/tools/automate.d.ts +7 -0
- package/dist/tools/automate.js +104 -1
- package/dist/tools/build-insights.js +40 -1
- package/dist/tools/failurelogs-utils/app-automate.js +4 -3
- package/dist/tools/failurelogs-utils/automate.js +5 -4
- package/dist/tools/failurelogs-utils/resolve-app-build-id.d.ts +2 -0
- package/dist/tools/failurelogs-utils/resolve-app-build-id.js +5 -0
- package/dist/tools/failurelogs-utils/video.d.ts +3 -0
- package/dist/tools/failurelogs-utils/video.js +25 -0
- package/dist/tools/get-failure-logs.js +28 -11
- package/dist/tools/observability.js +3 -1
- package/dist/tools/rca-agent-utils/format-rca.js +5 -4
- package/dist/tools/rca-agent-utils/get-failed-test-id.js +12 -0
- package/dist/tools/rca-agent-utils/types.d.ts +1 -0
- package/dist/tools/rca-agent.js +1 -1
- package/dist/tools/review-agent.js +2 -1
- package/dist/tools/sdk-utils/common/constants.d.ts +1 -1
- package/dist/tools/sdk-utils/common/constants.js +2 -1
- package/dist/tools/selfheal.js +1 -1
- package/dist/tools/testmanagement-utils/testcase-from-file.js +2 -1
- package/dist/tools/testmanagement-utils/upload-file.js +16 -2
- package/dist/tools/tool-handoff.d.ts +5 -1
- package/dist/tools/tool-handoff.js +7 -4
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { wrapUntrusted } from "../lib/untrusted-content.js";
|
|
1
2
|
import { getBrowserStackAuth } from "../lib/get-auth.js";
|
|
2
3
|
import { getPercyBuildCount } from "./review-agent-utils/build-counts.js";
|
|
3
4
|
import { getChangedPercySnapshotIds } from "./review-agent-utils/percy-snapshots.js";
|
|
@@ -50,7 +51,7 @@ export async function fetchPercyChanges(args, config) {
|
|
|
50
51
|
return {
|
|
51
52
|
content: allDiffs.map((diff) => ({
|
|
52
53
|
type: "text",
|
|
53
|
-
text: `${diff.name} → ${diff.title}: ${diff.description ?? ""}
|
|
54
|
+
text: wrapUntrusted("Percy AI visual-diff description", `${diff.name} → ${diff.title}: ${diff.description ?? ""}`),
|
|
54
55
|
})),
|
|
55
56
|
};
|
|
56
57
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const IMPORTANT_SETUP_WARNING
|
|
1
|
+
export declare const IMPORTANT_SETUP_WARNING: string;
|
|
2
2
|
export declare const SETUP_PERCY_DESCRIPTION = "Set up or expand Percy visual testing configuration with comprehensive coverage for existing projects that might have Percy integrated. This supports both Percy Web Standalone and Percy Automate. Example prompts: Expand percy coverage for this project {project_name}";
|
|
3
3
|
export declare const LIST_TEST_FILES_DESCRIPTION = "Lists all test files for a given set of directories.";
|
|
4
4
|
export declare const PERCY_SNAPSHOT_COMMANDS_DESCRIPTION = "Adds Percy snapshot commands to the specified test files.";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export const IMPORTANT_SETUP_WARNING = "IMPORTANT: DO NOT SKIP ANY STEP. All the setup steps described below MUST be executed regardless of any existing configuration or setup. This ensures proper BrowserStack SDK setup."
|
|
1
|
+
export const IMPORTANT_SETUP_WARNING = "IMPORTANT: DO NOT SKIP ANY STEP. All the setup steps described below MUST be executed regardless of any existing configuration or setup. This ensures proper BrowserStack SDK setup. " +
|
|
2
|
+
"If you cannot run commands or edit files in the user's project (e.g. a chat-only client), present every step below to the user in full — including each shell command, the package.json changes, and the complete browserstack.yml contents — instead of summarizing them.";
|
|
2
3
|
export const SETUP_PERCY_DESCRIPTION = "Set up or expand Percy visual testing configuration with comprehensive coverage for existing projects that might have Percy integrated. This supports both Percy Web Standalone and Percy Automate. Example prompts: Expand percy coverage for this project {project_name}";
|
|
3
4
|
export const LIST_TEST_FILES_DESCRIPTION = "Lists all test files for a given set of directories.";
|
|
4
5
|
export const PERCY_SNAPSHOT_COMMANDS_DESCRIPTION = "Adds Percy snapshot commands to the specified test files.";
|
package/dist/tools/selfheal.js
CHANGED
|
@@ -506,7 +506,7 @@ export default function addSelfHealTools(server, config) {
|
|
|
506
506
|
sessions: sessionsFieldSchema.describe("Sessions to plan edits for. See tool description for accepted shapes."),
|
|
507
507
|
}, {
|
|
508
508
|
title: "Prepare Self-Healing Plan",
|
|
509
|
-
readOnlyHint:
|
|
509
|
+
readOnlyHint: false,
|
|
510
510
|
openWorldHint: false,
|
|
511
511
|
destructiveHint: false,
|
|
512
512
|
idempotentHint: true,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { wrapUntrusted } from "../../lib/untrusted-content.js";
|
|
1
2
|
import { fetchFormFields, triggerTestCaseGeneration, pollScenariosTestDetails, bulkCreateTestCases, } from "./TCG-utils/api.js";
|
|
2
3
|
import { buildDefaultFieldMaps, findBooleanFieldId, } from "./TCG-utils/helpers.js";
|
|
3
4
|
import { signedUrlMap } from "../../lib/inmemory-store.js";
|
|
@@ -37,7 +38,7 @@ export async function createTestCasesFromFile(args, context, config) {
|
|
|
37
38
|
content: [
|
|
38
39
|
{
|
|
39
40
|
type: "text",
|
|
40
|
-
text: resultString,
|
|
41
|
+
text: wrapUntrusted("AI-generated test cases from the uploaded document", resultString),
|
|
41
42
|
},
|
|
42
43
|
{
|
|
43
44
|
type: "text",
|
|
@@ -19,16 +19,30 @@ export const UploadFileSchema = z.object({
|
|
|
19
19
|
.describe("ID of the project where the file should be uploaded. Do not assume it, always ask user for it."),
|
|
20
20
|
file_path: z
|
|
21
21
|
.string()
|
|
22
|
-
.describe("Full path to the file that should be uploaded"
|
|
22
|
+
.describe("Full path to the file that should be uploaded. Must be inside the " +
|
|
23
|
+
"directory configured via the MCP_UPLOAD_BASE_DIR environment variable."),
|
|
23
24
|
});
|
|
24
25
|
/**
|
|
25
26
|
* Uploads a file to BrowserStack Test Management and returns the signed URL.
|
|
26
27
|
*/
|
|
27
28
|
export async function uploadFile(args, config) {
|
|
28
29
|
const { project_identifier, file_path } = args;
|
|
30
|
+
if (!appConfig.UPLOAD_BASE_DIR) {
|
|
31
|
+
return {
|
|
32
|
+
content: [
|
|
33
|
+
{
|
|
34
|
+
type: "text",
|
|
35
|
+
text: "File upload is disabled. Set the MCP_UPLOAD_BASE_DIR environment " +
|
|
36
|
+
"variable to a directory that contains the files you want to upload, " +
|
|
37
|
+
"then restart the MCP server. Uploads are restricted to that directory.",
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
isError: true,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
29
43
|
try {
|
|
30
44
|
// Canonicalize path and enforce upload safety rules (extension, size,
|
|
31
|
-
// hidden-directory traversal,
|
|
45
|
+
// hidden-directory traversal, base-dir containment).
|
|
32
46
|
const safePath = validateUploadPath(file_path, {
|
|
33
47
|
allowedExtensions: TEST_MANAGEMENT_ATTACHMENT_EXTENSIONS,
|
|
34
48
|
maxSizeBytes: MAX_ATTACHMENT_UPLOAD_BYTES,
|
|
@@ -52,7 +52,11 @@ export declare const NEEDS_TEST_PLAN_ID: string;
|
|
|
52
52
|
export declare const PLAN_WRITES_VIA_AGENT: string;
|
|
53
53
|
/** A build id comes from either build-lookup tool. */
|
|
54
54
|
export declare const NEEDS_BUILD_ID: string;
|
|
55
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Session ids ARE listable now — PR #395 added `listSessions`, which merged into main while
|
|
57
|
+
* this branch was open. This used to send the model to askBrowserStackAI for want of a tool;
|
|
58
|
+
* pointing at the agent when a real tool exists is exactly what the header above forbids.
|
|
59
|
+
*/
|
|
56
60
|
export declare const NEEDS_SESSION_ID: string;
|
|
57
61
|
/** A completed scan's ids come from startAccessibilityScan, or from the agent. */
|
|
58
62
|
export declare const NEEDS_A11Y_SCAN_ID: string;
|
|
@@ -60,10 +60,13 @@ export const PLAN_WRITES_VIA_AGENT = " Creating a test plan or sub-plan, and lin
|
|
|
60
60
|
"want. It asks you to confirm before changing anything.";
|
|
61
61
|
/** A build id comes from either build-lookup tool. */
|
|
62
62
|
export const NEEDS_BUILD_ID = needsIdFrom("a BrowserStack build id", "getBuildId or listBuildId");
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Session ids ARE listable now — PR #395 added `listSessions`, which merged into main while
|
|
65
|
+
* this branch was open. This used to send the model to askBrowserStackAI for want of a tool;
|
|
66
|
+
* pointing at the agent when a real tool exists is exactly what the header above forbids.
|
|
67
|
+
*/
|
|
68
|
+
export const NEEDS_SESSION_ID = " Requires a session id. listSessions lists them for a build; if you do not have the " +
|
|
69
|
+
"build either, getBuildId or listBuildId resolves one from a project and build name.";
|
|
67
70
|
/** A completed scan's ids come from startAccessibilityScan, or from the agent. */
|
|
68
71
|
export const NEEDS_A11Y_SCAN_ID = " Requires the ids of a completed scan, which are returned by startAccessibilityScan. " +
|
|
69
72
|
"No tool here lists past scans, so if you do not have the ids, start a new scan rather " +
|