Skip to content

Commit ea3718a

Browse files
committed
Merge branch 'main' of github.com:SavioBS629/mcp-server into fix/PMAA-147-tcg-batch-limits
2 parents 5f37f10 + bdedc6a commit ea3718a

14 files changed

Lines changed: 1405 additions & 634 deletions

File tree

.github/workflows/mcp-ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request_review:
55
types: [submitted]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
test:
912
if: github.event.pull_request.base.ref == 'main' && github.event.review.state == 'approved'

.github/workflows/mcp-registry-publish.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ jobs:
3232

3333
- name: Install MCP Publisher
3434
run: |
35-
curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.3.3/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
36-
35+
curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.3.3/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
3736
- name: Login to MCP Registry
3837
run: ./mcp-publisher login github-oidc
3938

.github/workflows/npm-publish.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55

66
permissions:
77
contents: write
8+
id-token: write
89

910
jobs:
1011
publish:
@@ -99,7 +100,7 @@ jobs:
99100
run: git push origin ${{ steps.get_version.outputs.version }}
100101

101102
- name: "Publish to NPM"
102-
run: npm publish --access public
103+
run: npm publish --access public --provenance
103104
env:
104105
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
105106

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ Similar to the app testing, you can use the following prompts to test your **web
8585
Auto-analyze, diagnose, and even fix broken test scripts right in your IDE or LLM. Instantly fetch logs, identify root causes, and apply context-aware fixes. No more debugging loops.
8686
Below are few example prompts to run/debug/fix your automated tests on BrowserStack's [Test Platform](https://www.browserstack.com/test-platform).
8787

88+
> **Note:** When fetching Root Cause Analysis (RCA) for a test, the server returns the suggested fix as a proposal only. It never applies code changes automatically — your assistant must present the suggestion and wait for your explicit approval before editing any files.
89+
8890
```bash
8991
#Port test suite to BrowserStack
9092
"Setup test suite to run on BrowserStack infra"

package-lock.json

Lines changed: 1113 additions & 603 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.19",
3+
"version": "1.2.22",
44
"description": "BrowserStack's Official MCP Server",
55
"mcpName": "io.github.browserstack/mcp-server",
66
"main": "dist/index.js",

server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{
1212
"registryType": "npm",
1313
"identifier": "@browserstack/mcp-server",
14-
"version": "1.2.19",
14+
"version": "1.2.22",
1515
"transport": {
1616
"type": "stdio"
1717
},

src/lib/apiClient.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ function getAxiosAgent(): AxiosRequestConfig["httpsAgent"] | undefined {
7878
host: proxyHost,
7979
port: Number(proxyPort),
8080
ca,
81-
rejectUnauthorized: false, // Set to true if you want strict SSL
8281
});
8382
} else {
8483
// Proxy only
@@ -88,7 +87,6 @@ function getAxiosAgent(): AxiosRequestConfig["httpsAgent"] | undefined {
8887
// CA only
8988
return new https.Agent({
9089
ca: fs.readFileSync(caCertPath),
91-
rejectUnauthorized: false, // Set to true for strict SSL
9290
});
9391
}
9492
// Default agent (no proxy, no CA)

src/tools/rca-agent-utils/format-rca.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ export function formatRCAData(rcaData: any): string {
66

77
let output = "## Root Cause Analysis Report\n\n";
88

9+
// Track whether any test case carries a fix suggestion so we can append the
10+
// approval-gate directive only when it is relevant.
11+
let hasFixSuggestion = false;
12+
913
rcaData.testCases.forEach((testCase: any, index: number) => {
1014
// Show test case ID with smaller heading
1115
output += `### Test Case ${index + 1}\n`;
@@ -29,7 +33,8 @@ export function formatRCAData(rcaData: any): string {
2933
}
3034

3135
if (rca.possible_fix) {
32-
output += `**Recommended Fix:**\n${rca.possible_fix}\n\n`;
36+
hasFixSuggestion = true;
37+
output += `**Suggested Fix (proposal only — do not apply without explicit user approval):**\n${rca.possible_fix}\n\n`;
3338
}
3439
} else if (testCase.rcaData?.error) {
3540
output += `**Error:** ${testCase.rcaData.error}\n\n`;
@@ -40,5 +45,12 @@ export function formatRCAData(rcaData: any): string {
4045
output += "---\n\n";
4146
});
4247

48+
if (hasFixSuggestion) {
49+
output +=
50+
"> **Action required:** The fixes above are suggestions only. " +
51+
"Present them to the user and apply code changes ONLY after the user " +
52+
"explicitly approves. Do not modify any files automatically.\n";
53+
}
54+
4355
return output;
4456
}

src/tools/rca-agent.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,16 @@ export default function addRCATools(
144144

145145
tools.fetchRCA = server.tool(
146146
"fetchRCA",
147-
"Retrieves AI-RCA (Root Cause Analysis) data for a BrowserStack Automate and App-Automate session and provides insights into test failures.",
147+
"Fetch AI Root Cause Analysis for failed BrowserStack Automate/App-Automate tests. Suggests fixes only; never auto-apply, require explicit user approval.",
148148
FETCH_RCA_PARAMS,
149149
async (args) => {
150150
try {
151-
trackMCP("fetchRCA", server.server.getClientVersion()!, config);
151+
trackMCP(
152+
"fetchRCA",
153+
server.server.getClientVersion()!,
154+
undefined,
155+
config,
156+
);
152157
return await fetchRCADataTool(args, config);
153158
} catch (error) {
154159
return handleMCPError("fetchRCA", server, config, error);
@@ -162,7 +167,12 @@ export default function addRCATools(
162167
GET_BUILD_ID_PARAMS,
163168
async (args) => {
164169
try {
165-
trackMCP("getBuildId", server.server.getClientVersion()!, config);
170+
trackMCP(
171+
"getBuildId",
172+
server.server.getClientVersion()!,
173+
undefined,
174+
config,
175+
);
166176
return await getBuildIdTool(args, config);
167177
} catch (error) {
168178
return handleMCPError("getBuildId", server, config, error);
@@ -176,7 +186,12 @@ export default function addRCATools(
176186
LIST_TEST_IDS_PARAMS,
177187
async (args) => {
178188
try {
179-
trackMCP("listTestIds", server.server.getClientVersion()!, config);
189+
trackMCP(
190+
"listTestIds",
191+
server.server.getClientVersion()!,
192+
undefined,
193+
config,
194+
);
180195
return await listTestIdsTool(args, config);
181196
} catch (error) {
182197
return handleMCPError("listTestIds", server, config, error);

0 commit comments

Comments
 (0)