# BrowserStack MCP MCP

> BrowserStack connects your automated testing pipeline directly into your AI agent. It lets you manage cross-browser builds and sessions without leaving your IDE. You can check concurrency limits, retrieve detailed logs from failed runs, and track project history instantly.

## Overview
- **Category:** loved-by-devs
- **Price:** Free
- **Tags:** cross-browser-testing, automated-testing, ci-cd, test-automation, mobile-testing, qa-testing

## Description

Automating cross-browser tests is usually a nightmare of dashboards and context switching. This MCP gives you full command over your entire testing pipeline through natural conversation. Instead of logging into the BrowserStack portal to see if a build passed or why a test timed out, your agent handles it all. You can list every project and drill down into specific builds, seeing their status right away. If something fails, you don't just get 'Failure'; you fetch the raw logs, which is what QA Engineers actually need for debugging. It helps DevOps track concurrency usage against your plan limits. Using this MCP through Vinkius means you access all these powerful testing controls from one place—your AI client of choice. You’ll spend less time copying error codes and more time fixing code.

## Tools

### delete_build
Removes an entire test build from your account using its unique ID.

### delete_session
Deletes a specific, problematic testing session by its ID.

### get_build
Retrieves all data for a build, including session details, OS/browser combinations, results, and associated logs.

### get_plan
Shows your current plan's parallel session limits and tracks how many sessions are currently in use or waiting.

### get_project
Gets full details for a specific project, including its name, group ID, and list of recent builds.

### get_session
Retrieves all data about one session: the OS, browser, status, reason for completion, and log URLs.

### get_session_logs
Pulls the raw text execution logs from a specific testing session to help debug failures.

### list_browsers
Lists all supported OS and browser combinations you can configure for your test scripts.

### list_builds
Provides a summary of recent automation builds, showing their status, duration, and number of sessions run.

### list_projects
Lists every project you have set up for automated testing in the platform.

## Prompt Examples

**Prompt:** 
```
List my recent automation builds and summarize their outcomes.
```

**Response:** 
```
You have 4 recent builds:
1. 'Nightly Regression #120' - Passed (Dur: 14:02)
2. 'PR-Check #491' - Passed (Dur: 2:15)
3. 'Payment Flow E2E' - Failed (Dur: 4:30) (Build ID: e4da3b...)
4. 'Hotfix-Deploy-Prod' - Running (Dur: 1:12)

Would you like me to dive into the 'Payment Flow E2E' build and fetch the failed session logs?
```

**Prompt:** 
```
Fetch the logs for the failed session in build e4da3b.
```

