browser-ref-mcp

v0.2.1
io.github.zy2755/browser-ref-mcp Checked 3 days ago Published 4 days ago

Reliable browser-control MCP server for AI agents: click by ref, self-healing sessions.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

browser_navigate

Navigate to a URL. Returns a snapshot of interactive elements with [eN] refs that feed straight into click/type. Adds https:// when the protocol is missing.

ParameterTypeDescription
url *stringTarget URL
newTabbooleanOpen in a new tab (default false: navigate the current tab)
snapshotbooleanInclude a snapshot in the result (default true)
timeoutMsnumberNavigation timeout in ms (default 30000)

browser_snapshot

Semantic snapshot of the current page: interactive elements carry [eN] refs, and iframe content is flattened in. Narrow it with rootRef (the subtree of a single element), selector, or filter:interactive (interactive elements only).

ParameterTypeDescription
filterstringbalanced (default) keeps structure and text, interactive keeps only interactive elements, text keeps only text
maxElementsnumberMaximum output rows (default 400)
rootRefstringSnapshot only this element's subtree
selectorstringSnapshot only the subtree matching this CSS selector (main document)

browser_click

Click an element (prefer the ref from a snapshot). Waits until it is actionable, re-resolves refs that went stale, and returns a fresh snapshot afterwards. Dialogs are handled and reported automatically.

ParameterTypeDescription
buttonstring
doubleClickboolean
refstringThe [eN] id shown in a snapshot
selectorstringCSS selector (fallback when no ref is available)
snapshotbooleanInclude a snapshot after clicking (default true)
textstringMatch by visible text
timeoutMsnumber

browser_type

Type text into a field (clears it first). submit:true presses Enter. Works with input/textarea/contenteditable.

ParameterTypeDescription
text *stringText to type
clearbooleanClear the field first (default true; false appends)
refstring
selectorstring
submitbooleanPress Enter after typing (default false)
timeoutMsnumber

browser_press_key

Press a key, e.g. Enter / Tab / ArrowDown / Control+a. With a ref, focuses that element first.

ParameterTypeDescription
key *stringKey name, e.g. Enter, Escape, ArrowDown, Control+a
refstringFocus this element before pressing

browser_select_option

Select options in a dropdown. values may be option values or visible labels; both are tried.

ParameterTypeDescription
values *arrayOption value(s) or visible label(s) to select
refstring
selectorstring
timeoutMsnumber

browser_hover

Hover an element to reveal hover-only menus or tooltips.

ParameterTypeDescription
refstring
selectorstring
timeoutMsnumber

browser_scroll

Scroll the page, or one scroll container when a ref is given. Direction plus pixel amount.

ParameterTypeDescription
direction *string
amountnumberPixels to scroll (default 600)
refstringScroll this container instead (the one marked scrollable in a snapshot)

browser_screenshot

Screenshot the viewport, the full page, or a single element (ref). Returns the image and writes it to disk.

ParameterTypeDescription
filenamestringFile name without extension (default: timestamp)
fullPagebooleanCapture the full page instead of the viewport
refstringCapture only this element

browser_evaluate

Escape hatch: run JS in the page and return a JSON-serializable result. Pass a function string such as `() => document.title` or `() => {...}`; with a ref the function runs on that element as `(el) => el.value`.

ParameterTypeDescription
js *stringFunction string, e.g. `() => document.querySelector('#app')?.innerText.slice(0,2000)`
refstringRun on this element; it becomes the first callback argument

browser_wait

Wait for a condition: timeMs (fixed delay) / text (appears) / selector (appears) / url (changes) / idle (network quiet). Combine them freely.

ParameterTypeDescription
idlebooleanWait for network idle (max 15s)
selectorstring
textstringWait until this text appears on the page
timeMsnumber
timeoutMsnumberWait timeout (default 15000)
urlstringWait until the URL matches this pattern

browser_tabs

Manage tabs: list / new / select (by the index or id that list shows) / close.

ParameterTypeDescription
action *string
idstringTarget tab pageId for select/close
indexnumberTarget tab index for select/close (as shown by list, 0-based)
urlstringURL to open with new (optional)

browser_get_info

Browser health: mode, tab list, restart count, recent errors / dialogs / downloads. Never launches the browser.

browser_close

Close the browser (launch mode quits it but keeps profile logins; connect mode only disconnects). The next tool call restarts it automatically.