Skip to main content
Glama

Venice Browser MCP Bridge

Venice Browser MCP Bridge

What this is:

A tiny, production-minded browser bridge that speaks a JSON-RPC-ish protocol over stdin/stdout.

It supports two transport framers out of the box:

  • line — one JSON message per line (default). Simple, friendly, great for prototyping.
  • content-length — HTTP-like Content-Length: N framed messages. Good for strict MCP hosts.

It uses Playwright for real browser automation with a single persistent context (optional cookie/session state).

This repo is hardened against the classic asyncio.StreamWriter(sys.stdout, ...) footgun by using a writer implementation that never logs to stdout, avoids protocol mismatches, and cleanly flushes per message.


Quick Start

python3 -m venv .venv && source .venv/bin/activate

2) Install deps

pip install -r requirements.txt playwright install chromium

3) Run the bridge (line framing by default)

make run-line

In another terminal, run the example host:

make test-line

Expect output like:

Navigate... {"id":"nav-1","result":{"ok":true,"final_url":"https://example.com/","title":"Example Domain"}}

To exercise Content-Length framing

make run-cl # terminal A make test-cl # terminal B

Repo Layout

venice-browser-mcp/ ├─ src/ │ ├─ venice_browser_mcp.py # entrypoint │ ├─ venice_browser_mcp_core.py # env plumbing │ └─ venice_browser_mcp_v23_impl.py # framing + browser logic (patched) ├─ examples/ │ ├─ line_host.py # spawns bridge (line) and sends a request │ └─ hard_mcp_host.py # spawns bridge (content-length) and sends a request ├─ docs/ │ ├─ ARCHITECTURE.md │ └─ TROUBLESHOOTING.md ├─ Makefile ├─ requirements.txt ├─ .gitignore ├─ LICENSE └─ README.md

Configuration

The bridge is configured via environment variables. Reasonable defaults chosen for newbies.

VariableMeaningDefault
MCP_FRAMINGline or content-lengthline
HEADLESStrue or false for Playwrighttrue
MCP_STORAGE_STATEPath to storage_state JSON for persistent sessionsstate.json
NAV_TIMEOUTNavigation timeout ms30000
BROWSERBrowser name chromium | firefox | webkitchromium

Note: All logs go to stderr. Never print non-protocol text to stdout, or you will corrupt the transport.


RPC Methods

  • browser.navigate{ "url": "https://example.com" }
    Opens/uses a single page, navigates, returns { ok, status, final_url, title }.
  • ping{ "echo": "value" }
    Returns { "echo": "value" } for quick checks.
  • mcp.shutdown — No params.
    Gracefully closes browser & exits main loop.

You can add more handlers in venice_browser_mcp_v23_impl.py under dispatch().


Makefile Targets

  • make install — install Python deps and Playwright browser
  • make run-line — run bridge in line mode (foreground)
  • make run-cl — run bridge in content-length mode (foreground)
  • make test-line — run example host for line mode
  • make test-cl — run example host for content-length mode
  • make fmt — basic Python formatting (via python -m json.tool checks and whitespace cleanup)
  • make clean — remove caches/artifacts

“Stuck here?” Troubleshooting Lanes

1) Crash: AssertionError or 'Protocol' object has no attribute '_drain_helper'

Cause: Incorrect asyncio.StreamWriter construction (classic pitfall).
Fix: This repo does not use that pattern; it uses a safe writer. Ensure you are running these sources and not an unpatched file. Reinstall with git clean -xfd or re-extract the zip.

2) json.decoder.JSONDecodeError: Extra data

Cause: You leaked a non-JSON line to stdout (e.g., prints, warnings from other tools).
Fix: Ensure all diagnostics go to stderr. In Python: print(\"dbg\", file=sys.stderr, flush=True).

3) Expecting value: line 1 column 1 (char 0)

Cause: Host expected a JSON line but got empty/garbage, usually because the child process printed banners to stdout before the JSON.
Fix: Same as above; keep stdout pure protocol. Also verify your framing modes match (host vs bridge).

4) playwright._impl._errors.Error: BrowserType.launch: Executable doesn't exist

Cause: You forgot to install browsers.
Fix: playwright install chromium (or firefox / webkit if you changed BROWSER).

  • Set MCP_STORAGE_STATE=state.json (default already).
  • Log in once with HEADLESS=false, then close. Subsequent sessions reuse that state.

6) Corporate proxy, weird TTY, or PTY quirks

If the host uses a PTY or non-pipe stdout, line-buffering can glitch. Prefer the included example hosts which spawn the bridge with a pipe and communicate cleanly.


Security Notes

  • This project is a tooling bridge. It does not bypass web/app authentication, nor does it ship exploit logic.
  • If you extend it, keep logs on stderr, and sanitize inputs when invoking shell or navigating to user-provided URLs.
  • For red-team experiments: keep it abstracted and non-operational; do not automate harmful behaviors.

Sanity Checks

  • Both framers verified with the included hosts.
  • No stdout logging, atomic flush per message.
  • Single Playwright context reused across calls, optional persistence enabled.
  • Explicit timeouts on navigation.
-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

Enables browser automation through Playwright with persistent sessions and cookie state management. Supports web navigation, page interaction, and browser control via JSON-RPC protocol over stdin/stdout.

  1. What this is:
    1. It supports two transport framers out of the box:
  2. Quick Start
    1. 1) Create an isolated env (recommended)
      1. 2) Install deps
        1. 3) Run the bridge (line framing by default)
          1. In another terminal, run the example host:
            1. Expect output like:
            2. To exercise Content-Length framing
            3. Repo Layout
            4. Configuration
            5. RPC Methods
            6. Makefile Targets
            7. “Stuck here?” Troubleshooting Lanes
            8. Security Notes
            9. Sanity Checks

          Related MCP Servers

          • A
            security
            F
            license
            A
            quality
            A server that enables browser automation using Playwright, allowing interaction with web pages, capturing screenshots, and executing JavaScript in a browser environment through LLMs.
            Last updated -
            12
            11,084
            1
          • A
            security
            A
            license
            A
            quality
            The server provides tools for web automation using Playwright, allowing navigation, interaction, and JavaScript execution on web pages, and supports note storage with summarization capabilities.
            Last updated -
            8
            144
            Apache 2.0
            • Apple
          • -
            security
            F
            license
            -
            quality
            Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.
            Last updated -
            7
          • A
            security
            A
            license
            A
            quality
            A browser automation server providing Playwright capabilities for controlling web browsers, capturing screenshots, extracting content, and performing complex interactions through an MCP interface.
            Last updated -
            6
            Apache 2.0
            • Apple

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/Fayeblade1488/Fayeblade_mcp'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server