browser-smoke

browser-smoke

Enables browser automation and smoke testing via Playwright, with tools for navigation, DOM interaction, screenshots, network capture, and more.

Category
Visit Server

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:

  1. Setup Python virtual environment
  2. Install dependencies (fastmcp, playwright, pixelmatch, Pillow)
  3. Install Chromium browser
  4. 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

  1. Load skill browser-smoke di OpenCode
  2. 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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured