Skip to content

Commit 56f311c

Browse files
committed
chore: Bump version to 1.2.6 and refactor SDK setup instructions for improved clarity and functionality
1 parent fce92b2 commit 56f311c

File tree

7 files changed

+61
-44
lines changed

7 files changed

+61
-44
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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",

src/tools/sdk-utils/bstack/commands.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff 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
112103
export 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
}

src/tools/sdk-utils/bstack/configUtils.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
import { 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
2638
projectName: ${projectName}
2739
buildName: ${buildName}

src/tools/sdk-utils/bstack/constants.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ browserstack-sdk pytest <path-to-test-directory>
3232
};
3333

3434
export 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
4242
python3 -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 = `

src/tools/sdk-utils/bstack/sdkHandler.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff 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",

src/tools/sdk-utils/percy-bstack/handler.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff 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({

0 commit comments

Comments
 (0)