Browser Gateway

io.github.browser-gateway由 GitHub 帳號 browser-gateway 發布v0.4.35更新於 Nov 6, 2026

AI browser tools with Chrome CDP. Navigate, screenshot, interact. Multi-provider failover.

概覽

AI 產生的概覽

透過 CDP 驅動 Chrome 的瀏覽器自動化 MCP 伺服器,可在多個瀏覽器供應商之間路由工作階段並自動容錯移轉。

可以做什麼
  • 一次呼叫即可把任意網址讀取為 markdown 或擷取螢幕截圖
  • 開啟瀏覽器工作階段並導覽、快照、點擊、輸入、等待、切換分頁、執行腳本與觀察頁面
  • 從頁面擷取結構化內容,並在多步驟操作中截圖
  • 在雲端、Docker 或本機 Chrome 供應商之間路由工作階段,支援自動容錯移轉與負載平衡
  • 以加密設定檔保存 Cookie 與網站儲存空間,並錄製工作階段回放
適用情境
適合助理需要讀取依賴 JavaScript 的頁面、填寫表單、登入或執行多步驟瀏覽器任務時;尤其適合希望用單一端點在多個瀏覽器供應商之間容錯移轉,或需要持久瀏覽器設定檔的情境。
執行需求
以 npm 套件形式在本機執行(npx browser-gateway mcp),需要 Node.js;會自動偵測並啟動 Chrome,也可連線既有的 CDP 端點。多供應商路由需要 gateway.yml 設定檔。選用的 BG_TOKEN 可啟用權杖驗證;供應商網址可能自帶權杖。
安裝前請注意
未設定 BG_TOKEN 時所有 /v1 路由皆無驗證,且 Docker 映像會綁定所有網路介面,因此只要連接埠可被本機以外存取就應設定 BG_TOKEN。瀏覽器工作階段可能登入、送出表單並在真實網站上操作,設定檔會把 Cookie 與儲存空間寫入磁碟。gateway.yml 中的供應商網址可能包含憑證。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Browser Gateway,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[browser-gateway]

browser-gateway

The open router for cloud browsers.
One endpoint that routes across every browser provider you use: automatic failover, persistent profiles, session replay, REST API, MCP server, dashboard.
Works unchanged with Puppeteer, Playwright, Stagehand, browser-use, and any MCP client.

