Skip to main content
Glama

floorp-agent-native

Direct Gecko automation for Floorp and Firefox Unbranded ESR: no CDP, no remote debugging port, zero npm dependencies.

floorp-agent-native runs inside Gecko through a privileged Experiment add-on and per-tab JSWindowActors. External MCP or CLI agents drive tabs over a local IPC bridge using compact @eN ARIA snapshots, Readability Markdown, native Multi-Account Containers, a bounded HAR 1.2 ring buffer, and compiled routines that recover across UI changes without calling an LLM.

Simulator workbench: replaying a recorded workflow after a portal redesign renames three controls and inserts a banner

Simulator demo: an ops-portal update inserts a banner and renames "Status filter" -> "Webhook status", "Dry run only" -> "Dry run mode", and "Replay selected" -> "Retry selected webhooks". Replay recovers all three controls deterministically, saves routine v2, and completes without calling a model.

Try the simulator workbench shown above right away (from a source checkout, Node.js 24+):

node bin/cli.mjs serve --port 4399

Quickstart: Live Isolated Floorp Session

launch packages the add-on .xpi in pure Node.js, creates an isolated profile directory (explicitly refusing primary ~/.floorp, ~/.mozilla/firefox, and %APPDATA%\Floorp\Profiles paths, including through symlinks), waits for a nonce-bound readiness handshake, and passes FLOORP_AGENT_TOKEN strictly via environment variables rather than user.js or prefs.js.

# Terminal 1 (generate a per-session secret once; add --allow-privileged only for prefs.set/addons.install/cookies.*):
export FLOORP_AGENT_TOKEN="$(node -e "console.log(require('crypto').randomBytes(24).toString('hex'))")"
node bin/cli.mjs launch --browser floorp --headless --session live

# Terminal 2 (export the same FLOORP_AGENT_TOKEN, then discover a container, open a tab, and inspect its snapshot):
node bin/cli.mjs doctor --session live --json
CONTAINER_ID="$(node bin/cli.mjs rpc containers.list '{}' --session live | node -e "const r=JSON.parse(require('fs').readFileSync(0,'utf8')); console.log((r.containers||r)[0].cookieStoreId)")"
TAB_ID="$(node bin/cli.mjs rpc tabs.open "{\"url\":\"https://example.org\",\"cookieStoreId\":\"$CONTAINER_ID\"}" --session live | node -e "const r=JSON.parse(require('fs').readFileSync(0,'utf8')); console.log(r.tabId)")"
node bin/cli.mjs rpc page.snapshot "{\"tabId\":$TAB_ID}" --session live
# Pick a specific @eN ref printed by page.snapshot before calling page.act:
# node bin/cli.mjs rpc page.act "{\"tabId\":$TAB_ID,\"ref\":\"@e1\",\"action\":\"click\"}" --session live

On PowerShell, set the secret with $env:FLOORP_AGENT_TOKEN = node -e "console.log(require('crypto').randomBytes(24).toString('hex'))".

Connect an MCP Client

Pass the token through env instead of CLI args so it stays out of process listings. Omit --connect to run against the offline simulator; on macOS/Linux point --connect at $XDG_RUNTIME_DIR/floorp-agent-native/live.sock (or ~/.local/state/floorp-agent-native/live.sock).

{
  "mcpServers": {
    "floorp-agent-native": {
      "command": "node",
      "args": ["/path/to/floorp-agent-native/bin/cli.mjs", "mcp", "--connect", "\\\\.\\pipe\\floorp-agent-native-live"],
      "env": {
        "FLOORP_AGENT_TOKEN": "your-session-token"
      }
    }
  }
}

If installed globally (npm install -g), replace node bin/cli.mjs with the floorp-agent binary.

Manual Profile Staging (Optional)

To register the Native Messaging host for a separate long-lived profile (while loading the temporary add-on via about:debugging):

node bin/cli.mjs install-plan --write-dir ./staged-floorp-host

