Skip to main content
Experience faster, smarter testing with BrowserStack AI Agents. See what your workflow’s been missing. Explore now!
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Run web automation tests in BrowserStack Automate with the MCP server

Use natural language prompts in your AI assistant to instantly set up BrowserStack SDK, run web automation tests, and fetch screenshots from Automate sessions on real browsers and devices.

Use the BrowserStack MCP server to set up the BrowserStack SDK, run web automation tests, and fetch screenshots from Automate sessions directly from your coding assistant (such as GitHub Copilot, Claude, or Cursor). Skip manual configuration and dashboards—start your web tests or retrieve screenshots with simple prompts.

To get started with BrowserStack MCP server, see the get started with BrowserStack MCP documentation.

To use Automate tools on the MCP server, you need an Automate license. Contact BrowserStack support to enable a license for your account.

Streamline web automation testing from your IDE

Use the following tools to set up the BrowserStack SDK, run web automation tests, and fetch screenshots from BrowserStack Automate sessions, all through natural language prompts:

Run web automation tests (setupBrowserStackAutomateTests)

Use the setupBrowserStackAutomateTests tool to integrate the BrowserStack SDK and run your web automation tests on real browsers in the cloud. This is the primary tool for executing your test suites with support for various frameworks and programming languages.

Example: Using MCP server with Automate using GitHub Copilot agent on VS Code

Automate example prompt and tool call for running tests

Fetch screenshots (fetchAutomationScreenshots)

Use the fetchAutomationScreenshots tool to retrieve screenshots from your Automate test sessions. This tool helps you access and analyze visual test results from your automation runs.

Tool reference

Use the setupBrowserStackAutomateTests tool to integrate the BrowserStack SDK and run web tests, and the fetchAutomationScreenshots tool to fetch screenshots from Automate/App Automate sessions.

For a complete list of supported browsers & mobile devices, refer to the BrowserStack Automate supported devices & browsers page.

Example prompt Description Input parameters Invoked tool
Run my Selenium-JUnit5 tests written in Java on Chrome and Firefox. Enable Percy for visual testing. Integrates BrowserStack SDK and runs web tests on BrowserStack with optional visual testing support. • automationFramework: Automation framework (e.g., selenium)
• testingFramework: Testing framework (e.g., junit5)
• programmingLanguage: Programming language (e.g., java)
• targetPlatforms: Browser/OS combinations
• enablePercy: Enable visual testing (defaults to false)
setupBrowserStackAutomateTests
Run Playwright tests with WebdriverIO on Safari and Edge browsers. Tests are written in NodeJS. Executes browser-based automated tests on specified platforms using the chosen framework and language. • automationFramework: Automation framework (e.g., playwright)
• testingFramework: Testing framework (e.g., webdriverio)
• programmingLanguage: Programming language (e.g., nodejs)
• targetPlatforms: Browser/OS combinations
• enablePercy: Enable visual testing (defaults to false)
setupBrowserStackAutomateTests
Get screenshots from Automate session ID abc123xyz for my desktop test run Fetches screenshots captured during a given Automate session. • sessionId: Unique identifier for the test session fetchAutomationScreenshots

Common workflows

The following workflows are supported on the BrowserStack MCP server to accomplish complex testing scenarios. Each workflow shows the sequence of tools and automated actions that streamline common development tasks:

Ensure you have active licenses for all the BrowserStack products (e.g., Automate, Percy) included in your workflows before running these prompts. Contact BrowserStack support to enable a license for your account.

Rapid SDK setup and integration

Run your automated web testing project on BrowserStack platform by seamlessly integrating BrowserStack SDK, configuring devices, and enabling visual testing (Percy) in one go.
Tools invoked: setupBrowserStackAppAutomateTests, runAppTestsOnBrowserStack.

Example prompts:

  • Set up Automate SDK for my Selenium (Python) project, configure it to run on Pixel 7 and iPhone 15, and enable Percy for visual testing.

  • Set up BrowserStack SDK for my Appium project, run these automated tests on BrowserStack using MCP server.
    Project: [Insert GitHub URL]
    Framework: Selenium
    Language: Java
    Target Devices: Samsung Galaxy S23, iPhone 14 Pro
    Enable Percy: true (optional)

Supported frameworks on Automate are Selenium, Cypress, Playwright, Puppeteer, and WebDriverIO. The MCP server can automatically set up the BrowserStack SDK for these frameworks to run your web automation tests on BrowserStack Automate.

Automated actions (What the MCP server does):

  1. Detects your project’s framework and language (e.g., Selenium + Java).

  2. Installs the necessary BrowserStack SDK and dependencies into your project.

  3. Configures the browserstack.yml file with your requested devices (e.g., Pixel 7, iPhone 15).

  4. Enables Percy for visual testing if requested.

Run tests and debug failures

Streamline the testing process by automating execution, detecting failures, and leveraging AI for Root Cause Analysis (RCA) and resolution.
Tools invoked: runAppTestsOnBrowserStack, getBuildId, listTestIds, fetchRCA

Example prompts:

  • “Run my Selenium tests on BrowserStack. Once finished, list any failed test IDs.”

  • “List failed test IDs for build . Fetch the RCA for each failure and suggest code fixes to resolve them."

Automated actions (What the MCP server does):

  1. Executes your test suite on the BrowserStack Automate cloud.

  2. Retrieves the specific Build ID and filters the list for status=failed.

  3. Fetches RCA logs to diagnose if the failure is due to an automation issue, a product bug, or an environment issue.

  4. Suggests code fixes based on AI analysis of the logs (via Copilot).

Need help?

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle