No description
  • Rust 62.9%
  • Shell 23.3%
  • HTML 11.6%
  • Makefile 2.2%
Find a file
despiegk a81098c17e
All checks were successful
Test / test (push) Successful in 2m31s
Build and Test / build (push) Successful in 3m48s
Sync
2026-02-23 11:56:20 +03:00
.claude feat: Add integration documentation panel to admin UI 2026-02-21 09:15:04 +03:00
.forgejo/workflows ci: restrict test triggers to PRs and push to development/main 2026-02-11 19:10:03 -05:00
crates Sync 2026-02-23 11:56:20 +03:00
docs docs: Add comprehensive MCP integration guides and fix make run 2026-02-21 09:13:06 +03:00
rhaiexamples feat: Add user install script and update README 2026-01-04 18:15:26 +01:00
scripts Add build_lib standardization: buildenv.sh, scripts/build_lib.sh, Makefile, CI workflows 2026-02-07 09:48:03 +04:00
static improve: Use event delegation for session selection instead of inline onclick 2026-02-21 11:31:22 +03:00
.gitignore Add docs 2025-12-29 17:11:22 +02:00
build.sh chore: rename hero-browser -> hero_browser (binary, package, CI, source) 2026-01-29 18:59:04 -05:00
build_package.sh Restructure to unified binary with MCP server and Rhai scripting support 2026-01-04 17:00:39 +01:00
buildenv.sh Restructure project into Cargo workspace with multiple crates 2026-02-22 06:17:41 +03:00
Cargo.toml Restructure project into Cargo workspace with multiple crates 2026-02-22 06:17:41 +03:00
install.sh Restructure to unified binary with MCP server and Rhai scripting support 2026-01-04 17:00:39 +01:00
Makefile Restructure project into Cargo workspace with multiple crates 2026-02-22 06:17:41 +03:00
README.md Restructure project into Cargo workspace with multiple crates 2026-02-22 06:17:41 +03:00
release.sh Restructure to unified binary with MCP server and Rhai scripting support 2026-01-04 17:00:39 +01:00
ROADMAP_SUMMARY.md Add executive summary of feature roadmap and implementation strategy 2026-01-04 17:18:01 +01:00
start.sh chore: rename hero-browser -> hero_browser (binary, package, CI, source) 2026-01-29 18:59:04 -05:00

Hero Browser

Headless browser automation with MCP protocol support and Rhai scripting.

Architecture

Multi-crate workspace following Hero OS best practices:

hero_browser_mcp/
├── Cargo.toml              (workspace root)
├── Makefile                (orchestration)
├── crates/
│   ├── hero_browser_sdk/    (lib: types, browser pool, activity log)
│   ├── hero_browser_server/ (bin: MCP daemon, REST API, Unix socket)
│   ├── hero_browser/        (bin: CLI client, health check, script runner)
│   ├── hero_browser_ui/     (bin: Axum HTTP admin dashboard)
│   └── hero_browser_rhai/   (lib: Rhai scripting bindings)

Dependency Graph

hero_browser_sdk  (no internal deps)
     ↑         ↑          ↑           ↑
     |         |          |           |
  server     CLI         UI        rhai

Sockets & Ports

Component Socket Port
Server (MCP) ~/hero/var/sockets/hero_browser_server.sock 8884
Admin UI ~/hero/var/sockets/hero_browser_ui.sock 8885

Features

  • MCP Server: Control browsers via Model Context Protocol (HTTP transport)
  • Rhai Scripting: Write automation scripts with a simple scripting language
  • Shebang Support: Run scripts directly with #!/usr/bin/env hero_browser
  • Visible Mode: Debug scripts by watching the browser in action with --show flag
  • Admin Dashboard: Monitor sessions and activity in real-time

Quick Start

# Build all binaries
make build

# Run server + health check + UI (full orchestration)
make run

# Run only the MCP server (port 8884)
make run-server

# Run with visible browser windows
make run-server-show

# Run only the admin UI (port 8885)
make run-ui

# Health check
hero_browser health

Installation

Build from Source

git clone https://forge.ourworld.tf/lhumina_code/hero_browser
cd hero_browser
make build
make install   # installs to ~/hero/bin/

Requirements

  • Google Chrome (macOS) or Chromium (Linux)
  • Rust 1.92+

MCP Server

The hero_browser_server binary provides a Model Context Protocol server for Claude Code integration.

# Start MCP server (auto-configures with Claude Code)
hero_browser_server --port 8884

# With visible browsers
hero_browser_server --show --port 8884

API endpoints:

  • POST /mcp - MCP protocol endpoint (streamable HTTP)
  • GET /api/sessions - List active browser sessions
  • GET /api/activity - Recent MCP activity log
  • GET /api/activity/{browser_id} - Session-specific activity

Claude Code Configuration

The server auto-configures on startup. Manual setup:

claude mcp add --transport http hero_browser http://localhost:8884/mcp

Admin Dashboard

The hero_browser_ui binary provides a web dashboard for monitoring.

hero_browser_ui --port 8885 --server-url http://localhost:8884

Open http://localhost:8885/ to see live sessions, activity logs, and stats.

CLI

The hero_browser binary provides a CLI for scripts and health checks.

# Run a Rhai script
hero_browser script.rhai

# Run with visible browser
hero_browser --show script.rhai

# Check server health
hero_browser health

Available Functions

Browser Lifecycle

  • browser_create() - Create new browser, returns browser_id
  • browser_create_with_options(opts) - Create with options
  • browser_destroy(browser_id) - Close browser
  • browser_list() - List active browser IDs

Page Operations

  • page_create(browser_id) - Create new page
  • page_navigate(browser_id, page_id, url) - Navigate to URL
  • page_navigate_back/forward(browser_id, page_id) - History navigation
  • page_url/content/title(browser_id, page_id) - Get page info
  • page_screenshot(browser_id, page_id) - Take screenshot (base64)
  • page_screenshot_save(browser_id, page_id, path) - Save screenshot
  • page_close(browser_id, page_id) - Close page

Element Interaction

  • element_click(browser_id, page_id, selector) - Click element
  • element_type(browser_id, page_id, selector, text) - Type text
  • element_hover(browser_id, page_id, selector) - Hover
  • element_wait(browser_id, page_id, selector, timeout_ms) - Wait for element
  • element_drag_drop(browser_id, page_id, source, target) - Drag and drop

JavaScript, Cookies, Network, Accessibility

  • js_execute(browser_id, page_id, script) - Execute JavaScript
  • cookies_get/set/delete(...) - Cookie management
  • network_install/requests/clear(...) - Network monitoring
  • accessibility_tree/snapshot(...) - Accessibility info
  • console_install/messages/clear(...) - Console capture
  • viewport_set/set_mobile(...) - Viewport control
  • key_press(browser_id, page_id, key) - Keyboard input
  • dialog_accept/dismiss(...) - Dialog handling

Documentation

License

Apache-2.0