Copy staged-floorp-host/user.js into a duplicated profile (never your daily profile), register the generated Native Messaging manifest, load addon/manifest.json in about:debugging, and verify with node bin/cli.mjs doctor.

Related MCP server: firefox-bridge

Why Build Inside Gecko?

Playwright and CDP MCP servers already extract accessibility trees and isolate cookie jars per BrowserContext, and they remain the right choice for cross-browser CI. Running inside Gecko instead gives you capabilities that CDP/WebDriver BiDi do not expose:

  • Persistent Multi-Account Containers (contextualIdentities): Separate agent cookie jars inside native Floorp/Firefox container tabs in a shared window, so a human handoff keeps the exact container session intact.

  • No DevTools or remote debugging port: JSWindowActor snapshots hold element references with WeakRef and clear the actor map on tab close, while webRequest.filterResponseData (StreamFilter) writes into a capped HAR 1.2 ring buffer chunked below Firefox's 1 MiB Native Messaging frame limit.

  • Zero-LLM compiled routines: Repeated flows compile into semantic-anchor routines that replay deterministically and self-heal across label/layout drift while blocking silent healing onto destructive actions (delete, pay, transfer) unless allowHealDestructive: true is set.

  • Explicit human handoff: When humanGate.detected flags a login or verification challenge, tabs.handoffHuman surfaces that tab to a visible window and pauses at a version-pinned checkpoint.

Architecture & Process Boundaries

flowchart LR
    Agents["External Agents (MCP / CLI)"] <--> IPC["Local IPC Broker (Named Pipe / 0600 Unix Socket + Token)"]
    Sidebar["In-Browser Agent Sidebar"] <--> BG
    IPC <-->|"4-byte LE Framing: Subprocess or Native Messaging"| BG["Privileged Add-on (addon/background.js)"]
    BG --> Exp["Gecko Experiment API (Services.prefs, AddonManager, resource actors)"]
    BG --> Native["WebExtensions (contextualIdentities, cookies, webRequest)"]
    BG <--> Actors["JSWindowActorParent / Child (WeakRef @eN, Readability)"]
    Native --> HAR["Bounded HAR 1.2 Ring Buffer (900 KiB max chunks)"]
  • Chrome process (addon/experiment/api.js, AgentNativeParent.sys.mjs): Registers per-tab actors, connects to the host over Subprocess.sys.mjs (or Native Messaging), and enforces opt-in guards around Services.prefs and AddonManager.

  • Content process (AgentNativeChild.sys.mjs): Produces Readability Markdown and @eN ARIA trees, pierces open Shadow DOM, checks pixel occlusion via document.elementFromPoint, and redacts <input type="password"> values before IPC serialization.

  • Local Node.js host (host/, routines/, bin/cli.mjs): Runs unprivileged outside Gecko, providing the MCP stdio server, CLI JSON-RPC client, routine compiler/runner, and local inspection workbench.

Compiled Routines & 3-Tier Recovery

End-to-end routine lifecycle (example against an active $TAB_ID)

# 1. Record a workflow on an open tab:
node bin/cli.mjs rpc routines.recordStart "{\"id\":\"ops-check\",\"name\":\"Ops Check\",\"tabId\":$TAB_ID}" --session live
node bin/cli.mjs rpc page.act "{\"tabId\":$TAB_ID,\"ref\":\"@e4\",\"action\":\"select\",\"value\":\"failed\"}" --session live
node bin/cli.mjs rpc routines.recordStop '{"autoSave":true}' --session live

# 2. Replay with dry-run healing enabled (returns runId if paused for Tier-2 repair):
node bin/cli.mjs rpc routines.run "{\"routineId\":\"ops-check\",\"tabId\":$TAB_ID,\"dryRunHeals\":true,\"pauseForHeal\":true}" --session live

