BrowserStack
官方将BrowserStack测试平台的完整功能引入您的AI工具,让团队中的每位开发者和测试人员都能更快速、更轻松地进行测试。
你可以用 BrowserStack MCP 做什么?
- 创建和管理测试用例 — 在测试管理项目中,使用
createTestCase、listTestCases或createTestCasesFromFile添加、更新、列出和批量生成测试用例。 - 在真实设备上运行手动应用和浏览器测试 — 通过
runAppLiveSession和runBrowserLiveSession在特定设备/操作系统/浏览器组合上启动实时测试会话。 - 执行和调试自动化测试套件 — 使用
setupBrowserStackAutomateTests设置基于 SDK 的测试运行,通过getFailureLogs获取失败日志,并利用fetchRCA检索 AI 根因分析结果。 - 扫描无障碍问题 — 使用
startAccessibilityScan对 URL 运行 WCAG 合规性扫描,并通过fetchAccessibilityIssues检索标记的问题。 - 集成 Percy 视觉测试 — 使用
addPercySnapshotCommands添加视觉快照命令,通过runPercyScan运行 Percy 构建,并利用fetchPercyChanges审查检测到的视觉变化。
文档
BrowserStack MCP 服务器
综合测试平台
直接在 Cursor、Claude 或任何支持 MCP 的客户端等工具中,使用简单的英语管理测试用例、执行手动或自动化测试、调试问题,甚至修复代码。
随时随地测试:
轻松将 BrowserStack 测试平台连接到您喜爱的 AI 工具,例如 IDE、LLM 或智能体工作流。
使用自然语言测试:
使用简单的英语提示来管理、执行、调试测试,甚至修复代码。
减少上下文切换:
保持专注——将所有项目上下文集中在一处,并直接从您的 IDE 或 LLM 触发操作。
⚡️ 一键 MCP 设置
点击下方按钮,在您各自的 IDE 中安装 MCP:
注意:请确保您使用的 Node 版本 >= 18.0
- 使用
node --version检查您的 Node 版本。推荐版本:v22.15.0(LTS) - 升级 Node 的方法:
-
- 在 macOS 上
(Homebrew) - brew update && brew upgrade node or if using (nvm) - nvm install 22.15.0 && nvm use 22.15.0 && nvm alias default 22.15.0
- 在 macOS 上
-
- 在 Windows 上
(nvm-windows) : nvm install 22.15.0 && nvm use 22.15.0
- 在 Windows 上
- 👉 或直接下载 Node.js LTS 安装程序
.
💡 使用示例
📱 手动应用测试
在搭载最新操作系统版本的真实设备上测试移动应用。无需繁琐设置即可重现错误并调试崩溃。 以下是一些示例提示,用于在 BrowserStack 广泛的实际设备云上使用您的移动应用
# Open app on specific device
"open my app on a iPhone 15 Pro Max"
# Debug app crashes
"My app crashed on Android 14 device, can you help me debug?"
- 与模拟器不同,您可以在实际设备上测试应用的真实性能。借助先进的应用性能分析功能,您可以实时调试崩溃和性能问题。
- 从我们的设备矩阵访问所有主流设备和操作系统版本,我们有严格的 SLA,可在新设备发布当天将其部署到我们的全球数据中心。
🌐 手动 Web 测试
与应用测试类似,您可以使用以下提示在 BrowserStack 广泛的实际浏览器和设备云上测试您的网站。您的机器上没有安装 Edge 浏览器?我们为您搞定!
# Test your websites
"open my website hosted on localhost:3001 on Edge"
"open browserstack.com on latest version of Chrome"
- 跨不同浏览器和设备测试网站。我们支持所有主流操作系统上的所有主流浏览器。
- 无缝测试本地托管的网站,无需部署到远程服务器!
🧪 自动化测试(Playwright、Selenium、A11y 等)
直接在您的 IDE 或 LLM 中自动分析、诊断甚至修复损坏的测试脚本。即时获取日志、识别根本原因并应用上下文感知的修复。不再有调试循环。 以下是一些示例提示,用于在 BrowserStack 的测试平台上运行/调试/修复您的自动化测试。
注意: 当获取测试的根本原因分析 (RCA) 时,服务器仅将建议的修复作为提案返回。它永远不会自动应用代码更改——您的助手必须提出建议并等待您的明确批准才能编辑任何文件。
#Port test suite to BrowserStack
"Setup test suite to run on BrowserStack infra"
#Run tests on BrowserStack
“Run my tests on BrowserStack”
#AI powered debugging of test failures
"My App Automate tests have failed, can you help me fix the new failures?"
- 利用我们业界领先的测试可观测性功能,修复 CI/CD 管道报告的测试失败。在此处查找更多信息。
- 在 BrowserStack 的测试平台上运行使用 Jest、Playwright、Selenium 等编写的测试
🌐 无障碍性
通过自动化的本地 a11y 扫描,尽早发现无障碍性问题。获取一键式 AI 建议修复。无需查阅文档,CI 中无意外。使用我们的无障碍性测试工具确保符合 WCAG 和 ADA 标准
#Scan accessibility issues while development
"Scan & help fix accessibility issues for my website running locally on localhost:3000"
#Scan accessibility issues on production site
“Run accessibility scan & identify issues on my website - www.bstackdemo.com”
📋 测试管理
使用自然语言创建和管理测试用例、创建测试计划并触发测试运行。以下是一些示例提示,用于通过 MCP 服务器利用 BrowserStack 的测试管理功能。
# Create project & folder structure
"create new Test management project named My Demo Project with two sub folders - Login & Checkout"
# Add test cases
"add invalid login test case in Test Management project named My Demo Project"
# List added test cases
"list high priority Login test cases from Test Management project - My Demo Project"
# Create test run
"create a test run for Login tests from Test Management project - My Demo Project"
# Update test results
"update test results as passed for Login tests test run from My Demo Project"
🧪 访问 BrowserStack AI 智能体
根据 PRD 生成测试用例,将手动测试转换为低代码自动化,并自动修复由 BrowserStack 的 AI 智能体驱动的不稳定脚本,无缝集成到您的工作流中。以下是一些访问 Browserstack AI 智能体的示例提示
#Test case generator agent
"With Browserstack AI, create relevant test cases for my PRD located at /usr/file/location"
#Low code authoring agent
“With Browserstack AI, automate my manual test case X, added in Test Management”
#Self healing agent
“Help fix flaky tests in my test script with Browserstack AI self healing”
🛠️ 安装
📋 MCP 设置的先决条件
注意:请确保您使用的 Node 版本 >= 18.0
- 使用
node --version检查您的 Node 版本。推荐版本:v22.15.0(LTS)
一键 MCP 设置
点击下方按钮,在您各自的 IDE 中安装 MCP:
设置 MCP 服务器的其他方法
-
创建 BrowserStack 账户
-
如果您还没有账户,请注册 BrowserStack。
-
ℹ️ 如果您有开源项目,我们可以为您提供免费计划。
-
拥有账户(并购买了适当的计划)后,请从账户设置中记下您的
username和access_key。
-
-
注意:请确保您使用的 Node 版本 >=
18.0- 使用
node --version检查您的 Node 版本。推荐版本:v22.15.0(LTS)
- 使用
-
安装 MCP 服务器
-
VSCode (Copilot - 智能体模式):
.vscode/mcp.json:-
找到或创建配置文件: 在项目的根目录中,查找名为 .vscode 的文件夹。此文件夹通常是隐藏的,因此您需要按照展开说明中的方法找到它。
-
如果此文件夹不存在,请创建它。
-
在 .vscode 文件夹内,创建一个名为 mcp.json 的新文件
-
添加配置:打开 mcp.json 文件,然后添加以下 JSON 内容。
-
将用户名和 <access_key> 替换为您的 BrowserStack 凭据。
-
{ "servers": { "browserstack": { "command": "npx", "args": ["-y", "@browserstack/mcp-server@latest"], "env": { "BROWSERSTACK_USERNAME": "<username>", "BROWSERSTACK_ACCESS_KEY": "<access_key>" } } } }- 在 VSCode 中,确保点击 MCP 服务器中的
Start按钮以启动服务器。
** 在 VSCode Copilot 上设置 MCP 的替代方法
- 点击齿轮图标以选择工具
2. 顶部中央会出现一个工具菜单,向下滚动顶部菜单,然后点击添加 MCP 服务器
3. 选择 NPM 包选项(从 NPM 包安装)- 列表中的第 3 个
4. 输入 NPM 包名称 (@browserstack/mcp-server)
5. 输入 browserstack 用户名和访问密钥
- 对于 Cursor:
.cursor/mcp.json:
{ "mcpServers": { "browserstack": { "command": "npx", "args": ["-y", "@browserstack/mcp-server@latest"], "env": { "BROWSERSTACK_USERNAME": "<username>", "BROWSERSTACK_ACCESS_KEY": "<access_key>" } } } }- Claude Desktop:
~/claude_desktop_config.json:
{ "mcpServers": { "browserstack": { "command": "npx", "args": ["-y", "@browserstack/mcp-server@latest"], "env": { "BROWSERSTACK_USERNAME": "<username>", "BROWSERSTACK_ACCESS_KEY": "<access_key>" } } } }- Cline
-
点击导航栏中的“MCP 服务器”图标 选择“已安装”选项卡。点击窗格底部的“配置 MCP 服务器”按钮。
{
"mcpServers": {
"browserstack": {
"command": "npx",
"args": ["-y", "@browserstack/mcp-server@latest"],
"env": {
"BROWSERSTACK_USERNAME": "<username>",
"BROWSERSTACK_ACCESS_KEY": "<access_key>"
}
}
}
}
💡 BrowserStack MCP 工具列表
截至目前,我们支持 44 个工具。
远程 MCP 注意: 标记为 (在远程 MCP 中不可用) 的工具依赖于本地文件/进程状态,并在多租户远程 MCP 服务器中被禁用。它们在本地 (npx) 设置中可用。
🧾 测试管理
createProjectOrFolder— 创建测试管理项目和/或文件夹以组织测试用例。返回文件夹 ID、项目 ID 和用于访问 TM 项目仪表板的测试管理链接。 提示示例
Create a new Test Management project named 'Shopping App' with two folders - Login and Checkout
createTestCase— 在特定项目/文件夹下添加手动测试用例(使用项目标识符,如 PR-xxxxx 和文件夹 ID)。 提示示例
Add a test case named 'Invalid Login Scenario' to the Login folder in the 'Shopping App' project with PR-53617, Folder ID: 117869
updateTestCase— 更新现有测试用例。可以更改任何字段子集(名称、优先级、状态、步骤、标签等);仅修改提供的字段。 提示示例
Update test case TC-482 in the 'Shopping App' project and set its priority to high
listTestCases— 列出项目的测试用例,可选择限定到某个文件夹(支持 case_type、优先级和分页等过滤器)。 提示示例
List all high-priority test cases in the 'Shopping App' project with project_identifier: PR-59457
listFolders— 列出测试管理项目中的文件夹(返回每个文件夹的 ID、名称、用例计数和子文件夹计数)。传递 parent_id 以列出子文件夹。 提示示例
List all folders in the 'Shopping App' project with project_identifier: PR-59457
listTestCaseTemplates— 列出测试用例模板及其数字 template_id,用于createTestCase以应用自定义模板。 提示示例
List the available test case templates in the 'Shopping App' project
createTestRun— 为项目中选定的测试用例创建测试运行(套件)。 提示示例
Create a test run for the Login folder in the 'Shopping App' project and name it 'Release v1.0 Login Flow'
listTestRuns— 列出项目的测试运行(按日期、受理人、状态筛选)。 提示示例
List all test runs from the 'Shopping App' project that were executed last week and are currently marked in-progress
updateTestRun— 更新测试运行的名称/状态和/或向其添加测试用例。 提示示例
Update test run ID 1043 in the 'Shopping App' project and mark it as complete with the note 'Regression cycle done'
addTestResult— 为运行中的测试用例添加手动执行结果(通过/失败/阻塞/跳过)。 提示示例
Mark the test case 'Invalid Login Scenario' as passed in test run ID 1043 of the 'Shopping App' project
createTestCasesFromFile— 使用测试用例生成器 AI 智能体从上传的文件批量生成测试用例。(在远程 MCP 中不可用) 提示示例
Upload test cases from '/Users/xyz/testcases.pdf' to the 'Shopping App' project in Test Management
listTestPlans— 列出项目中的测试计划 (TP-*),包含名称、状态、日期以及活动/已关闭的运行计数。支持分页。 提示示例
List all test plans in the 'Shopping App' project with project_identifier: PR-59457
getTestPlan— 通过标识符 (TP-*) 获取测试计划,包含其元数据、关联的测试运行、总测试用例计数和状态摘要。 提示示例
Get the details of test plan TP-120 in the 'Shopping App' project
listSubTestPlans— 列出父测试计划 (TP-) 下的子测试计划 (STP-)。支持分页。 提示示例
List sub-test-plans under test plan TP-120 in the 'Shopping App' project
getSubTestPlan— 获取父计划下的子测试计划 (STP-*),包含其元数据和关联的测试运行。 提示示例
Get sub-test-plan STP-45 under test plan TP-120 in the 'Shopping App' project
⚙️ BrowserStack SDK 设置 / 自动化测试
setupBrowserStackAutomateTests— 集成 BrowserStack SDK 并在 BrowserStack 上运行 Web 测试。对于视觉测试/Percy,请使用专用的 Percy 工具。 提示示例
Run my Selenium-JUnit5 tests written in Java on Chrome and Firefox.
fetchAutomationScreenshots— 获取在给定 Automate/App Automate 会话期间捕获的屏幕截图。 提示示例
Get screenshots from Automate session ID abc123xyz for my desktop test run
🔍 可观测性
getFailureLogs— 检索 Automate/App Automate 会话的错误日志(对于 App Automate,可选择按 Build ID 检索)。 提示示例
Get the error logs from the session ID: 21a864032a7459f1e7634222249b316759d6827f, Build ID: dt7ung4wmjittzff8kksrjadjax9gzvbscoyf9qn of App Automate test session
fetchBuildInsights— 通过结合构建详情和质量门结果,获取有关 BrowserStack 构建的洞察。 提示示例
Get the build insights for build UUID <your-build-uuid> on BrowserStack
📱 App Live
runAppLiveSession— 在云中的真实设备上启动手动应用测试会话。 提示示例
Open my app on iPhone 15 Pro Max with iOS 17. App path is /Users/xyz/app.ipa
💻 Live
runBrowserLiveSession— 在桌面或移动浏览器上启动用于网站测试的 Live 会话。 提示示例
Open www.google.com on the latest version of Microsoft Edge on Windows 11
📲 App Automate
takeAppScreenshot— 在指定设备上启动应用并捕获快速验证屏幕截图,以确认您的应用已启动。 提示示例
Take a screenshot of my app on Google Pixel 6 with Android 12 while testing on App Automate. App file path: /Users/xyz/app-debug.apk
runAppTestsOnBrowserStack— 通过直接上传已编译的 .apk/.ipa 测试文件,运行预构建的原生移动测试套件(Espresso/XCUITest)。 提示示例
Run Espresso tests from /tests/checkout.zip on Galaxy S21 and Pixel 6 with Android 12. App path is /apps/beta-release.apk under project 'Checkout Flow'
setupBrowserStackAppAutomateTests— 为基于 Appium 的移动应用测试设置 BrowserStack App Automate SDK 集成。 提示示例
Set up my Appium test suite to run on BrowserStack App Automate
♿ 无障碍性
accessibilityExpert— 咨询 A11y 专家(WCAG 2.0/2.1/2.2,移动/Web 可用性,最佳实践)。 提示示例
What WCAG guidelines apply to form field error messages on mobile web?
startAccessibilityScan— 启动网页无障碍扫描并获取本地 CSV 报告路径。 提示示例
Run accessibility scan for "www.example.com"
createAccessibilityAuthConfig— 为需要登录的无障碍扫描创建身份验证配置(基于表单或基本认证)。 提示示例
Create a basic-auth accessibility config named 'site-login' for https://www.example.com with username testuser and password <password>
getAccessibilityAuthConfig— 通过 ID 获取现有的无障碍身份验证配置。 提示示例
Get accessibility auth config with ID <config-id>
fetchAccessibilityIssues— 从已完成的扫描中获取无障碍问题,支持分页。 提示示例
Fetch the accessibility issues for scan ID <scan-id> and scan run ID <scan-run-id>
🎨 Percy 视觉测试
percyVisualTestIntegrationAgent— 将 Percy 视觉测试集成到新项目中,并通过逐步模拟演示视觉变更检测。 提示示例
Integrate Percy for this project
expandPercyVisualTesting— 为现有项目(Percy Web Standalone 和 Percy Automate)设置或扩展 Percy 视觉测试覆盖范围。 提示示例
Expand Percy coverage for this project
addPercySnapshotCommands— 将 Percy 快照命令添加到指定的测试文件中。(在 Remote MCP 中不可用) 提示示例
Add Percy snapshot commands to my Cypress test files
listTestFiles— 列出给定目录集合中的所有测试文件。(在 Remote MCP 中不可用) 提示示例
List the test files under my ./tests directory
runPercyScan— 运行 Percy 视觉测试扫描。(在 Remote MCP 中不可用) 提示示例
Run this Percy build
fetchPercyChanges— 获取并总结 Percy AI 在最新版本与上一版本之间检测到的视觉变更。 提示示例
Summarize the visual changes Percy detected in my latest build
managePercyBuildApproval— 批准或拒绝 Percy 构建。 提示示例
Approve the latest Percy build
🤖 BrowserStack AI 代理
uploadProductRequirementFile— 上传 PRD/截图/PDF 并获取文件映射 ID(与createTestCasesFromFile配合使用)。(在 Remote MCP 中不可用) 提示示例
Upload PRD from /Users/xyz/Desktop/login-flow.pdf and use BrowserStack AI to generate test cases
createLCASteps— 从测试管理中的手动测试用例生成低代码自动化(LCA)步骤。 提示示例
Convert the manual test case 'Add to Cart' in the 'Shopping App' project into LCA steps
fetchSelfHealedSelectors— 获取 AI 自愈选择器(以及测试源代码),以修复因 DOM 变更导致的不稳定测试。 提示示例
Fetch and fix flaky test selectors in Automate session ID session_9482 using MCP
prepareSelfHealingPlan— 构建一个自愈编辑计划,将定位器对与测试源代码打包,供您的 LLM 应用。本身不修改文件。 提示示例
Prepare a self-healing plan from the self-healed selectors for my build
fetchRCA— 获取失败 Automate/App-Automate 测试的 AI 根因分析(通过数字测试 ID)。仅建议修复;绝不自动应用。 提示示例
Fetch the root cause analysis for failed test IDs 101 and 102 on BrowserStack
getBuildId— 获取给定项目和构建名称的 BrowserStack 构建 ID,范围限定在您的构建中。 提示示例
Get the build ID for build 'nightly-regression' in project 'Checkout Flow'
listBuildId— 获取项目和构建名称的最新构建 ID,跨所有用户(无用户筛选)。 提示示例
Get the latest build ID for build 'nightly-regression' in project 'Checkout Flow'
listTestIds— 列出 BrowserStack Automate 构建中的测试 ID,可按状态(通过/失败/待处理/跳过)筛选。 提示示例
List the failed test IDs from build UUID <your-build-uuid> on BrowserStack
🚀 Remote MCP 服务器
Remote MCP 提供 MCP 服务器的所有功能,无需复杂的设置或本地安装。
主要优势:
-
✅ 在企业网络中无缝运行,无需担心防火墙、二进制文件或本地安装受限的情况。
-
✅ 安全的 OAuth 集成 – 无需共享密码或手动处理凭据。
局限性:
- ❌ 不支持本地测试(无法测试位于 VPN、防火墙或 localhost 后的应用)。如果需要进行本地测试,您必须使用 BrowserStack Local MCP 服务器。
- ❌ 延迟可能稍高,但影响不大 — 正常使用中通常不会察觉。
安装步骤:
-
在 VSCode(Copilot - Agent 模式)上:
.vscode/mcp.json:-
找到或创建配置文件:
-
在项目的根目录中,查找名为 .vscode 的文件夹。此文件夹通常是隐藏的,因此您需要按照展开说明中的方法找到它。
-
如果此文件夹不存在,请创建它。
-
在 .vscode 文件夹内,创建一个名为 mcp.json 的新文件。
-
要设置 Remote BrowserStack MCP 而非本地 BrowserStack MCP,您可以添加以下 JSON 内容:
设置 Remote MCP 的替代方法
-
步骤 1. 点击齿轮图标选择“工具”
-
步骤 2. 顶部中央会出现一个工具菜单,向下滚动该菜单,然后点击“添加 MCP 服务器”
-
步骤 3. 点击 HTTP 选项
-
步骤 4. 粘贴 Remote MCP 服务器 URL:https://mcp.browserstack.com/mcp
-
步骤 5. 将服务器 ID 设为:browserstack
-
步骤 6. 在 VSCode 中点击“启动 MCP 服务器”,然后点击“允许”
-
🤝 推荐的 MCP 客户端
- 对于自动化测试 + 调试用例,我们推荐使用 Github Copilot 或 Cursor。
- 对于手动测试用例(实时测试),我们推荐使用 Claude Desktop。
⚠️ 重要说明
- BrowserStack MCP 服务器正在积极开发中,目前支持 MCP 规范的一个子集。更多功能即将推出。
- 工具调用依赖于 MCP 客户端,而 MCP 客户端又依赖于 LLM,因此可能存在一些非确定性行为,导致意外结果。如果您有任何建议或反馈,请提交 issue 进行讨论。
📝 贡献
我们欢迎贡献!请提交 issue 讨论您想做出的任何更改。 👉 点击此处查看我们的贡献指南
📞 支持
如需支持,请:
🚀 更多功能即将推出
敬请期待激动人心的更新!有任何建议吗?请提交 issue 进行讨论。

