@bunbrowser/mcp

@bunbrowser/mcp

Ultra-fast, zero-download MCP server for browser automation powered by Bun.WebView. Provides 24 tools for navigation, interaction, screenshots, performance audits, and more, as a drop-in replacement for @playwright/mcp.

Category
访问服务器

README

⚡ @bunbrowser/mcp

GitHub Repository npm version Bun Version License: MIT

Ultra-fast, zero-download Model Context Protocol (MCP) server for browser automation, powered natively by Bun.WebView.

A 100% drop-in lightweight replacement for @playwright/mcp with identical AI tool semantics, native isTrusted: true OS events, sub-50ms startup times, and zero binary bloat.


🚀 Why bunbrowser?

Feature @playwright/mcp (Official Playwright) @bunbrowser/mcp (Native Bun.WebView)
Startup Latency ~500ms - 2.5s cold start < 50ms (Instantaneous)
Binary Downloads ~300MB - 1GB dedicated browser packages 0 MB (Uses Chrome/Chromium on Linux/Win or WKWebView on macOS)
Base Memory Footprint ~180MB - 350MB RAM ~25MB - 50MB RAM
Event Fidelity Synthetic via CDP JavaScript injection Native OS-level compositor events (isTrusted: true)
Accessibility Tree browser_snapshot with [ref=eN] Identical [ref=eN] format and prompt compatibility
Batch Form Filling Individual turns for each field Single-turn browser_fill_form
Performance & SEO Requires custom scripts Built-in browser_lighthouse_audit (0-100 scores) & browser_get_metrics
Motion & Animation Not exposed directly Built-in browser_record_animation (WebM & animated GIF)
Raw CDP Access Restricted Built-in browser_cdp tool

📚 Official Documentation (Diátaxis Framework)

The project documentation is structured using the Diátaxis Framework:

For a complete navigation map, see docs/index.md.


📦 Installation & Setup

1. Requirements

  • Bun (v1.3.12 or higher).
  • On macOS: Zero additional downloads (uses built-in WKWebView).
  • On Linux / Windows: Google Chrome, Chromium, Brave, or Microsoft Edge installed.

2. Configure in your MCP Client

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "playwright": {
      "command": "bunx",
      "args": ["@bunbrowser/mcp"]
    }
  }
}

Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "browser": {
      "command": "bunx",
      "args": ["@bunbrowser/mcp"]
    }
  }
}

Google Antigravity (~/.gemini/antigravity/mcp_config.json):

{
  "mcpServers": {
    "browser": {
      "command": "bunx",
      "args": ["@bunbrowser/mcp"]
    }
  }
}

CLI Execution with Custom Viewport:

bunx @bunbrowser/mcp --width 1920 --height 1080 --url "https://bun.sh"

🛠️ Complete MCP Tools Catalog (24 Tools)

🌐 Navigation

  • browser_navigate: Navigate to a URL with optional accessibility snapshot.
  • browser_navigate_back: Navigate back in history.
  • browser_navigate_forward: Navigate forward in history.
  • browser_reload: Reload active page.

🔍 Inspection & State

  • browser_snapshot: PRIMARY INSPECTION. Captures semantic accessibility tree with [ref=eN] IDs.
  • browser_take_screenshot: Visual viewport screenshot in Base64 (PNG, JPEG, WebP).
  • browser_evaluate: Evaluates JavaScript in page context.
  • browser_get_content: Returns full HTML markup or plain text.
  • browser_console_logs: Retrieves recorded console logs.

🖱️ Element Interaction

  • browser_click: Clicks element via ref, CSS selector, or coordinates.
  • browser_type: Types text into input elements with auto-wait.
  • browser_fill_form: BATCH FORM FILLER. Fills multiple inputs and submits in a single turn.
  • browser_press_key: Dispatches keyboard keys and key combinations.
  • browser_hover: Moves mouse pointer over an element.
  • browser_scroll: Directional, delta-based, or element-targeted scrolling.
  • browser_select_option: Selects options in <select> dropdowns.
  • browser_drag: Drag-and-drop between source and destination elements.

📑 Tab Management

  • browser_tabs: Lists all open tabs and active state.
  • browser_tab_new: Opens a new tab with optional URL and viewport size.
  • browser_tab_switch: Switches active tab focus by tabId.
  • browser_tab_close: Closes a specific tab or active tab.
  • browser_resize: Resizes viewport dimensions.

⚡ Storage & CDP

  • browser_cdp: Executes raw Chrome DevTools Protocol commands.
  • browser_cookies: Gets, sets, or clears browser session cookies.
  • browser_localstorage: Gets, sets, or clears localStorage keys.

📊 Performance & Lighthouse Audits

  • browser_get_metrics: Real-time network timings (TTFB, DOM load), JS heap memory, and resource waterfalls.
  • browser_lighthouse_audit: Full Lighthouse audit with 0-100 scores for Performance, Accessibility, Best Practices, and SEO.

🎬 Video Recording & Motion

  • browser_start_recording: Starts continuous video recording (webm or gif).
  • browser_stop_recording: Stops recording and exports file with duration and size metrics.
  • browser_record_animation: One-shot recording of UI transitions and keyframe animations for a given durationMs.

🧪 Automated Testing

Run the complete test suite:

# Run unit & integration tests
bun test

# Verify strict TypeScript types
bun run check

📂 Codebase Structure

bunbrowser/
├── bin/
│   ├── bunbrowser.ts         # CLI binary executable
│   └── bunpw-mcp.ts          # Legacy compatibility wrapper
├── src/
│   ├── index.ts              # Entrypoint CLI & Stdio transport
│   ├── server.ts             # McpServer instance & tool registration
│   ├── browser/
│   │   ├── types.ts          # TypeScript interfaces & configuration types
│   │   ├── manager.ts        # BrowserManager (multi-tab lifecycle)
│   │   ├── tab.ts            # BrowserTab wrapper over Bun.WebView
│   │   ├── recorder.ts       # TabRecorder video & animation capture
│   │   ├── gif_encoder.ts    # Pure TypeScript GIF89a encoder (0 dependencies)
│   │   └── snapshot.ts       # Accessibility Tree & ref resolver
│   └── tools/
│       ├── navigation.ts     # Navigation tools
│       ├── inspection.ts     # Snapshot, screenshot, evaluate, content, logs
│       ├── interaction.ts    # Click, type, fill_form, press_key, hover, scroll, drag
│       ├── tabs.ts           # Tabs management & resize
│       ├── storage_cdp.ts    # CDP, cookies, localStorage
│       ├── metrics.ts        # get_metrics, lighthouse_audit
│       └── video.ts          # start_recording, stop_recording, record_animation
├── test/
│   ├── manager.test.ts       # Tab manager tests
│   ├── snapshot.test.ts      # Accessibility tree tests
│   ├── interaction.test.ts   # Real DOM interaction tests
│   ├── metrics.test.ts       # Metrics & Lighthouse audit tests
│   ├── video.test.ts         # Video recording & GIF encoder tests
│   └── mcp_server.test.ts    # End-to-end MCP JSON-RPC tests
└── docs/                     # Diátaxis framework documentation
    ├── 1-tutorials/
    ├── 2-how-to/
    ├── 3-reference/
    └── 4-explanation/

📄 License

MIT License. See LICENSE for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选