# 3. Other independent routine commands (pattern mining, Tier-2 resume, and revision rollback):
node bin/cli.mjs rpc routines.suggest '{"minOccurrences":2}' --session live
node bin/cli.mjs rpc routines.resume '{"runId":"<runId-from-routines.run>","healRef":"@e4","expectedSnapshotVersion":2}' --session live
node bin/cli.mjs rpc routines.rollback '{"routineId":"ops-check","version":1}' --session live

Recovery tiers when a page changes:

  1. Tier 0 (Exact semantic match): Multi-signal anchor (role, label tokens, name, hrefPath, heading + neighbor context) resolves uniquely on the bound origin.

  2. Tier 1 (Deterministic heuristic heal): Scores same-role candidates (never crossing password boundaries or mismatched input types) with minimum confidence 0.68, runner-up margin >= 0.12, and a destructive-action guard. In the simulator GIF above, the three renamed controls matched at Tier 1 with confidences 0.75 (Status filter -> Webhook status), 0.83 (Dry run only -> Dry run mode), and 0.80 (Replay selected -> Retry selected webhooks).

  3. Tier 2 (Single-step agent repair): Calls an in-process healer hook or pauses (status: "awaiting_heal") with the compact @eN snapshot so an external agent can resume via routines.resume.

Anchor patches buffer in memory and commit as a new version (max 10 revisions) only after the whole routine and its post-conditions pass. Routine persistence writes nothing to disk unless --routines-file <path> is passed (on Unix, stored with 0o600 atomic temp-file writes and lockfile conflict checks).

Verification & Browser Compatibility

From a source checkout on Node.js 24 (GitHub Actions CI runs npm test, npm run benchmark, and a packed CLI smoke check outside the checkout on Ubuntu and Windows; live browser E2E runs locally where Floorp is installed):

npm test                                    # 30 offline unit + integration tests
npm run benchmark                           # 2,000-cycle permission-scoped simulator soak
node --test tests/e2e/real-floorp.test.mjs  # Local live Floorp E2E (requires installed binary + HTTPS)

Live-Verified Build: Floorp 12.21.3 (Gecko 161.0)

Verified locally via tests/e2e/real-floorp.test.mjs (isolated headless profile, zero DevTools/CDP, 18.0–20.9 s wall time):

  • Public HTTPS & streaming HAR: Loaded Wikipedia (across a live 301 redirect in firefox-container-1) and Hacker News; extracted compact Markdown (11,999 chars vs. 131,072-char capped raw HTML), 150 Wikipedia / 120 HN @eN refs, incremental page.diff, and StreamFilter response bodies under the byte cap.

  • Shadow DOM, occlusion & focus defenses: Verified <label for>, password redaction, document.elementFromPoint modal occlusion (ELEMENT_OBSCURED), open Shadow DOM piercing, async MutationObserver waits, history.pushState wakeups, and synchronous onfocus type-flip / pushState hijack defenses.

  • Containers, routines & privileged guards: Verified HttpOnly cookie isolation across containers, live record -> DOM drift -> Tier-1 heal -> auto-patch -> Tier-0 -> Tier-2 pause/resume -> human-gate resume, Services.prefs protection of extensions.agentNative.*, and AddonManager out-of-root .xpi refusal.

  • 25-cycle live soak: nsIMemoryReporterManager.residentFast settled around ~532–550 MiB across 25 live tab lifecycles; the tracked @eN ref count returned to 0 after each lifecycle and the HAR ring stayed within 55–92 KiB after 120–134 evictions.

Observed Simulator Teardown & Benchmark

Across 3 permission-scoped npm run benchmark runs (Node.js v24.19.0, Windows x64, 2,000 synthetic cycles, heuristic BPE estimator, 512 KiB / 200-entry HAR cap):

  • Throughput: ~4,530–4,610 simulated cycles/s

  • Estimated token savings vs. raw fixture HTML: ~95% Readability MD, ~92% @eN ARIA tree, ~76% turn diff vs. @eN

  • Teardown & heap: 0 tracked refs after teardown, HAR ring capped at 128 / 512 KiB, ~0 MiB net heap drift (-0.01 MiB measured) across a 6,000-cycle GC soak

