File tree Expand file tree Collapse file tree 7 files changed +61
-44
lines changed Expand file tree Collapse file tree 7 files changed +61
-44
lines changed Original file line number Diff line number Diff line change 11{
22 "name": "@browserstack/mcp-server",
3- "version": "1.2.5 ",
3+ "version": "1.2.6 ",
44 "description": "BrowserStack's Official MCP Server",
55 "mcpName": "io.github.browserstack/mcp-server",
66 "main": "dist/index.js",
Original file line number Diff line number Diff line change @@ -99,15 +99,6 @@ Alternative setup for Gradle users:
9999${ GRADLE_SETUP_INSTRUCTIONS } `;
100100}
101101
102- function getPythonSDKInstructions ( username : string , accessKey : string ) : string {
103- return `---STEP---
104- Install BrowserStack Python SDK and setup:
105- \`\`\`bash
106- pip install browserstack-sdk
107- browserstack-sdk setup --username "${ username } " --key "${ accessKey } "
108- \`\`\`` ;
109- }
110-
111102// Main function to get SDK setup commands based on language and framework
112103export function getSDKPrefixCommand (
113104 language : SDKSupportedLanguage ,
@@ -121,8 +112,7 @@ export function getSDKPrefixCommand(
121112
122113 case "java" :
123114 return getJavaSDKInstructions ( framework , username , accessKey ) ;
124- case "python" :
125- return getPythonSDKInstructions ( username , accessKey ) ;
115+
126116 default :
127117 return "" ;
128118 }
Original file line number Diff line number Diff line change 11import { ValidatedEnvironment } from "../common/device-validator.js";
2-
3- export function generateBrowserStackYMLInstructions ( config : {
4- validatedEnvironments ?: ValidatedEnvironment [ ] ;
5- platforms ?: string [ ] ;
6- enablePercy ?: boolean ;
7- projectName : string ;
8- } ) : string {
2+ import { BrowserStackConfig } from "../../../lib/types.js";
3+ import { getBrowserStackAuth } from "../../../lib/get-auth.js";
4+
5+ export function generateBrowserStackYMLInstructions(
6+ config: {
7+ validatedEnvironments?: ValidatedEnvironment[];
8+ platforms?: string[];
9+ enablePercy?: boolean;
10+ projectName: string;
11+ },
12+ browserStackConfig: BrowserStackConfig,
13+ ): string {
914 const enablePercy = config.enablePercy || false;
1015 const projectName = config.projectName || "BrowserStack Automate Build";
1116
17+ // Get credentials from config
18+ const authString = getBrowserStackAuth(browserStackConfig);
19+ const [username, accessKey] = authString.split(":");
20+
1221 // Generate platform configurations using the utility function
1322 const platformConfigs = generatePlatformConfigs(config);
1423
@@ -22,6 +31,9 @@ export function generateBrowserStackYMLInstructions(config: {
2231# BrowserStack Reporting
2332# ======================
2433
34+ userName: ${username}
35+ accessKey: ${accessKey}
36+
2537# TODO: Replace these sample values with your actual project details
2638projectName: ${projectName}
2739buildName: ${buildName}
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ browserstack-sdk pytest <path-to-test-directory>
3232};
3333
3434export const generatePythonFrameworkInstructions =
35- ( framework : string ) => ( ) => {
35+ (framework: string) => (username: string, accessKey: string ) => {
3636 const setup = `
3737---STEP---
3838
@@ -41,6 +41,13 @@ Install the BrowserStack SDK:
4141\`\`\`bash
4242python3 -m pip install browserstack-sdk
4343\`\`\`
44+
45+ ---STEP---
46+
47+ Setup the BrowserStack SDK with framework-specific configuration:
48+ \`\`\`bash
49+ browserstack-sdk setup --framework "${framework}" --username "${username}" --key "${accessKey}"
50+ \`\`\`
4451`;
4552
4653 const run = `
Original file line number Diff line number Diff line change @@ -86,20 +86,6 @@ export async function runBstackSDKOnly(
8686 });
8787 }
8888
89- const ymlInstructions = generateBrowserStackYMLInstructions({
90- validatedEnvironments,
91- enablePercy: false,
92- projectName: input.projectName,
93- });
94-
95- if (ymlInstructions) {
96- steps.push({
97- type: "instruction",
98- title: "Configure browserstack.yml",
99- content: ymlInstructions,
100- });
101- }
102-
10389 const frameworkInstructions = getInstructionsForProjectConfiguration(
10490 input.detectedBrowserAutomationFramework as SDKSupportedBrowserAutomationFramework,
10591 input.detectedTestingFramework as SDKSupportedTestingFramework,
@@ -116,7 +102,26 @@ export async function runBstackSDKOnly(
116102 content: frameworkInstructions.setup,
117103 });
118104 }
105+ }
119106
107+ const ymlInstructions = generateBrowserStackYMLInstructions(
108+ {
109+ validatedEnvironments,
110+ enablePercy: false,
111+ projectName: input.projectName,
112+ },
113+ config,
114+ );
115+
116+ if (ymlInstructions) {
117+ steps.push({
118+ type: "instruction",
119+ title: "Configure browserstack.yml",
120+ content: ymlInstructions,
121+ });
122+ }
123+
124+ if (frameworkInstructions) {
120125 if (frameworkInstructions.run && !isPercyAutomate) {
121126 steps.push({
122127 type: "instruction",
Original file line number Diff line number Diff line change @@ -106,14 +106,17 @@ export function runPercyWithBrowserstackSDK(
106106 });
107107 }
108108
109- const ymlInstructions = generateBrowserStackYMLInstructions({
110- platforms:
111- ((input as any).devices as string[][] | undefined)?.map((t) =>
112- t.join(" "),
113- ) || [],
114- enablePercy: true,
115- projectName: input.projectName,
116- });
109+ const ymlInstructions = generateBrowserStackYMLInstructions(
110+ {
111+ platforms:
112+ ((input as any).devices as string[][] | undefined)?.map((t) =>
113+ t.join(" "),
114+ ) || [],
115+ enablePercy: true,
116+ projectName: input.projectName,
117+ },
118+ config,
119+ );
117120
118121 if (ymlInstructions) {
119122 steps.push({
You can’t perform that action at this time.
0 commit comments