Skip to main content
Glama
browserstack

BrowserStack MCP server

Official

runBrowserLiveSession

Manually test and debug websites on specific browser and OS combinations using BrowserStack's cloud infrastructure. Identify layout or compatibility issues in real-time by specifying the browser, OS version, and URL to analyze.

Instructions

Use this tool when user wants to manually check their website on a particular browser and OS combination using BrowserStack's cloud infrastructure. Can be used to debug layout issues, compatibility problems, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
desiredBrowserYesThe browser to run the test on. Example: 'Chrome', 'IE', 'Safari', 'Edge'. Always ask the user for the browser they want to use, do not assume it.
desiredBrowserVersionYesThe version of the browser to use. Example: 133.0, 134.0, 87.0
desiredOSYesThe operating system to run the browser on. Example: 'Windows', 'OS X'
desiredOSVersionYesThe OS version to run the browser on. Example: '10' for Windows, '12' for macOS, '14' for iOS
desiredURLYesThe URL of the website to test. This can be a local URL (e.g., http://localhost:3000) or a public URL. Always ask the user for the URL, do not assume it.

Implementation Reference

  • Registers the 'runBrowserLiveSession' tool on the McpServer, specifying name, description, input schema (LiveArgsShape), and the handler function that calls runBrowserSession with error handling and tracking.
    tools.runBrowserLiveSession = server.tool(
      "runBrowserLiveSession",
      "Launch a BrowserStack Live session (desktop or mobile).",
      LiveArgsShape,
      async (args) => {
        try {
          trackMCP(
            "runBrowserLiveSession",
            server.server.getClientVersion()!,
            undefined,
            config,
          );
          return await runBrowserSession(args, config);
        } catch (error) {
          logger.error("Live session failed: %s", error);
          trackMCP(
            "runBrowserLiveSession",
            server.server.getClientVersion()!,
            error,
            config,
          );
          return {
            content: [
              {
                type: "text" as const,
                text: `Failed to start a browser live session. Error: ${error}`,
                isError: true,
              },
            ],
            isError: true,
          };
        }
      },
    );
  • Defines the Zod input schema (LiveArgsShape and LiveArgsSchema) used for validating tool arguments including platformType, desiredURL, OS, browser, etc.
    const LiveArgsShape = {
      platformType: z
        .nativeEnum(PlatformType)
        .describe("Must be 'desktop' or 'mobile'"),
      desiredURL: z.string().url().describe("The URL to test"),
      desiredOS: z
        .enum(["Windows", "OS X", "android", "ios", "winphone"])
        .describe(
          "Desktop OS ('Windows' or 'OS X') or mobile OS ('android','ios','winphone')",
        ),
      desiredOSVersion: z
        .string()
        .describe(
          "The OS version must be specified as a version number (e.g., '10', '14.0') or as a keyword such as 'latest' or 'oldest'. Normalize variations like 'newest' or 'most recent' to 'latest', and terms like 'earliest' or 'first' to 'oldest'. For macOS, version names (e.g., 'Sequoia') must be used instead of numeric versions.",
        ),
      desiredBrowser: z
        .enum(["chrome", "firefox", "safari", "edge", "ie"])
        .describe("Browser for desktop (Chrome, IE, Firefox, Safari, Edge)"),
      desiredBrowserVersion: z
        .string()
        .optional()
        .describe(
          "Browser version for desktop (e.g. '133.2', 'latest'). If the user says 'latest', 'newest', or similar, normalize it to 'latest'. Likewise, convert terms like 'earliest' or 'oldest' to 'oldest'.",
        ),
      desiredDevice: z.string().optional().describe("Device name for mobile"),
    };
    
    const LiveArgsSchema = z.object(LiveArgsShape);
  • Core handler function invoked by the registered tool handler. Validates input args, determines desktop/mobile, launches the session via launchDesktopSession or launchMobileSession, and returns the launch URL in a response object.
    async function runBrowserSession(rawArgs: any, config: BrowserStackConfig) {
      // Validate and narrow
      const args = LiveArgsSchema.parse(rawArgs);
    
      // Branch desktop vs mobile and delegate
      const launchUrl =
        args.platformType === PlatformType.DESKTOP
          ? await launchDesktopSession(args, config)
          : await launchMobileSession(args, config);
    
      let response = [
        {
          type: "text" as const,
          text: `✅ Session started. If it didn't open automatically, visit:\n${launchUrl}`,
        },
      ];
    
      if (globalConfig.REMOTE_MCP) {
        response = [
          {
            type: "text" as const,
            text: `✅ To start the session. Click on ${launchUrl}`,
          },
        ];
      }
    
      return {
        content: response,
      };
    }
  • Key helper function that starts the browser session: filters device/browser capabilities, sets up local tunnel if needed, builds the BrowserStack dashboard URL with parameters, opens browser if local, returns the URL.
    export async function startBrowserSession(
      args: DesktopSearchArgs | MobileSearchArgs,
      config: BrowserStackConfig,
    ): Promise<string> {
      const entry =
        args.platformType === PlatformType.DESKTOP
          ? await filterDesktop(args as DesktopSearchArgs)
          : await filterMobile(args as MobileSearchArgs);
    
      // Get credentials from config
      const authString = getBrowserStackAuth(config);
      const [username, password] = authString.split(":");
    
      if (!username || !password) {
        throw new Error(
          "BrowserStack credentials are not set. Please configure them in the server settings.",
        );
      }
    
      const isLocal = await prepareLocalTunnel(args.url, username, password);
    
      const url =
        args.platformType === PlatformType.DESKTOP
          ? buildDesktopUrl(
              args as DesktopSearchArgs,
              entry as DesktopEntry,
              isLocal,
            )
          : buildMobileUrl(args as MobileSearchArgs, entry as MobileEntry, isLocal);
      if (!envConfig.REMOTE_MCP) {
        openBrowser(url);
      }
      return entry.notes ? `${url}, ${entry.notes}` : url;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but lacks critical behavioral details. It mentions using BrowserStack's cloud infrastructure and manual checking, but doesn't disclose whether this starts a live session, requires authentication, has time/rate limits, costs, or what happens after the check. For a tool with 5 required parameters and no annotations, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences that efficiently convey the tool's purpose and use cases without wasted words. The description is appropriately sized and front-loaded with the main purpose, though it could be slightly more structured with bullet points for use cases.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 5 required parameters, no annotations, and no output schema, the description provides adequate purpose and usage context but lacks completeness about behavioral aspects (e.g., session management, authentication, limitations). It's minimally viable for understanding what the tool does but insufficient for understanding how it behaves during/after execution.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 5 parameters thoroughly with examples and guidance. The description adds no parameter-specific information beyond implying these parameters are needed for browser/OS/URL selection. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'manually check their website on a particular browser and OS combination using BrowserStack's cloud infrastructure' with specific use cases like debugging layout issues. It distinguishes from siblings by focusing on manual website testing (vs. getFailuresInLastRun for failures, runAppLiveSession for apps, etc.), though not explicitly contrasting each sibling.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use it: 'when user wants to manually check their website on a particular browser and OS combination' for debugging layout/compatibility issues. It doesn't explicitly state when NOT to use it or name alternatives among siblings, but the context strongly implies this is for manual website testing vs. automated testing or other functions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/browserstack/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server