diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 0000000..bdb1678 --- /dev/null +++ b/.mcp.json @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "playwright": { + "command": "npx", + "args": ["-y", "@playwright/mcp@0.0.73", "--headless", "--browser", "chromium"] + } + } +} diff --git a/AGENTS.md b/AGENTS.md index 2912a47..966c59e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -89,6 +89,37 @@ cargo clippy -- -D warnings # advisory cargo test --verbose # advisory ``` +## Browser MCP (UI verification) + +A project-scoped MCP server (`.mcp.json` at repo root) registers `@playwright/mcp@0.0.73` via `npx`. When Claude Code launches in this repo it gets `browser_navigate`, `browser_snapshot`, `browser_evaluate`, `browser_take_screenshot`, and the rest of the `browser_*` tool surface — useful for verifying visual UI changes against the running dev server without a full automated test suite. There is intentionally no `playwright.config.ts` / `@playwright/test` integration and no devDep in `osprey_ui/package.json`; the MCP is for ad-hoc verification, not CI. + +All commands in this section — including any `--dry-run` previews — are **operator-run only**. Agents must never execute them. If a prereq is missing, the agent surfaces *what the operator should run* and waits. + +The MCP needs Playwright's bundled Chromium binary plus its system shared libs. Setup is platform-specific — Playwright's docs cover it across macOS / Windows / WSL / Linux: . + +**Operator runs the binary install** (no sudo, user-cache only). Pinned via `@playwright/mcp@0.0.73`'s bundled `playwright-core`, so the downloaded Chromium build matches what the MCP server will launch: + +```bash +npx -y @playwright/mcp@0.0.73 install-browser chromium +``` + +System libs: + +- **macOS, recent Windows / WSL**: nothing extra to install. +- **Linux**: distro-specific. **The operator** runs the dry-run to preview the package list `install-deps` would apt-install: + + ```bash + npx -y playwright install-deps chromium --dry-run + ``` + + …and then **the operator** runs the printed `apt-get install` line themselves. The agent does neither step. + + `install-deps` only auto-supports recent Ubuntu / Debian. Fedora, Arch, Alpine, and NixOS need manual lib installation — Playwright's troubleshooting docs cover their package names. + +Before calling `browser_navigate("http://localhost:5002")`, **the operator** starts the dev server (`cd osprey_ui && npm start`, listens on `:5002`). + +If the MCP approval prompt doesn't fire on a fresh `claude` launch, **the operator** runs `claude mcp reset-project-choices` and re-launches. + ## CI CI runs entirely via GitHub Actions on `pull_request` and `push` to `main`. Each line below is one literal CI `run:` step, in workflow order. Run them in your shell (paste-as-is — no `&&` chaining, no error suppression — so each step's exit code matches the corresponding CI step's exit code): diff --git a/CHANGELOG.md b/CHANGELOG.md index 1418a52..c7d7677 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgrade `requests-mock` from 1.9.3 to 1.12.1 ([#176](https://github.com/roostorg/osprey/pull/176) by [@dependabot](https://github.com/dependabot)) - Upgrade `antd` and `@ant-design/icons` to v5 (Ant Design 5 migration) ([#238](https://github.com/roostorg/osprey/pull/238) by [@haileyok](https://github.com/haileyok)) - Replace `moment` with `dayjs` ([#238](https://github.com/roostorg/osprey/pull/238) by [@haileyok](https://github.com/haileyok)) +- Add project-scoped Playwright MCP registration (`@playwright/mcp@0.0.73` via `npx`) so Claude Code can drive a browser against `osprey_ui` for ad-hoc UI verification ([#243](https://github.com/roostorg/osprey/pull/243) by [@haileyok](https://github.com/haileyok)) ### 🛠 Breaking changes