Skip to content

Browser Control CLI

The Browser Control commands turn Maho’s everyday browser state into a shell interface. Use maho tab for live tabs, maho history for local visit data, and maho bookmarks for saved pages.

All three groups support the global CLI options. In particular, use --json when another program will consume the result.

maho tab list
maho tab active
maho tab open <url>
maho tab close <tab-id>
maho tab eval <javascript>
maho tab html

Run maho tab <subcommand> --help for the exact targeting/options accepted by your installed build.

Lists tabs known to the running Maho profile. Human output is designed for inspection; JSON output is the stable choice for scripts.

Terminal window
maho tab list
maho --json tab list | jq '.'

A tab record contains the identifiers and page metadata needed by the other tab commands, including the tab id, title, URL, and active state when available. Do not scrape the aligned human output to recover those fields.

A useful selection pipeline is:

Terminal window
maho --json tab list \
| jq '.tabs // .'

The defensive // . keeps the example useful across CLI versions that wrap the records in an object versus returning the record collection directly.

Returns the currently active tab.

Terminal window
maho tab active
maho --json tab active | jq '.'

Use this before an explicit tab operation when a script should fail visibly if there is no active browser tab rather than silently opening one.

Opens a URL in Maho Browser.

Terminal window
maho tab open https://example.com
maho --json tab open https://example.com | jq '.'

Quote URLs that contain shell metacharacters such as & or ?:

Terminal window
maho tab open 'https://example.com/search?q=maho&sort=new'

The browser, not the shell command, performs the navigation. Browser profile, proxy, cookie, extension, and security behavior therefore remain Maho behavior.

Closes the tab identified by the id returned from tab list or tab active.

Terminal window
maho tab close <tab-id>

For scripts, obtain the id from JSON rather than relying on tab position:

Terminal window
maho --json tab list | jq '.'
# choose a tab id from the structured result, then:
maho tab close <tab-id>

Tab ids are runtime identifiers. Do not persist them as durable bookmark-like identifiers across browser restarts.

Evaluates JavaScript against the browser tab selected by the command and writes the serializable result to stdout.

Terminal window
maho tab eval 'document.title'
maho --json tab eval '({ title: document.title, links: document.links.length })' \
| jq '.'

This CLI capability is intentionally different from the MCP tool surface. The Maho MCP server does not advertise a generic JavaScript eval tool; MCP page access uses typed extractors so browser policy and redaction can be enforced. See MCP security.

Returns the current rendered tab’s HTML.

Terminal window
maho tab html > page.html
maho tab html | rg '<title>|<main|<article'

Use maho page text or maho page markdown when you want readable content rather than markup. HTML is most useful when the DOM shape itself is the data you need to inspect.

maho history search <query>
maho history top
maho history today

History reads the browsing data associated with the selected Maho profile. It is local browser data; the CLI does not need a search engine or remote history service to answer these commands.

Searches history for a query.

Terminal window
maho history search 'release notes'
maho --json history search 'release notes' | jq '.'

Use JSON for pipelines that need URLs rather than terminal-formatted rows:

Terminal window
maho --json history search 'MCP' \
| jq '.' \
> mcp-history.json

The installed command’s --help is the source of truth for any additional filter/limit options supported by that build:

Terminal window
maho history search --help

Shows the top history entries/sites according to the CLI’s built-in ranking. It is useful for quick browsing summaries without constructing a custom query.

Terminal window
maho history top
maho --json history top | jq '.'

Because ranking and display can evolve independently, automation should consume the JSON result rather than parse the human grouping.

Returns today’s browser history for the selected profile.

Terminal window
maho history today
maho --json history today | jq '.'

This is a convenient input for a daily research/work log:

Terminal window
maho --json history today \
| jq '.' \
> "maho-history-$(date +%Y-%m-%d).json"
maho bookmarks list
maho bookmarks search <query>
maho bookmarks add <url>

Lists bookmarks visible to the selected Maho profile.

Terminal window
maho bookmarks list
maho --json bookmarks list | jq '.'

For migration or shell processing, save the structured form:

Terminal window
maho --json bookmarks list > bookmarks.json

Searches bookmarks by the query accepted by the current CLI implementation. The browser MCP surface searches bookmark metadata such as title and URL; the CLI gives you the terminal equivalent for interactive use and scripting.

Terminal window
maho bookmarks search 'rust'
maho --json bookmarks search 'rust' | jq '.'

Combine it with a fuzzy selector without parsing columns:

Terminal window
maho --json bookmarks search 'docs' \
| jq '.' \
| less

Adds a bookmark for the URL through Maho Browser.

Terminal window
maho bookmarks add https://example.com

If your installed build exposes metadata options such as a title/folder, they are shown by:

Terminal window
maho bookmarks add --help

This avoids encoding version-specific optional metadata into scripts that only need the portable operation: bookmark this URL.

When you write a new script, inspect one result first:

Terminal window
maho --json tab active | jq '.'

Then narrow the expression for the version you deploy. This is safer than assuming the human output and JSON output share the same layout.

Terminal window
maho --json tab list \
| jq '.' \
| tee /tmp/maho-tabs.json

If the downstream model CLI accepts stdin:

Terminal window
maho --json history today \
| llm 'Summarize the browsing themes. Do not invent activity not present in the JSON.'
Terminal window
maho tab open https://example.com
maho page markdown | llm 'Summarize this page in five bullets.'

For a URL-oriented, non-interactive pipeline, prefer maho headless <url>.

The CLI and MCP server overlap, but they serve different callers:

NeedPrefer
Shell script, CI-like local job, jq, fzf, llmmaho tab/history/bookmarks/page
Claude Desktop, Cursor, or another MCP host choosing browser tools dynamicallymaho mcp
Explicit JavaScript evaluation from a trusted local terminalmaho tab eval
Policy-controlled page extraction for an agentMCP typed content tools

See MCP Server for the browser tool registry exposed to MCP clients.