Skip to content

Commit bd44d18

Browse files
authored
Merge pull request #106 from ruturaj-browserstack/remote_mcp_response
Fix : Remote MCP live response
2 parents 6cc4bff + 8ef34b6 commit bd44d18

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,5 @@ process.on("exit", () => {
4848
logger.flush();
4949
});
5050

51-
5251
export { setLogger } from "./logger.js";
5352
export { BrowserStackMcpServer } from "./server-factory.js";

src/server-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class BrowserStackMcpServer {
8080
public getTools(): Record<string, RegisteredTool> {
8181
return this.tools;
8282
}
83-
83+
8484
public getTool(name: string): RegisteredTool | undefined {
8585
return this.tools[name];
8686
}

src/tools/live.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// File: src/tools/live.ts
21
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
32
import { z } from "zod";
43
import logger from "../logger.js";
54
import { startBrowserSession } from "./live-utils/start-session.js";
65
import { PlatformType } from "./live-utils/types.js";
76
import { trackMCP } from "../lib/instrumentation.js";
87
import { BrowserStackConfig } from "../lib/types.js";
8+
import globalConfig from "../config.js";
99

1010
// Define the schema shape
1111
const LiveArgsShape = {
@@ -97,13 +97,24 @@ async function runBrowserSession(rawArgs: any, config: BrowserStackConfig) {
9797
? await launchDesktopSession(args, config)
9898
: await launchMobileSession(args, config);
9999

100-
return {
101-
content: [
100+
let response = [
101+
{
102+
type: "text" as const,
103+
text: `✅ Session started. If it didn't open automatically, visit:\n${launchUrl}`,
104+
},
105+
];
106+
107+
if (globalConfig.REMOTE_MCP) {
108+
response = [
102109
{
103110
type: "text" as const,
104-
text: `✅ Session started. If it didn't open automatically, visit:\n${launchUrl}`,
111+
text: `✅ To start the session. Click on ${launchUrl}`,
105112
},
106-
],
113+
];
114+
}
115+
116+
return {
117+
content: response,
107118
};
108119
}
109120

0 commit comments

Comments
 (0)