**Response:** 
```
I retrieved the session inside the build (Session ID: 7a912f). Here is the relevant snippet from the execution logs:

```text
[14:23:45] POST /session/7a912f/element - Request payload: {"using":"css selector","value":"#checkout-btn"}
[14:23:50] NoSuchElementError: no such element: Unable to locate element: {"method":"css selector","selector":"#checkout-btn"}
```

The test failed because the `#checkout-btn` element could not be found after 5 seconds of rendering.
```

**Prompt:** 
```
Check how many parallel sessions our current plan allows.
```

**Response:** 
```
According to your `Automate Enterprise` plan, your team is allowed 20 parallel sessions globally. Currently, 18 parallel sessions are in use, and 0 sessions are queued. You have room to start 2 more concurrent threads without throttling.
```

## Capabilities

### List test projects
Retrieve a list of all configured automation projects, including their IDs and build counts.

### Check build history
Fetch recent automation builds to check statuses like running, passed, or failed, along with duration details.

### View session specifics
Get deep details about a single test session, including the OS, browser version, status, and video/log links.

### Retrieve logs for failure analysis
Automatically pull the raw text execution logs from any failed test session for immediate debugging.

### Monitor plan capacity
Check your current subscription plan limits, including how many parallel sessions you've used and how many are waiting in the queue.

### List supported environments
See all OS/browser combinations that BrowserStack supports for setting up test capabilities.

## Use Cases

### The nightly regression failed mysteriously.
A QA Engineer runs the `list_builds` tool. They see 'Nightly Regression #120' failed. Next, they use `get_project` to confirm it belongs to the main group, then they run `get_session` on the failing session ID. This gives them the OS and browser details needed to realize the failure only happens on an older version of Android.

### The CI/CD pipeline is running too slow.
A DevOps Engineer suspects concurrency limits are being hit. They check `get_plan` first, confirming they have 2 remaining slots. If the system gets stuck, they use `delete_session` to force-quit a stalled thread and free up resources.

### Need proof of execution environment.
A Test Automator needs to confirm if a specific combination like 'Windows 10' and 'IE 11' is valid for the next test suite. They use `list_browsers` to validate the exact OS/browser pairing before writing any code.

### The build result needs summarizing.
A Developer doesn't want to sift through 50 pages of CI logs. Instead, they ask their agent to run `get_build` on the latest successful build and summarize the outcome in plain text.

## Benefits

- Stop context switching. Instead of leaving your IDE to check the BrowserStack dashboard, you just ask your agent for `list_builds` status and get the answer immediately.
- Deep debugging is faster than ever. If a test fails, you can use `get_session_logs` to pull raw text logs right into your chat window, letting you see the exact error message without opening any other tabs.
- Manage resources proactively. Before kicking off a huge batch of tests, ask for your plan details using `get_plan`. You'll know if you're running out of parallel session capacity and won't hit throttling limits.
- Keep things clean. If a test run is stuck or obsolete, use `delete_build` or `delete_session` to clear up the clutter and keep your project history manageable.
- Know your options. Use `list_browsers` anytime you need to confirm if a required OS/browser combination (like Safari on macOS) is actually supported for your next test script.

## How It Works

The bottom line is that you get real-time control over complex testing infrastructure without ever leaving your AI client.

1. Subscribe to this MCP and provide your BrowserStack Username and Access Key.
2. Ask your agent to perform a specific action, like listing recent builds or getting details on a session ID.
3. The tool runs the query against BrowserStack and returns structured data directly to your chat window.

## Frequently Asked Questions

**Can my AI automatically read the logs of a failed Selenium test?**
Yes. When you ask it to investigate a recently failed build, the agent can use `get_build` to find the failed session, and then automatically call `get_session_logs`. It will download the raw textual execution steps directly into the chat and summarize why the UI test failed.

**Is there a risk that my AI alters my testing scripts or repository code?**
No, this MCP server integrates exclusively with BrowserStack Automate API. It can read statuses, logs, and configurations, and can delete hung sessions or builds, but it has no connection to your actual codebase or git repository.

**How can I resolve concurrent session limits preventing my pipeline from advancing?**
You can ask your agent to `get_plan` to inspect your parallel boundaries and verify if you are queuing. Then, the agent can look up stalled items via `list_builds` and execute `delete_session` or `delete_build` to manually unblock stuck processes.

**How do I use `get_project` to view my current testing organization?**
You pass your unique BrowserStack project ID to `get_project`. This tool returns the project's name, group ID, and a list of recent builds associated with it. It’s perfect for scoping out which test runs belong to which feature area.

**Before I write my script, how do I use `list_browsers` to check compatibility?**
Running `list_browsers` gives you a comprehensive list of all supported OS and browser combinations. This output tells you exactly which environment configurations you need to target for your automated test scripts.

**What happens if I run `delete_build` on an old or failed test build?**
The `delete_build` function removes the specified automation build ID from your account. Be aware that while it cleans up the record, it doesn't delete the raw session logs you might need for debugging.

**What specific metrics does `list_builds` provide about my test suite runs?**
The function returns build names, IDs, statuses (running, done, failed), and the total duration. This lets you quickly identify which tests took too long or need immediate attention.

**How do I use `list_projects` to view all my test suite groups?**
`list_projects` returns a list of your project names, IDs, and how many builds are associated with each. This is the fastest way to get an overview of every organized testing stream you maintain.