Skip to main content
Glama

dsh-browser-router

Smart Browser-Router MCP Server for AI agents — cheap DOM-first (Playwright/CDP) with automatic escalation to Vision/Coordinate mode (CUA), cost guard, probe-downgrade, SSRF protection, and human-in-the-loop approval gates.

Core Idea: "Cheap First, Vision Only When Needed"

Models only call a single backend-agnostic namespace (browse_*). They never need to know whether Playwright DOM or CUA Vision executes behind the scenes:

  • Playwright (DOM) by default — fast, deterministic, zero image tokens.

  • Automatic Escalation → CUA (Vision + @x,y coordinates) on structured failure signals (blocked, login_required, empty, locator_not_found, timeout).

  • Probe-Downgrade & Anti-Flap — automatically probes Playwright on subsequent turns to drop back to cheap DOM mode; pins CUA if a domain escalates ≥ 2 times.

  • Cost Guard — hard caps on max_cua_steps and estimated max_cua_budget_tokens (budget_exhausted).

  • Human-in-the-Loop Gates:

    • CAPTCHA → returns status: "needs_human" (never blindly clicks).

    • browse_submit → blocked by default (require_approval_submit: true) with status: "needs_human".

  • SSRF & Scheme Protection — blocks file://, javascript:, chrome://, data: (opt-in), and loopback/private/metadata IPs (127.0.0.0/8, localhost, [::1], [::ffff:127.0.0.1], 169.254.169.254, RFC1918, RFC4193) before touching Chrome.

  • Per-Bot Chrome Isolation — connects over CDP (--remote-debugging-port bound to 127.0.0.1) with separate Chrome profiles per agent.

Related MCP server: chrome-browser-bridge

Exposed MCP Tools

Tool

Description

browse_navigate

Open URL (validated for scheme + SSRF + domain-map routing)

browse_snapshot

Read page state (DOM elements or screenshot + element bboxes)

browse_click

Click element by ref (r-<n>) or CUA coordinates (@x,y)

browse_type

Fill/type text into ref (r-<n>) or coordinates (@x,y)

browse_extract

Extract page text / structured elements (or visual capture in CUA)

browse_screenshot

Capture screenshot (returned as standard MCP image content block)

browse_wait

Wait for load state, CSS selector, or text

browse_go_back

Navigate back

browse_refresh

Reload current page

browse_submit

Submit active form (gated by require_approval_submit)

Requirements

  • Node.js >= 22.5

  • Chrome / Chromium (for live CDP sessions)

Install & Verify

npm install
npm run typecheck
npm test
npm run build

Quick Start

1. Start Chrome with CDP (or use the wire script)

npx tsx scripts/wire-browser-router.ts \
  --port 9222 \
  --config examples/browser-router.yaml \
  --launch-chrome \
  --headless

2. Run the MCP Server (stdio)

BROWSER_ROUTER_CONFIG=examples/browser-router.yaml \
CHROME_CDP=http://127.0.0.1:9222 \
npm start

3. Wire into DeepSeek Harness (dsh)

npm run wire generates browser-router.mcp.yml matching @deepseek-ai/dsh-mcp-client:

- id: mcp-browser-router
  name: '@deepseek-ai/dsh-mcp-client'
  config:
    serverName: browser_router
    transport: stdio
    command: npx
    args:
      - tsx
      - <path-to-repo>/src/mcp.ts
    env:
      CHROME_CDP: 'http://127.0.0.1:9222'
      BROWSER_ROUTER_CONFIG: '<path-to-repo>/examples/browser-router.yaml'

4. Domain-Map Configuration (examples/browser-router.yaml)

browser:
  default_backend: playwright
  rules:
    - match: "*.amazon.com"
      backend: playwright
    - match: "*.linkedin.com"
      backend: cua
    - match: "*.google.com/recaptcha*"
      backend: cua
  escalation:
    enabled: true
    signals: [blocked, login_required, empty, locator_not_found, timeout]
  cost_guard:
    max_cua_steps: 8
    max_cua_budget_tokens: 20000
  require_approval_submit: true
  allow_private_network: false
  allow_data_urls: false

Architecture & Design

See docs/design.md for the full architecture, result contract, escalation state machine, and multi-bot isolation model.

License

MIT

Available Tools

10 tools
browse_clickA

Bấm phần tử theo ref từ snapshot (r-), hoặc toạ độ dạng '@x,y' (chỉ dùng ở CUA khi không có ref).

Inputs: ref (required).

browse_extractC

Trích xuất dữ liệu theo mục tiêu (goal) từ trang hiện tại.

Inputs: goal (required).

browse_go_backA

Quay lại trang trước.

Inputs: no named parameters.

browse_navigateC

Mở URL trong browser của bot.

Inputs: url (required).

browse_refreshB

Tải lại trang.

Inputs: no named parameters.

browse_screenshotC

Chụp ảnh trang (base64).

Inputs: full_page.

browse_snapshotC

Đọc trạng thái trang (elements + text/ảnh tuỳ backend).

Inputs: no named parameters.

browse_submitA

Nộp form hiện tại (Enter). Bị chặn bởi require_approval_submit: trả needs_human thay vì tự động thực hiện.

Inputs: no named parameters.

browse_typeB

Gõ text vào phần tử theo ref (r-) hoặc toạ độ '@x,y'.

Inputs: ref (required), text (required).

browse_waitD

Chờ load / selector / text.

Inputs: value, condition, timeout_ms.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools target distinct browser actions (navigate, click, type, wait, back, refresh, submit). The read-oriented tools snapshot/extract/screenshot overlap somewhat, but their descriptions distinguish page elements, goal-based extraction, and image capture.

    Naming Consistency5/5

    All tools use a consistent browse_ prefix followed by a snake_case action verb or verb phrase. The pattern is predictable and readable throughout the set.

    Tool Count5/5

    Ten tools is well-scoped for a browser automation server. Each tool corresponds to a clear, useful operation in the browse interaction loop.

    Completeness4/5

    The core browser lifecycle is covered: navigation, page inspection, interaction, extraction, screenshots, waiting, history, refresh, and form submission. Minor gaps remain for advanced interactions such as scrolling, hover, select dropdowns, or JavaScript evaluation, but agents can often work around these.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to drive a real Chrome browser for autonomous web tasks, using fast typed decisions with calibrated confidence, human-in-the-loop questions, safety gates, and full debug traces.
      7
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to browse and interact with web pages through a token-efficient, structured representation of each page rather than raw accessibility-tree dumps. Agents get compact page orientations, targeted element queries, and full interaction—clicking, typing, form filling, screenshots, and session management—while controlling how much detail is returned per call.
      4 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to drive a real Chromium browser by receiving compact, token-efficient page maps and only the changes after each action. It guards against hidden prompt injections, blocks payments, sends and deletions until the user approves, and lets agents learn site-specific notes over time.
      1
      MIT