Skip to main content

Browser Bridge server and CLI for controlling a Chrome extension over WebSocket

Project description

browser-agent-bridge

Browser Bridge server + CLI for controlling a Chrome extension over WebSocket.

This repository contains:

  • Python package: browser_bridge/ (server + CLI)
  • Chrome extension: extension/ (unpacked dev-mode install)

Features

  • Session-based auth with separate agent_token and extension_token
  • FastAPI server with HTTP command API + extension WebSocket endpoint
  • CLI for session creation, status checks, and command execution
  • Replay protection via X-Request-ID

Install (Recommended: pipx)

python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install browser-agent-bridge

Verify:

browser-bridge --version
browser-bridge-server --help

Upgrade:

pipx upgrade browser-agent-bridge

Install From Source

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Quick Start

1) Start server

browser-bridge-server

Server defaults to http://127.0.0.1:8765.

2) Create session

browser-bridge create-session --name local

Example output:

{
  "agent_token": "...",
  "agent_token_expires_at": "...",
  "extension_token": "...",
  "extension_token_expires_at": "...",
  "saved_as": "local",
  "session_id": "...",
  "ws_url": "ws://127.0.0.1:8765/ws/extension/...?..."
}

3) Load extension (unpacked)

  1. Open chrome://extensions.
  2. Enable Developer mode.
  3. Click Load unpacked.
  4. Select the extension/ folder from this repository.
  5. Open extension popup and fill:
    • Bridge Server Base URL: http://127.0.0.1:8765
    • Session ID: the session_id from CLI
    • Extension Token: the extension_token from CLI
  6. Click Save, then Connect.

4) Verify roundtrip

browser-bridge status --name local
browser-bridge observe --name local

Optional raw command examples:

browser-bridge command --name local --type get_html --payload '{"max_chars":50000}'
browser-bridge command --name local --type click --payload '{"selector":"button"}'

Server Configuration

Environment variables:

  • BRIDGE_JWT_SECRET (required for non-dev usage)
  • BRIDGE_AGENT_TOKEN_TTL_S (default: 3600)
  • BRIDGE_EXTENSION_TOKEN_TTL_S (default: 86400)
  • BRIDGE_ALLOWED_ORIGIN_PREFIXES (comma-separated origin prefixes)

Security Notes

  • Prototype is development-oriented.
  • Tokens are sensitive. Do not share them.
  • For non-local deployments, use https:// and wss://.
  • Set a strong BRIDGE_JWT_SECRET for any non-local usage.

Testing

pytest -v

Build

python -m build
python -m twine check dist/*

CI and Publishing

GitHub Actions workflows:

  • .github/workflows/ci.yml: tests + package checks
  • .github/workflows/publish.yml: publishes to PyPI on tag push (v*)

PyPI trusted publishing setup

  1. Create project browser-agent-bridge on PyPI.
  2. Add Trusted Publisher in PyPI settings:
    • Owner: your GitHub org/user
    • Repository: this repository
    • Workflow: publish.yml
    • Environment: pypi
  3. In GitHub settings, create environment pypi (optional protection rules).

Release

pytest -v
python -m build
python -m twine check dist/*
git tag v0.1.0
git push origin v0.1.0

Tag push triggers the publish workflow.

License

MIT (see LICENSE).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

browser_agent_bridge-0.1.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

browser_agent_bridge-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file browser_agent_bridge-0.1.0.tar.gz.

File metadata

  • Download URL: browser_agent_bridge-0.1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for browser_agent_bridge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4f77a748c6aadf0df50290ab40d3b59f83f55be35103d7ba91e1d2247b60b01c
MD5 d3e491f9e5aff50c1c457fab4a9a82e9
BLAKE2b-256 3f757e05e2452489b02039abf872e20191d7774bda61eae8d236980772ba4f6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for browser_agent_bridge-0.1.0.tar.gz:

Publisher: publish.yml on NmadeleiDev/browser_agent_bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file browser_agent_bridge-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for browser_agent_bridge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 937310d7504b55410996820c0e462fa7ffc485b80ecd4681c59ff3eaf2d7cee1
MD5 5f4617fe9c1b9706511c753735816fbc
BLAKE2b-256 65165d823238e1746d839e964c5a45deb7e1fc5495056d3b5b4f19ca40838804

See more details on using hashes here.

Provenance

The following attestation bundles were made for browser_agent_bridge-0.1.0-py3-none-any.whl:

Publisher: publish.yml on NmadeleiDev/browser_agent_bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page