browser-smoke
Enables browser automation and smoke testing via Playwright, with tools for navigation, DOM interaction, screenshots, network capture, and more.
README
Browser Smoke
MCP browser smoke testing plugin for OpenCode — Playwright-based UI testing via browser automation. Jalankan smoke test terhadap web app langsung dari OpenCode dengan 24 tools.
Prerequisites
| Requirement | Version |
|---|---|
| Node.js | >= 18 |
| Python | >= 3.8 |
| OpenCode | terinstal |
Quick Install
npx browser-smoke init
CLI akan interaktif nanya:
Pilih lokasi instalasi:
[1] Global — untuk semua project (~/.config/opencode)
[2] Local — hanya project ini (./opencode.json)
[3] Cancel
Pilih [1/2/3]:
Proses:
- Setup Python virtual environment
- Install dependencies (
fastmcp,playwright,pixelmatch,Pillow) - Install Chromium browser
- Config
opencode.json+ skill file
Restart OpenCode setelah selesai.
Opsi Init
| Command | Description |
|---|---|
npx browser-smoke init |
Interaktif (tanya global/local) |
npx browser-smoke init --global |
Global, skip prompt |
npx browser-smoke init --local |
Local, skip prompt |
npx browser-smoke init --print |
Preview config tanpa install |
Manual Config
Kalo init gak bisa dipake, tambahin manual ke opencode.json:
{
"mcp": {
"browser-smoke": {
"type": "local",
"command": [".browser-smoke/.venv/bin/python3", "-m", "server"],
"cwd": ".browser-smoke/mcp"
}
}
}
Tools (24 MCP Tools)
Navigasi & Page
| Tool | Description |
|---|---|
browser_open(url, headless?) |
Buka URL. Returns title + status code + screenshot |
browser_open_tab(url) |
Buka tab baru, fokus ke tab baru |
browser_get_tabs() |
List semua tab (title, URL, active status) |
browser_close() |
Tutup browser session |
browser_scroll(x?, y?) |
Scroll page (default: down 200px) |
Interaksi DOM
| Tool | Description |
|---|---|
browser_extract_dom() |
List semua elemen interaktif (button, input, link) + CSS selector |
browser_click(selector) |
Klik element berdasarkan CSS selector |
browser_type(selector, text) |
Ketik teks ke input |
browser_type_guess(selector, input_type?) |
Auto-fill input (text/email/password/search/number) |
Screenshot & Visual
| Tool | Description |
|---|---|
browser_screenshot() |
Screenshot halaman saat ini |
browser_screenshot_diff(name, threshold?) |
Screenshot + diff dengan baseline. Threshold default 0.01 (1%) |
browser_highlight(selector, color?, duration?) |
Highlight element dengan outline |
JavaScript & Network
| Tool | Description |
|---|---|
browser_execute(js_code) |
Execute JavaScript di page context |
browser_inject_script(script, url_pattern?) |
Inject JS sebelum page load (mock API, polyfills) |
browser_network_capture(mode, patterns?) |
Intercept network requests (mode: start/stop/get) |
browser_block_resources(patterns) |
Block resources by glob pattern (*.jpg, *.png, analytics) |
Console & Error
| Tool | Description |
|---|---|
browser_console() |
Ambil captured console logs |
browser_errors() |
Ambil captured JS runtime errors |
Cookies & Storage
| Tool | Description |
|---|---|
browser_get_cookies() |
Get all cookies |
browser_set_cookie(name, value, domain?, path?) |
Set cookie |
browser_clear_cookies() |
Clear all cookies |
browser_storage(mode, storage?, key?, value?) |
localStorage/sessionStorage access (all/get/set/clear) |
Report
| Tool | Description |
|---|---|
browser_report(results_json) |
Generate smoke test report markdown |
Background
| Tool | Description |
|---|---|
browser_offscreen(action, url?, js?) |
Hidden page untuk background processing (open/exec/close) |
Usage Guide
Basic Smoke Test
- Load skill
browser-smokedi OpenCode - Test flow:
browser_open(url="http://localhost:5173")
browser_extract_dom()
browser_click(selector="button:has-text('Login')")
browser_type(selector="input[type='email']", text="test@test.com")
browser_type(selector="input[type='password']", text="Test1234!")
browser_click(selector="button:has-text('Submit')")
browser_screenshot()
browser_console()
browser_errors()
browser_report(results_json)
browser_close()
Network Capture
browser_network_capture(mode="start", patterns="*.api.*,*.json")
# lakukan interaksi...
browser_network_capture(mode="get") # lihat request/response
browser_network_capture(mode="stop")
Script Injection
browser_inject_script(script="window.__TEST_MODE__=true")
browser_open(url="http://localhost:5173")
browser_execute(js_code="window.__TEST_MODE__") # → true
Visual Regression
browser_open(url="http://localhost:5173")
browser_screenshot_diff(name="homepage") # baseline (first run)
# setelah code change...
browser_screenshot_diff(name="homepage") # diff with baseline
Skill Integration
Setelah install, skill browser-smoke otomatis terdaftar. Di OpenCode:
skill browser-smoke
Skill ini menyediakan metodologi smoke testing lengkap dengan failure analysis loop.
Troubleshooting
| Masalah | Solusi |
|---|---|
browser_screenshot_diff gagal |
Pastikan mcp/tools/browser.py punya akses ke artifacts directory |
| Chromium error | playwright install chromium lagi |
| Connection refused | Pastikan app target jalan (npm run dev, dll) |
| Python not found | python3 --version, kalo error install Python dulu |
Development
git clone https://github.com/sukirman1901/browser-smoke.git
cd browser-smoke
npm link # biar bisa npx browser-smoke dari lokal
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.