[BrowserGateway is the #1 Tool of the Week on DevHunt]

[npm version] [npm downloads] [MIT license] [Node.js] [GitHub stars]

[Deploy on Railway]   [Deploy to Render]   [Deploy to DigitalOcean]   [Deploy to Koyeb]

Website  ·  Quick start  ·  MCP  ·  Profiles  ·  Replays  ·  REST API  ·  Dashboard  ·  Discord

[browser-gateway routes traffic across multiple browser providers, filling them by priority and failing over when one is saturated]


Overview

One endpoint. Multiple providers. Automatic failover when one is saturated or goes down.

Your app connects to ws://gateway:9500/v1/connect. The gateway picks the best available provider based on health, capacity, and your routing strategy. Providers can be cloud CDP services, Docker containers, or local Chrome instances.


Dashboard

A web dashboard ships with every install. Open http://localhost:9500/web after starting the gateway.

Overview. Active sessions, queue depth, provider health, connection endpoint, and a copy-paste quickstart for Puppeteer, Playwright, Stagehand, browser-use, and raw CDP.

[Dashboard overview page showing active sessions, queue depth, provider health, masked connection endpoint, and a tabbed quickstart with Puppeteer code]

REST API. Run screenshot, content extraction, and structured scraping endpoints from a form-driven UI, with profile selection and parameter reference inline.

[REST API page in the dashboard with three tabs (screenshot, content, scrape) and a form to capture a screenshot of a target URL with format and profile options]

Playground. Drive any provider live from the browser. Pick a provider and profile, type into the canvas as if it were a local browser, and watch the remote session in real time.

[Live playground page streaming a remote Chrome session showing yahoo.com loaded inside the dashboard canvas]


Features

Routing & reliability

  • Automatic failover - the next provider takes over the instant one fails, no client changes
  • Five load-balancing strategies - priority chain, round-robin, least-connections, latency-optimized, weighted
  • Per-provider concurrency limits - the gateway enforces maxConcurrent on every backend
  • Request queue - connections wait when every provider is saturated instead of failing immediately
  • Cooldown - failing providers are skipped and recover automatically after a TTL
  • Health checks - periodic connectivity probes mark providers unhealthy before clients hit them
  • Graceful shutdown - active sessions drain cleanly on SIGTERM and SIGINT
  • Session reconnect - a dropped client reconnects with ?sessionId=<X-Session-Id>; on a provider that issues a resume token (browserserve with its resume window on) it gets the same browser back with its pages, cookies and storage, otherwise a new browser on the same provider
  • Webhooks - fire on provider down, recover, and queue-overflow events

REST API

  • Screenshot - POST /v1/screenshot returns any URL as PNG or JPEG, full-page or scoped to a selector
  • Content extraction - POST /v1/content returns markdown, plain text, HTML, or a cleaned article
  • Scrape - POST /v1/scrape extracts structured data via CSS selectors or full-page formats
  • Pooled sessions - browser connections are reused across requests, like a database pool
  • Automatic retry - failed requests retry against a fresh page

Profiles — persistent browser state

  • Survive across sessions - cookies and localStorage are captured as you leave each page and on disconnect, and replayed on the next connect with the same id (IndexedDB too on browserserve)
  • Saved on any provider - every provider can load and save any profile; pin a provider to one profile only to route that profile's sessions there
  • Profiles never mix - a browser that still holds a different profile is refused. Anything else already in a reused browser (from sessions without a profile) is saved with the profile
  • One-line opt-in - add ?profile=acme to the WebSocket URL, the rest is automatic
  • Encrypted at rest - AES-256-GCM with envelope encryption, anti-swap binding, and a scrypt-derived KEK
  • Provider-agnostic - state is captured at the CDP level, so it replays against any provider
  • Per-profile locking - concurrent connects to the same id return HTTP 409 to prevent corruption
  • Export and import - encrypted .bgp blobs are portable between gateway installs
  • One-click enable - the dashboard wizard generates a strong key in your browser and writes it to config

See the Profiles docs for the full guide, security model, REST endpoints, and limitations.

Session replay — see what the agent saw

  • Frame-accurate visual record of every routed session, captured via CDP Page.startScreencast
  • Zero injection - no script runs inside the customer page, capture is fully out-of-band
  • Provider-agnostic - works with any backend that supports page screencast
  • Dashboard player - scrub through the recorded frames, switch between captured browser targets
  • Retention controls - configurable horizon, per-session byte cap, daily cleanup

See the Replays docs for the storage layout, REST endpoints, and tuning knobs.

MCP server for AI agents

  • One-call tools - fetch_page reads any url as markdown and screenshot_page captures it, each in a single call that opens and closes its own browser
  • Session tools - browser_session, browser_navigate, browser_snapshot, browser_act, browser_extract, browser_screenshot, browser_wait, browser_tabs, browser_evaluate, browser_observe for logins, forms and multi-step work
  • Fallback for coding agents - a Claude Code plugin sends Claude to fetch_page when its built-in web fetch is blocked, empty or needs JavaScript (/plugin marketplace add browser-gateway/browser-gateway); setup for Codex, Cursor and Gemini CLI in plugins/browser-gateway
  • Zero config - auto-detects Chrome and launches it on first tool use
  • Concurrent sessions - every agent gets its own browser, no shared state
  • Raw CDP - no Playwright or Puppeteer dependency
  • Compatible - Claude Code, Cursor, and any MCP-compatible client

Computer use for Claude and Gemini

  • Any browser for the model's own browser tool - runs Claude's browser and computer use tools and Gemini computer use on any provider behind the gateway
  • About ten lines - runClaudeLoop / runGeminiLoop take your own model call and handle actions, screenshots and results
  • Safe defaults - http and https only, private networks blocked, optional site allowlist, Gemini's confirm step for risky actions
  • No extra dependencies - browser-gateway/agent-tools/computer-use, tested on Node.js, Bun, Deno and the Cloudflare Workers runtime

Management

  • Dashboard - manage providers, watch sessions, and edit config from the browser
  • Provider CRUD - add, edit, delete, and test providers from the dashboard or API
  • Config editor - edit gateway.yml in-browser with syntax highlighting and validation
  • Auth - token-based, with a secure HttpOnly cookie for the dashboard
  • Protocol-agnostic - works with Playwright, Puppeteer, and any WebSocket protocol

Quick Start

As a WebSocket Proxy (for applications)

bash
npm install -g browser-gateway

Create gateway.yml:

yaml
version: 1
providers:  primary:    url: wss://provider.example.com?token=${PROVIDER_TOKEN}    limits:      maxConcurrent: 5    priority: 1
  fallback:    url: ws://my-playwright-server:4000    limits:      maxConcurrent: 10    priority: 2
bash
browser-gateway serve

Connect from your app:

typescript
// For CDP providersconst browser = await chromium.connectOverCDP('ws://localhost:9500/v1/connect');
// For Playwright run-server providersconst browser = await chromium.connect('ws://localhost:9500/v1/connect');

Or use the REST API — no WebSocket management needed:

bash
# Screenshotcurl -X POST http://localhost:9500/v1/screenshot \  -H "Content-Type: application/json" \  -d '{"url": "https://example.com"}' --output screenshot.png
# Extract content as markdowncurl -X POST http://localhost:9500/v1/content \  -H "Content-Type: application/json" \  -d '{"url": "https://example.com", "formats": ["markdown"]}'

These endpoints accept http and https URLs on public hosts only. Loopback, link-local and private-range addresses are refused, and hostnames are resolved and re-checked. To reach an internal host, list it under rest.allowedPrivateHosts in gateway.yml.

Dashboard at http://localhost:9500/web.

As an MCP Server (for AI agents)

Add to your Claude Code or Cursor config:

json
{  "mcpServers": {    "browser-gateway": {      "command": "npx",      "args": ["browser-gateway", "mcp"]    }  }}

No config files needed. The agent gets navigate, snapshot, screenshot, click, type, and evaluate tools through the gateway's routing layer.

See the MCP docs for all options.


Authentication

Set BG_TOKEN to require a token (or put it in a .env file):

bash
BG_TOKEN=my-secret-token browser-gateway serve
  • WebSocket clients pass the token as ?token= query param
  • API clients use Authorization: Bearer <token> header
  • Dashboard shows a login form, sets a secure HttpOnly cookie
  • Health endpoint (/health) is always public

Without BG_TOKEN every /v1/* route is unauthenticated, so the gateway binds to 127.0.0.1 instead of all interfaces. Set a token (or set HOST explicitly) to serve other machines. Without a token the gateway also refuses requests and WebSocket upgrades whose Host is not a loopback name, which blocks DNS-rebinding pages; BG_ALLOWED_HOSTS adds extra hostnames to that list.

The Docker image sets HOST=0.0.0.0, so a container started without BG_TOKEN accepts connections from any network that can reach its port. Set BG_TOKEN whenever the port is published beyond the local machine.


CLI

bash
# Proxy serverbrowser-gateway serve                    # Start the gateway + dashboardbrowser-gateway serve --port 8080        # Custom portbrowser-gateway serve --config path.yml  # Custom config
# MCP server for AI agentsbrowser-gateway mcp                      # Auto-detect Chrome, zero configbrowser-gateway mcp --headless           # Headless mode (for CI/Docker)browser-gateway mcp --cdp-endpoint ws:// # Connect to existing browserbrowser-gateway mcp --config gateway.yml # Multi-provider with failover
# Utilitiesbrowser-gateway check                    # Test provider connectivitybrowser-gateway version                  # Print versionbrowser-gateway help                     # Show help

API

EndpointMethodDescription
/v1/connectWebSocketConnect to a browser (the core feature)
/v1/screenshotPOSTTake a screenshot of any URL (docs)
/v1/contentPOSTExtract page content as markdown, text, or HTML (docs)
/v1/scrapePOSTExtract data via CSS selectors or full-page formats (docs)
/v1/statusGETGateway health + provider status + pool status
/v1/sessionsGETActive sessions
/v1/providersGET/POSTList or add providers
/v1/providers/:idPUT/DELETEUpdate or remove a provider
/v1/providers/:id/testPOSTTest provider connectivity
/v1/configGET/PUTRead or save config
/v1/config/validatePOSTValidate YAML without saving
/mcpPOSTMCP Streamable HTTP endpoint
/json/versionGETCDP discovery (for browser-use, Playwright, Stagehand)
/healthGETHealth check

Docker

Recommended: Docker Compose. The bundled docker-compose.yml mounts a named volume for state and a read-only gateway.yml from the host.

bash
# Drop your gateway.yml next to docker-compose.yml, then:docker compose up -d

Plain docker run:

bash
docker run -d \  -p 9500:9500 \  -v bg_data:/data \  -v ./gateway.yml:/app/gateway.yml:ro \  -e PROVIDER_TOKEN=xxx \  ghcr.io/browser-gateway/server:latest

Persistence

Everything the gateway writes to disk lives under a single directory, BG_DATA_DIR (defaults to /data inside the image). Mount that as a named volume or a bind mount and all state survives container restarts and image upgrades. Today it contains:

  • profiles/ — encrypted profile blobs (when profiles are enabled)

Future versions may add more subdirectories under the same root (cooldown state, session snapshots, captures). Mounting BG_DATA_DIR as one volume keeps every subsystem persistent without follow-up config changes.

Upgrades

State lives in the volume, code lives in the image. Pull the new image, recreate the container — no data lost:

bash
docker compose pulldocker compose up -d

The container reads the same BG_DATA_DIR and the same gateway.yml. Profile blobs are versioned and the gateway reads older formats transparently.

Image tags

TagUpdated on
:0.3.0 (and every subsequent version)published manually after a release
:latestalways points at the newest version

Images are multi-arch (linux/amd64, linux/arm64), signed with Sigstore build provenance, and ship an SBOM. Verify with the GitHub CLI:

bash
gh attestation verify oci://ghcr.io/browser-gateway/server:0.3.0 \  --repo browser-gateway/browser-gateway

How It Works

Sessions without profile / recording / observability (the default) take the byte-pipe fast lane:

  1. Client connects to ws://gateway:9500/v1/connect
  2. Gateway selects a provider using your routing strategy
  3. Gateway opens a raw TCP connection to the provider
  4. HTTP upgrade forwarded, provider responds with 101 Switching Protocols
  5. Bidirectional TCP pipe: client <-> gateway <-> provider
  6. All WebSocket messages forwarded transparently (never parsed or modified)
  7. On disconnect: session cleaned up, slot released, metrics updated
  8. If all providers full: connection waits in a queue until a slot opens

Sessions with profile inject, session recording, live view, or observability (e.g. ?profile=X, ?session_record=true, /v1/live) run through a CDP-aware pipeline instead — one WebSocket per session, N plugins observing the wire. Same routing + failover, byte-perfect passthrough at rest, plugins only fire when their feature is requested. Architecture + plugin-authoring guide: docs/PIPELINE.md.


Self-hosted provider: browserserve

browserserve is the stack's own self-hosted browser server: one container that hands out isolated Chrome sessions over CDP. Add it like any other provider:

yaml
providers:  browserserve:    url: ws://your-host:9222  cloud-provider:    url: <websocket-url-with-auth>    priority: 2

Because the gateway controls that runtime, a browserserve provider is auto-detected and unlocks two things no external provider gets:

  • Auto capacity. You do not set maxConcurrent. browserserve measures its host (memory, thread, and CPU limits) and advertises a safe ceiling, which the gateway adopts. The dashboard shows it as (auto).
  • Complete profiles. Every session is a fresh browser, and a saved profile carries the whole browser state, including IndexedDB and service workers. Other providers save cookies and site storage.

A common shape: browserserve as the primary provider on your own hardware, with a cloud provider at a lower priority for failover.


Works With

browser-gateway is compatible with existing browser tools. Just pass the gateway URL — it auto-resolves via /json/version.

AI Agent Frameworks:

python
# browser-use (Python) — HTTP URL auto-resolvesBrowserSession(cdp_url="http://localhost:9500")
typescript
// Stagehand (TypeScript)new Stagehand({ env: "LOCAL", localBrowserLaunchOptions: { cdpUrl: "http://localhost:9500" } })

Playwright MCP (all 70 Playwright tools through gateway routing):

json
{  "mcpServers": {    "playwright": {      "command": "npx",      "args": ["@playwright/mcp@latest", "--cdp-endpoint", "http://localhost:9500"]    }  }}

Puppeteer / Playwright:

typescript
// Playwright — HTTP or WebSocketconst browser = await chromium.connectOverCDP("http://localhost:9500");
// Puppeteer — WebSocketconst browser = await puppeteer.connect({ browserWSEndpoint: "ws://localhost:9500/v1/connect" });

Documentation

Full docs live at docs.browsergateway.com.


Contributing

Contributions welcome. See CONTRIBUTING.md for guidelines.

License

MIT - see LICENSE.

Links

Contact

Questions, security reports, or partnership inquiries: [email protected].

來源:README.md,提交 69a3e63

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:伺服器未在限時內回應。

版本歷史

11
  1. v0.4.35最新Nov 6, 2026
  2. v0.4.34Oct 20, 2026
  3. v0.4.33Oct 16, 2026
  4. v0.4.32Oct 13, 2026
  5. v0.4.31Oct 11, 2026
  6. v0.4.27Oct 8, 2026
  7. v0.4.25Sep 26, 2026
  8. v0.4.24Sep 24, 2026
  9. v0.4.23Sep 23, 2026
  10. v0.4.22Sep 20, 2026
  11. v0.4.21Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分