A plugin is a folder mounted at /plugins// — hot-reloaded on any file change:
manifest.json—{"name", "profile"?, "start_url"?, "autostart"?, "max_tabs"?, "sticky_tab"?, "tool_prefix"?}tools.js—export async function register(api);api.tools.add(short, {description, inputSchema}, handler)registers MCP tool<name>_<short>(manifesttool_prefixoverrides the<name>_part;""= flat tool names — the registry refuses duplicates)watch.js(optional) —export async function watch(api); background observer, stop onapi.signalselectors.json(optional) — every DOM selector in one file →api.selectorsconfig.ini(optional) — flat machine values →api.config
The api object: z (zod), page(), context(), open() (go to start_url if elsewhere),
events.append/tail, queue (push/take/peek/list), settings (per-key get(key, fallback?),
set, delete, all on the plugin's own plugin-settings.json; settings.named("x") → the
plugin's settings.x.json; settings.global("x"?) → settings.x.json shared at the plugins
root, default name global — none of these writes trigger a reload; gitignore them in plugin
repos, they are runtime state), notifications.list/dismiss/on,
onToolCall(fn), help.add(relpath, text) (publish a help page as <plugin>/<relpath>),
http.route(method, path, handler, {public}?) (REST endpoint /api/<plugin>/<path>),
ui.page(path, handler, {public}?) (HTML page at /ui/<plugin>/<path> on the API port; handler
returns an HTML string; /ui lists all pages and / redirects there once any page exists;
{public: true} on either skips API_TOKEN, for routes that check their own credentials, such as a
PIN or a device token), tools.call(short, args?) (call any tool by its unprefixed name and get
the MCP result), browser.setOptions(opts) (context options for this plugin's profile — locale,
timezoneId, userAgent, extraHTTPHeaders, ... — applied at the next launch; empty values are
dropped; returns whether anything changed) and browser.close() (close the profile's browser, the
next use relaunches it), viewer (headful only, else null: viewer.set(on) starts or stops the
noVNC web viewer, viewer.on tells whether it runs; the browser keeps its display either way),
human.ms()/delay()/rate() (wave-paced delays for visible actions, per profile),
egress.allow(hosts)/list() (the profile's egress allowlist; a manifest domains: [...] array
is allowed automatically at load), tools.hide(true | [names]) / tools.unhide(...) (pull core
tools off the MCP surface while this plugin is loaded — true = the raw browser set; manifest
hide_core: true | [names] does it at load; refcounted, restored at unload, REST unaffected),
tools.intercept(fn, priority?) (run before every tool call: fn({tool, raw, args}) returns
nothing = continue, {args} = rewrite, {result} = answer the call, {error: "msg"} = fail it;
lower priority first, default 100; several interceptors chain; replace a call by returning the
result of another one; auto-unregistered at unload),
manifest, log.
Plugins import nothing from node_modules; node builtins (node:fs, node:sqlite, ...) and
global fetch are fine.
Keep every selector in selectors.json: a site redesign is then a one-file fix.