Skip to main content
Glama

Build-Browser-Gateway

One MCP door to four browser engines.

browser-gateway is a Python MCP server that gives an AI agent a single unified door to the web, and routes every request to the engine that does that job best:

Intent

Engine

What it does

dom_interaction

PinchTab

navigate / click / fill / type; snap the accessibility tree, read text or html, eval JS

data_extraction

bb-browser

structured data through community site adapters (145 installed on my machine: google, bing, baidu, duckduckgo, arxiv search, and more)

session_auth

Agent Reach

read-only diagnostics only (doctor / version / check-update) — blocked by default

custom_script

Playwright

run a custom Python Playwright script — blocked by default

There is also a flat tool per engine (browser_pinchtab, browser_bb, browser_reach, browser_playwright) for callers that already know which hand they need.

Design rules the agent cannot talk its way around

  • Hard timeouts everywhere. Every engine subprocess gets a hard timeout; a stuck page can no longer pin the whole MCP session forever.

  • Explicit truncation. Output is capped by max_chars (default 10000) and list results by limit (default 5) — and the caller is always told what was cut. Silent truncation is worse than no truncation.

  • Fail-closed gates. The two risky engines (custom scripts, anything that looks like authentication) are blocked unless two environment variables are deliberately set: BROWSER_GATEWAY_ALLOW_CUSTOM_SCRIPT=1, BROWSER_GATEWAY_ALLOW_SESSION_AUTH=1.

  • Silent-zero detection. An adapter that returns "success" with zero results is flagged in the output, because an AI agent will otherwise read it as "the answer is that there is nothing there".

Related MCP server: browserpilot

Install

pip install .
# then point your MCP client at:
python -m browser_gateway_mcp.server

Engines are external binaries found on PATH (or via environment variables below): pinchtab, bb-browser, agent-reach, and a Python interpreter with playwright installed.

Configuration (environment variables)

Variable

Default

Purpose

BROWSER_GATEWAY_ALLOW_CUSTOM_SCRIPT

unset (blocked)

allow the Playwright custom-script engine

BROWSER_GATEWAY_ALLOW_SESSION_AUTH

unset (blocked)

allow the Agent Reach engine

BROWSER_GATEWAY_OUTPUT_DIR

~/.browser-gateway-mcp/output

where screenshot/pdf outputs land

BROWSER_GATEWAY_LOG_FILE

unset (stderr only)

optional debug log file

BROWSER_GATEWAY_PYTHON

python3

interpreter used to run Playwright scripts

PLAYWRIGHT_BROWSERS_PATH

Playwright default

where Playwright browsers are installed

PINCHTAB_BIN / BB_BROWSER_BIN / AGENT_REACH_BIN

command names

engine binary paths

BB_SITES_DIR

~/.bb-browser/bb-sites

bb-browser adapter directory

Notes

  • Every account, key and password in the published sources is a mock. Real credentials never leave the machine.

  • The engines themselves are separate open-source tools; what this repository contains is the door, the routing and the safety rules.

Licence

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables agents to control an existing Chromium browser or isolated Playwright profile through 50 tools for reading, interacting with, navigating, capturing, transferring files, and coordinating tabs, with per-site permissions and one-use approvals.
    5
    MIT
  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables AI agents to browse and interact with web pages through a persistent headless Chromium session, serving compact structured orientations, targeted element queries, and full detail only when explicitly requested. It supports navigation, observation, form filling, monitoring, and session management while cutting token overhead by up to ~140x versus raw accessibility-tree dumps.
    4 npm
    -
  • F
    license
    Not graded
    quality
    A
    maintenance
    Enables AI agents to browse and interact with web pages through a token-efficient, structured page representation — orientation summaries, targeted element queries, and full detail only on request — instead of raw accessibility-tree dumps. Supports navigation, interaction, forms, screenshots, console and network monitoring, session/tab management, and browser-based development auditing.
    4 npm
    -