Browser Support Matrix

Browser

Status

Notes

Floorp 12.21.3 (Gecko 161.0)

Live-verified

MOZ_REQUIRE_SIGNING=false and extensions.experiments.enabled=true by default; passes full E2E

Other Floorp 12.x builds

Target

Same Experiment APIs; verify against your installed build with tests/e2e/real-floorp.test.mjs

Firefox Unbranded ESR / Dev / Nightly

Target (via user.js)

Requires extensions.experiments.enabled=true and xpinstall.signatures.required=false

Zen Browser / LibreWolf (release)

Unsupported on release builds

Release builds enforce signing; requires an unsigned/unbranded build and fork-specific Native Messaging paths

Security Boundaries & Trade-offs

  • Least-privilege default: prefs.set/restore, addons.install/setEnabled/uninstall, and cookies.* stay disabled unless --allow-privileged is explicitly passed. addons.install also denies all paths until extensions.agentNative.allowedAddonDirs is set (blocking UNC/SMB, traversal, and symlinks).

  • Local transport controls: The workbench enforces loopback Host + Origin checks, frame-ancestors 'none', nosniff, and a per-boot X-Agent-Token on /api/*. Unix IPC sockets require 0o700 parent directories and 0o600 socket permissions; Windows Named Pipes do not use POSIX modes, so always set FLOORP_AGENT_TOKEN when binding a Named Pipe.

  • HAR scope: webRequest.filterResponseData captures textual response bodies up to maxBodyBytesPerEntry and disconnects on cap (skipping binary/3xx responses). Socket-level DNS/TLS timings and service-worker internals are outside its scope.

Protocol Reference (51 Methods Across 10 Namespaces)

Namespace

Methods

Default Policy

system.* (3)

health, memoryStats, hibernateIdleTabs

Enabled

tabs.* (6)

list, open, openBackgroundWindow, close, navigate, handoffHuman

Enabled

page.* (7)

read, snapshot, peekSnapshot, diff, rawHtml, act, waitFor

Enabled (passwords redacted)

containers.* (3)

list, create, remove

Enabled

har.* (4)

configure, export, clear, stats

Enabled

agent.* (3)

run, status, cancel

Enabled

routines.* (11)

recordStart, recordStop, suggest, list, get, save, delete, run, resume, rollback, siteMemory

Enabled

prefs.* (5)

get, list, snapshot (read-only by default); set, restore (--allow-privileged)

Split

addons.* (4)

list (read-only by default); install, setEnabled, uninstall (--allow-privileged + allowedAddonDirs)

Split

cookies.* (5)

list, set, remove, exportJar, importJar

--allow-privileged

See docs/ARCHITECTURE.md for actor registration, wire framing, and security invariants.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Drive Firefox-based browsers (Floorp, LibreWolf, Zen, Waterfox, Mullvad, Firefox) from any MCP client — read pages, screenshot, click, fill forms and manage tabs in your real session, over Marionette/WebDriver. OS input & JS eval locked by default.
      41
      83 npm
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP-capable CLIs to operate real, already-logged-in Firefox tabs via a WebExtension and native messaging, without simulated input. Supports navigation, clicking, typing, reading, screenshots, and console/network capture with policy gating and frame awareness.
      3
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables an MCP client to drive a real, already-logged-in Firefox session through a WebExtension rather than a WebDriver connection, so tabs, cookies and logins work as-is without relaunching the browser under remote-control flags. Exposes tools for tab listing and selection, navigation, accessibility-style snapshots, clicking, filling, typing, key presses, file uploads, screenshots and waiting, with per-origin permission grants and opt-in script evaluation.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI coding agents to attach to a real Firefox session for DOM/CSS, console, network, JavaScript source, and breakpoint inspection, and to drive Windows desktop applications through UI Automation, screenshots, and native input. Runs entirely locally over MCP with no Firefox add-on or npm runtime dependencies.
      MIT