Developing

lnk-link-browser is Link Browser: an MCP server over stdio whose calls drive a headless Chromium, for any harness to reach as a tool. How to use it: Link Browser.

How it drives Chromium

It starts Chromium as <sandbox> --read <its folder> --write <profile> --internet-host '*' -- /bin/sh -c 'exec chromium ...', the sandbox being what follows -- in serve, so lnk sandbox run. Chromium's DevTools speak over a pipe (--remote-debugging-pipe, descriptors 3 and 4), which the shell maps onto the sandbox's own input and output, since lnk sandbox run passes no other descriptor: one JSON message each way, ended by a NUL byte.

Its proxy

Its proxy is the sandbox's (--proxy-server="$HTTPS_PROXY"); a loopback address skips it and meets the sandbox's wall, which opens only the ports --private-host names. As root, where Chromium refuses its own sandbox, it runs with --no-sandbox.

Reading and working a page

A page is read by a script run on it (src/page.js), which numbers each part that can be clicked or typed into on the element itself (data-link-n). A click is the mouse's own events at the part's middle, scrolled into view, and typing is the browser's text input, so a page sees what a person's would send.

Build and test

From tools/, in the public workspace beside the core:

cargo build -p link-plugin-link-browser
cargo test -p link-plugin-link-browser --test browser

tests/browser.rs

tests/browser.rs drives it against a site served on this machine, named with --private-host localhost:<port>, in lnk sandbox run. It finds Chromium at $CHROMIUM, on PATH or in Playwright's folder ($PLAYWRIGHT_BROWSERS_PATH), and passes saying so without one. No test reaches the internet.