Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Chrome Extension

The victauri-browser crate provides MCP access to any website running in Chrome, Edge, Brave, or Arc — not just Tauri applications.

What It Does

The Chrome extension + native messaging host extends Victauri’s inspection capabilities to regular web pages. An AI agent can connect via MCP on localhost:7474 and get DOM snapshots, interact with elements, evaluate JavaScript, inspect styles, and more — all on arbitrary websites.

This is useful for:

  • Web scraping with semantic understanding
  • Cross-site testing workflows
  • Automating web tasks that span both Tauri apps and web services
  • General browser automation via MCP

Installation

1. Install the Native Host Binary

cargo install victauri-browser

Or build from source:

cargo build -p victauri-browser --release

2. Register the Native Messaging Host

victauri-browser install

This registers the native messaging host manifest with your browser (Chrome, Edge, Brave, or Arc are auto-detected). The manifest tells the browser how to launch the native host when the extension requests it.

To uninstall:

victauri-browser uninstall

3. Load the Chrome Extension

  1. Open your browser’s extension management page (chrome://extensions)
  2. Enable “Developer mode”
  3. Click “Load unpacked” and select the extensions/chrome/ directory from the Victauri repo

4. Connect via MCP

The native host starts an HTTP server on localhost:7474 (with fallback to 7475-7484 if the port is busy).

{
  "mcpServers": {
    "victauri-browser": {
      "url": "http://127.0.0.1:7474/mcp"
    }
  }
}

Architecture

The communication flow:

MCP Client (Claude Code)
    │
    │ HTTP (localhost:7474)
    ▼
Native Host Binary (victauri-browser)
    │
    │ Chrome Native Messaging (stdio)
    │ 32-bit LE length prefix + UTF-8 JSON
    ▼
Extension Service Worker (MV3)
    │
    │ chrome.tabs.sendMessage()
    ▼
Content Script (ISOLATED world)
    │
    │ CustomEvent (__victauri_command / __victauri_response)
    ▼
JS Bridge (MAIN world)
    │
    │ Direct DOM access
    ▼
Web Page

Components

Native Host Binary (victauri-browser)

  • Dual role: HTTP server for MCP clients AND native messaging host for Chrome
  • axum router serves /mcp (MCP protocol), /api/tools (REST), /health, /info
  • Reads/writes Chrome native messaging format on stdio
  • BridgeDispatch sends UUID-tagged commands and resolves responses via oneshot channels

Service Worker (MV3 background script)

  • Manages native messaging connection lifecycle
  • Routes commands to the correct tab’s content script
  • Handles tab lifecycle (creation, removal, navigation)
  • Manages CDP sessions for advanced features

Content Script (ISOLATED world)

  • Relay between service worker and MAIN world bridge
  • Uses CustomEvent pattern to cross the world boundary
  • Injected into all pages matching the extension’s permissions

JS Bridge (MAIN world, 1700+ lines)

  • Full DOM inspection, interactions, accessibility, performance
  • Same Playwright-grade actionability checks as the Tauri plugin bridge
  • CSS inspection, recording, element finding, scroll, hover, click

Available Tools (20)

ToolDescription
get_plugin_infoExtension version and status (handled locally)
tabs.listList open browser tabs (handled locally)
dom_snapshotFull accessible DOM tree of active tab
find_elementsSearch by CSS selector, text, or role
eval_jsEvaluate JavaScript in page context
clickClick an element by ref
fillSet input value
type_textType characters one-by-one
press_keyDispatch keyboard event
hoverHover over element
scroll_into_viewScroll element into viewport
get_stylesComputed CSS for an element
get_bounding_boxesElement dimensions and box model
highlight_elementDraw debug overlay
clear_highlightsRemove all overlays
screenshotCapture visible tab as PNG
navigateGo to URL
get_cookiesGet cookies for current domain
get_console_logsCaptured console entries
get_network_logFetch/XHR request history

Authentication

The native host supports Bearer token authentication:

# Set via environment variable
VICTAURI_AUTH_TOKEN=my-token victauri-browser serve

Security features:

  • Constant-time token comparison
  • Token-bucket rate limiter
  • Security headers on all responses
  • Origin guard (blocks non-localhost origins)

Port Behavior

Default port: 7474. If busy, tries 7475 through 7484. The victauri-browser serve command prints the actual port on startup.

Tab Management

The extension tracks tab state (URL, title, bridge readiness). Commands are sent to the active tab by default, or you can target a specific tab by ID using the tab_id parameter where supported.

Special behaviors:

  • Navigation uses chrome.tabs.update() (not content script window.location) for reliability
  • Cookies use chrome.cookies.getAll() for httpOnly access
  • Screenshots use Chrome’s chrome.tabs.captureVisibleTab() API