This example wires OpenClaw's native browser tool to the local
browser server instead of talking to Playwright MCP directly.
What you get:
- host target routed through
openclaw/browser-server - optional
chromeprofile for the current Chromium tab attached by the extension relay - optional
sandboxandnodetargets in the same browser contract
- Go
- Node.js
- Playwright Chromium via
npx playwright install chromium - Browser extension tests via
npm testinopenclaw/browser-extension - An OpenAI-compatible API key
cd openclaw/browser-server
npm install
npx playwright install chromium
npm startThe default address is http://127.0.0.1:19790.
- Open
chrome://extensions - Enable Developer Mode
- Click
Load unpacked - Select
openclaw/browser-extension - Open the extension popup and save
http://127.0.0.1:19790 - Click
Attach Current Tab
That attached tab becomes the chrome browser profile on the browser
server.
cd openclaw
go run ./cmd/openclaw \
-config ./examples/browser_server_use/openclaw.yamlManaged browser example:
curl -sS 'http://127.0.0.1:8080/v1/gateway/messages' \
-H 'Content-Type: application/json' \
-d '{"from":"alice","text":"Open https://example.com with browser, take a snapshot, and tell me what the page says."}'Current browser tab example after extension attach:
curl -sS 'http://127.0.0.1:8080/v1/gateway/messages' \
-H 'Content-Type: application/json' \
-d '{"from":"alice","text":"Use the browser tool on my current Chrome tab, inspect the page, and take a screenshot."}'The model can now use:
{"action":"tabs","profile":"openclaw"}{"action":"snapshot","profile":"chrome"}{"action":"act","profile":"chrome","request":{"kind":"click","ref":"..."}}{"action":"act","profile":"chrome","request":{"kind":"scrollIntoView","ref":"..."}}{"action":"storage","profile":"chrome","operation":"set","store":"local","key":"token","value":"abc"}{"action":"cookies","profile":"openclaw","operation":"get"}{"action":"download","profile":"openclaw","ref":"...","path":"report.txt"}{"action":"timezone","profile":"openclaw","timezoneId":"Asia/Shanghai"}{"action":"snapshot","target":"sandbox"}{"action":"snapshot","target":"node","node":"edge"}
You can validate the browser plane before wiring it into OpenClaw:
cd openclaw/browser-server
npm install
npm run smoke:host
npm run smoke:relay
npm run smoke:host:headed
npm run smoke:relay:headedThe relay smoke uses Playwright's bundled Chromium by default so the extension can load in both headless and headed runs, and the smoke now checks snapshot, scrollIntoView, wait, wait-by-fn, cookies, storage, evaluate, cropped relay screenshots, host upload flows, download flows, and host advanced snapshot options end to end.
You can also validate the extension logic without launching a browser:
cd openclaw/browser-extension
npm test