Automation with MCP
mob3 -mcp runs MOB3 headlessly as a
Model Context Protocol server over
stdin/stdout. It exposes the browser to scripts and AI agents through a small
set of text-oriented tools.
mob3 -mcp
mob3 -mcp -width 100 about:home
mob3 -mcp -width 120 https://en.wikipedia.org/
- Optional starting URL; otherwise
about:home. -widthcontrols wrapping and coordinates.- The interaction viewport is 30 rows by default;
-height Nsets it explicitly (aboutN-3page rows after chrome).snapshotreturns page text independently of that viewport, inoffset/rowswindows with aNextoffset for long pages; the viewport still controls screenshots, scrolling and click coordinates. - Images are disabled.
-no-js,-layout-budget,-reader,-darkand search settings are honored.- History, cookies and storage are in memory only; MCP sessions do not probe or save a profile.
- The automation engine runs in a child process by default, so an engine crash
does not take down the MCP server or its stdio transport. The in-flight tool
call and later calls return an
engine crashederror; the engine is not respawned, so restart the server to recover.-process=singlekeeps the engine in the server process, where a fatal error also ends the server. The process model is described in architecture. -mem-limitapplies per process in per-tab mode (the engine child and the MCP server parent) and to the single server process with-process=single.
Client configuration
MOB3 speaks MCP over stdio, so any MCP client that can start a local command
can use it. The examples below assume mob3 is installed at
/usr/local/bin/mob3; replace that path with the output of command -v mob3
on your machine (for example /opt/homebrew/bin/mob3 on Apple Silicon).
All clients accept the same server arguments. -width controls wrapping and
coordinates, and the optional starting URL defaults to about:home:
/usr/local/bin/mob3 -mcp -width 100 about:home
OpenCode
Add MOB3 as a global local server:
opencode mcp add mob3 --global -- /usr/local/bin/mob3 -mcp -width 100 about:home
opencode mcp list
Or add it by hand to ~/.config/opencode/opencode.json (use
opencode.json in a project for project-local access):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"mob3": {
"type": "local",
"command": ["/usr/local/bin/mob3", "-mcp", "-width", "100", "about:home"]
}
}
}
}
OpenCode reloads configuration automatically; opencode mcp list shows the
connection state.
Claude Code
Add MOB3 at user scope so it is available in every project:
claude mcp add --transport stdio --scope user mob3 -- \
/usr/local/bin/mob3 -mcp -width 100 about:home
claude mcp list
For a project-scoped server, put the equivalent entry in .mcp.json at the
project root:
{
"mcpServers": {
"mob3": {
"command": "/usr/local/bin/mob3",
"args": ["-mcp", "-width", "100", "about:home"]
}
}
}
Cursor
Create .cursor/mcp.json in the project, or ~/.cursor/mcp.json for a global
server:
{
"mcpServers": {
"mob3": {
"command": "/usr/local/bin/mob3",
"args": ["-mcp", "-width", "100", "about:home"]
}
}
}
Reload the MCP servers from Cursor's settings after editing the file.
Claude Desktop
Add the server to Claude Desktop's configuration file (claude_desktop_config.json):
{
"mcpServers": {
"mob3": {
"command": "/usr/local/bin/mob3",
"args": ["-mcp", "-width", "100", "about:home"]
}
}
}
Restart Claude Desktop after changing the file.
Other clients
Clients that use the common mcpServers shape can use the same entry shown for
Cursor. The only required fields are command and args; the server needs no
environment variables, URL or API key.
MCP communication is stdio-only. Stdout carries protocol messages only; diagnostics go to stderr. Do not expose the process as a network service; there is no authentication.
Protocol
Messages are newline-delimited JSON-RPC 2.0.
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18"}}
{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"navigate","arguments":{"url":"https://example.com/"}}}
Supported methods:
initialize— returnscapabilities.tools,serverInfoand short usage instructions.ping— empty result.tools/list— tool names, descriptions and JSON schemas.tools/call— runs one tool.notifications/initializedand other notifications — acknowledged by silence.
Tool failures are returned as successful JSON-RPC responses whose content
explains the error and whose isError field is true. Protocol errors use
standard JSON-RPC error codes.
You can test the server without an MCP client:
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18"}}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"navigate","arguments":{"url":"https://example.com/"}}}' \
| ./bin/mob3 -mcp
Debugging in the running browser
The interactive browser's ! console has a Tools tab for read-only
inspection of the page you are looking at. Its commands mirror the inspection
tools below: help, form [selector], links [selector], requests [limit],
logs [limit], source [selector], snapshot, history and clear. Results
scroll in the tab and keep the newest 500 lines, help lists the arguments and
selector examples, and the scrollback survives page loads. clear (or cls)
empties the Tools scrollback; the JS logs input accepts the same command to
clear the JavaScript log. A [selector] is an optional CSS selector such as
#content, .card, form#search, input[name=q] or main a; omit it to
inspect all forms/links or the full page source.
Navigation, form editing (fill/select/toggle/submit), wait/wait_for
and screenshot are available only through mob3 -mcp: the interactive event
loop owns navigation results, so those commands cannot run synchronously from
inside it.
Tools
| Tool | Arguments | Returns |
|---|---|---|
navigate |
{url} |
Snapshot after loading |
snapshot |
{offset?, rows?} |
Page text window, row range and next offset |
links |
{selector?, offset?, limit?} |
Links page with index, text, href, selector and next offset |
screenshot |
{scale} |
PNG image of the current page viewport |
click |
{link} or {text} or {selector} or {x,y} |
Snapshot after the click |
form |
{selector?, offset?, limit?} |
Controls page with CSS selectors, values and next offset |
fill |
{selector,value} or {fields} |
filled N field(s) |
select |
{selector,value} or {values} or {text} or {index} |
selected … |
toggle |
{selector,checked?} |
… is checked / … is unchecked |
submit |
{selector?} |
Snapshot after navigation |
wait |
{ms} |
waited <ms>ms |
wait_for |
{selector?} and/or {text?}, {timeout_ms?} |
found … after <ms> |
type |
{text} |
typed |
press |
{key} |
pressed <key> |
scroll |
{lines} or {pages} or {top} or {bottom} |
Scroll percentage |
back |
{} |
Snapshot |
forward |
{} |
Snapshot |
reload |
{} |
Snapshot |
evaluate |
{expression} |
JavaScript result as text |
history |
{} |
Session history, most recent first |
requests |
{limit?} |
Current page's request log and cache usage |
logs |
{limit?} |
JavaScript console messages and errors |
source |
{selector?} |
Raw decoded HTML, or one element's serialized HTML |
navigate
Resolves input like the URL prompt: URLs, about: pages, or a search query
through -search. Local files are not supported; file: URLs are rejected.
Waits for the page, meta refreshes and scripted redirects.
snapshot
Returns the page as plain text starting at the first layout row, not just the
interaction viewport. A page that fits one response is returned whole; a longer
page returns one window plus a Next offset. Pass offset and optional rows
to read the rest without scrolling:
{"offset": 1240, "rows": 200}
The header reports the page height, the returned layout-row range and the next
offset; Next is absent on the last window:
URL: https://example.com/
Title: Example Domain
Page: 100x1400 Rows: 0-230 of 1400 Next: 230 Viewport: 100x27 Scroll: 0%
Example Domain
...
offset is a zero-based layout row. rows caps the window; omit it (or pass
0) to fill one response. Snapshot is text only and does not depend on scroll;
use links and form for link and control lists, selectors and values.
links
{}
{"selector":"main a"}
{"offset":200,"limit":100}
Lists every rendered anchor in the document, including links outside the
current viewport, with the [n] index that click accepts:
Links: 2
Showing: 1-2 of 2
[1] Docs -> https://example.com/docs selector="a[href=\"/docs\"]"
[2] Sign in -> https://example.com/login selector="#nav a:nth-child(2)"
Empty anchors, hidden anchors and anchors with no rendered content are
omitted. selector filters which anchors are listed (it matches the anchor,
not its containers) before paging. A response holds up to 2,000 links or about
50,000 characters; Showing reports the range and Next is the 0-based
offset for the following call. Most pages fit in one response.
form
{}
{"selector":"form#search"}
{"offset":200,"limit":100}
Lists every form and its controls, including fields that are outside the
current viewport. Each control shows its tag, name, type, current value or
checked state, flags (required, readonly, disabled) and a stable CSS
selector for the other form tools:
Forms: 1
Controls: 3 Showing: 1-3 of 3
[1] form method="GET" action="/find" selector="#search"
- input name="q" type="text" value="old" selector="#search input[name=\"q\"]"
- select name="lang" value="fr" options=["en" "fr"] selector="select[name=\"lang\"]"
- input name="safe" type="checkbox" state=checked value="on" selector="#search input[name=\"safe\"]"
Hidden inputs are omitted because they cannot be edited. Controls outside any
form are listed separately. Password input values are never printed: a
non-empty password shows value="[redacted]", an empty one shows value="".
Selectors prefer an #id, then a form-id name pair, then an nth-child
path. Pass a form or control selector to list just that form. A response holds
up to 2,000 controls or about 50,000 characters; Showing reports the range
and Next is the 0-based offset for the following call. A page that starts
inside a form repeats that form's header.
fill
{"selector":"#search input[name=q]","value":"terminal browsers"}
{"fields":{"#search input[name=q]":"terminal browsers","textarea[name=notes]":"a note"}}
fill sets text-like inputs and textareas, replacing any existing value; an
empty string clears the field. It accepts one selector/value pair or a fields
map of selector to value. Values honor maxlength, and range inputs accept a
number. Checkboxes, radios and selects are rejected: use toggle and select.
fill never submits and never requires focus, so it also works on off-screen
fields. Each change fires input and change.
select
{"selector":"select[name=lang]","value":"fr"}
{"selector":"select[name=tags]","values":["a","b"]}
{"selector":"select[name=lang]","text":"French"}
{"selector":"select[name=lang]","index":1}
Chooses by option value, visible label, or zero-based option index. Pass
values for a <select multiple> to replace the selected set. A missing value
or an out-of-range index is a tool error that lists the available options.
toggle
{"selector":"input[name=remember]"}
{"selector":"input[name=remember]","checked":true}
{"selector":"option[value=b]","checked":true}
Checks or unchecks a checkbox or radio. Omit checked to flip the current
state. Selecting a radio unchecks the other radios in its group, including
groups outside a form. Multi-select options can also be toggled this way. Use
select to choose a single-select option or replace a whole multiple selection.
submit
{}
{"selector":"form#search"}
Submits a form: runs the supported constraint validation, fires the form's
submit handler, builds the GET query or urlencoded POST body, navigates, and
returns a snapshot. Without a selector it uses the focused control's form, or
the page's only form. Validation failures, invalid actions and
preventDefault() are returned as tool errors (validation also focuses the
first invalid field), so the page does not change on failure.
wait and wait_for
{"ms":500}
{"selector":"#results","timeout_ms":5000}
{"text":"No results found","timeout_ms":2000}
{"selector":".item","text":"price","timeout_ms":5000}
JavaScript timers do not run on their own between tool calls. wait advances
the page for a number of milliseconds (default 100, maximum 10000), running due
timers, applying the DOM rebuilds they cause and waiting for navigations they
start.
wait_for polls until a CSS selector matches an element and/or the given text
appears in the rendered page. Text matching is case-insensitive, ignores
markup and scripts, and sees the laid-out document rather than just the
viewport. It returns found … after <ms> or fails with a timeout error; the
default timeout is 5000ms and the maximum is 30000ms. When both selector and
text are supplied, both must match.
Both tools return a short confirmation rather than a snapshot; call snapshot
afterwards when you need the page contents.
screenshot
{"scale":1}
Returns an MCP image/png content block of the current page viewport, plus a
short text line with the URL. scale runs from 1 to 4: 1 uses 8×16 pixel
cells, and each step multiplies the image. This is a terminal-cell raster, not a browser pixel
screenshot: Go Mono glyphs are used, CJK/emoji glyphs may be missing, and MCP
disables image downloads so image regions show alt text.
click
{"link":1}
{"text":"Sign in"}
{"selector":"input[name=q]"}
{"x":4,"y":12}
linkuses alinkslink number, including off-screen links.textclicks the most specific rendered element whose visible text matches, case-insensitively. Exact matches are preferred, then links and buttons over containers. It also matches submit-buttonvaluetext andaria-label/altfallbacks.selectoruses a CSS selector. Links, inputs, checkboxes and buttons are clicked through their rendered cell, so normal browser click behaviour runs. A selector click scrolls an off-screen element into view first.x/yare zero-based page-viewport cells.- Pass exactly one of the four targets.
- A link with
target="_blank"or a named target is not followed, because the headless session has no tabs. The snapshot'sStatus:line says so; uselinksfor the address andnavigateto open it.
type and press
type requires a focused input, textarea or the URL prompt. Click a field
first. A newline presses Enter; a tab presses Tab.
press accepts Enter, Tab, Escape, Backspace, Delete, arrows,
Home, End, PageUp, PageDown and Space, plus single characters.
evaluate
Runs JavaScript in the page realm through sobek:
{"expression":"document.title"}
{"expression":"JSON.stringify([...document.querySelectorAll('h2')].map(h => h.textContent))"}
Objects stringify as [object Object]; use JSON.stringify for structured
results. -no-js disables evaluation.
requests, logs and source
{"limit":50}
{"limit":20}
{"selector":"main article"}
These expose the same diagnostics as the in-browser ! console:
requestslists the current page's in-memory request log — status, method, size, kind (doc,css,js,img,fetch,xhr) and URL — followed by cache bytes used.limitkeeps the newest entries (default 100; 0 shows all, up to the 512-entry cap).logsreturns JavaScript console messages and uncaught errors in order, with· errorin the header when the page has a script error.limitkeeps the newest entries (default 200; 0 shows all retained entries). Logs and the error flag reset when a new page is applied and are lost on failed loads.sourcereturns the raw decoded HTML that was fetched, before scripts ran. Withselector, it returns the serialized HTML of that element instead. Terminal control characters are removed. Large sources may be clipped by the MCP transport.
history
Lists session history, most recent first; * marks the current entry.
Typical agent loop
navigatea page.snapshotto read the page text; uselinksfor link numbers and selectors, including links below the fold.formto get every control's selector and current value.fill,selectandtoggleto set fields without focusing or scrolling.submitto send the form, then read the returned snapshot.- Use
wait_forafter clicks and submissions that load content with timers, thensnapshotwhen ready. - Use
click/type/pressfor special widgets,evaluatefor DOM extraction,scrollfor screenshots or coordinate clicks, andback/historyto move. - When a page loads wrong, check
requestsfor blocked or missing resources,logsfor script errors, andsourcefor the markup that was fetched.
Limitations
- Terminal-cell rasters.
screenshotreturns a PNG of the terminal-cell raster, not a browser pixel capture: MOB3 has no font rasterizer, so glyphs are monospaced and some CJK/emoji glyphs may be missing. - One page per server. The headless session has a single page and no tab UI; tabs are an interactive-mode feature. Iframes are inert stubs, so there is no child browsing context.
- Sized viewport. The virtual viewport is 30 rows by default;
-widthand-heightset it. - JavaScript is a subset. ES modules run, but workers, service workers and many modern APIs are unavailable.
- Forms.
fill,select,toggleandsubmithandle text fields, textareas, checkboxes, radios and selects. File uploads and multipart forms are not supported, and framework widgets that rerender from their own state may overwrite a value set directly. - Timers advance only during loads and waits. JavaScript timers run while a
page loads and during
wait/wait_for; a timer that fires later needs one of those tools before its content appears. Unrelated tool calls do not pump timers. - Memory only. Closing the server discards history, cookies and storage.
- Local, unauthenticated server. Use it only over a trusted local stdio channel.
See Security and privacy for the broader security model.