Building a Browser Harness MCP for AI Agents
by jiin-kim109
README.md
# Building a Browser Harness/MCP for AI Agents
A browser harness built with Playwright, MCP, and the GitHub Copilot SDK.
## Setup
```bash
npm install
npx playwright install chromium
```
Set the Azure OpenAI environment variables:
```bash
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"
```
By default, the harness launches Playwright Chromium. To attach to Chrome
instead, start it with a dedicated profile and export its CDP endpoint:
```bash
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"
```
## Run
```bash
npm start -- "Open example.com and print the page title."
```
Run the live tasks:
```bash
npm run eval
npm run eval -- --task amazon
```
The code-execution runtime is not a security boundary. Run generated code in an isolated process or VM before using this pattern with untrusted input.
This server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessNo issues