Building a Browser Harness MCP for AI Agents
为 AI 代理构建浏览器测试框架/MCP
使用 Playwright、MCP 和 GitHub Copilot SDK 构建的浏览器测试框架。
设置
npm install
npx playwright install chromium设置 Azure OpenAI 环境变量:
export AZURE_OPENAI_ENDPOINT="https://..."
export AZURE_OPENAI_API_KEY="..."
export AZURE_OPENAI_API_VERSION="2025-04-01-preview"
export AZURE_OPENAI_DEPLOYMENT="gpt-5.4"默认情况下,测试框架会启动 Playwright Chromium。若要改为附加到 Chrome,请使用专用配置文件启动它并导出其 CDP 端点:
google-chrome \
--remote-debugging-port=9222 \
--user-data-dir="$PWD/.agent-browser" \
--no-first-run
export BROWSER_CDP_URL="http://127.0.0.1:9222"Related MCP server: playwright-browser
运行
npm start -- "Open example.com and print the page title."运行实时任务:
npm run eval
npm run eval -- --task amazon代码执行运行时不是安全边界。在对不可信输入使用此模式之前,请在隔离的进程或 VM 中运行生成的代码。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Playwright browser automation — navigate, click, fill forms, extract, screenshot — 17 agent tools.
Provides cloud browser automation capabilities using Stagehand and Browserbase, enabling LLMs to i…
Let your AI agent operate any website through a real, logged-in browser session.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to control browser automation through natural language prompts using Playwright, supporting visual element interaction, PDF generation, screenshots, and testing assertions.ISC
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI agents to control a web browser using Playwright, supporting navigation, interaction, and data extraction through natural language.MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to perform browser automation using Playwright, including navigation, content extraction, screenshot analysis, and custom script execution.5MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to control a browser through Playwright tools, allowing web automation tasks such as navigation, clicking, typing, and screenshots.Apache 2.0