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 listmaho tab activemaho tab open <url>maho tab close <tab-id>maho tab eval <javascript>maho tab htmlRun maho tab <subcommand> --help for the exact targeting/options accepted by
your installed build.
maho tab list
Section titled “maho tab list”Lists tabs known to the running Maho profile. Human output is designed for inspection; JSON output is the stable choice for scripts.
maho tab listmaho --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:
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.
maho tab active
Section titled “maho tab active”Returns the currently active tab.
maho tab activemaho --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.
maho tab open <url>
Section titled “maho tab open <url>”Opens a URL in Maho Browser.
maho tab open https://example.commaho --json tab open https://example.com | jq '.'Quote URLs that contain shell metacharacters such as & or ?:
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.
maho tab close <tab-id>
Section titled “maho tab close <tab-id>”Closes the tab identified by the id returned from tab list or tab active.
maho tab close <tab-id>For scripts, obtain the id from JSON rather than relying on tab position:
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.
maho tab eval <javascript>
Section titled “maho tab eval <javascript>”Evaluates JavaScript against the browser tab selected by the command and writes the serializable result to stdout.
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.
maho tab html
Section titled “maho tab html”Returns the current rendered tab’s HTML.
maho tab html > page.htmlmaho 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.
History
Section titled “History”maho history search <query>maho history topmaho history todayHistory 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.
maho history search <query>
Section titled “maho history search <query>”Searches history for a query.
maho history search 'release notes'maho --json history search 'release notes' | jq '.'Use JSON for pipelines that need URLs rather than terminal-formatted rows:
maho --json history search 'MCP' \ | jq '.' \ > mcp-history.jsonThe installed command’s --help is the source of truth for any additional
filter/limit options supported by that build:
maho history search --helpmaho history top
Section titled “maho history top”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.
maho history topmaho --json history top | jq '.'Because ranking and display can evolve independently, automation should consume the JSON result rather than parse the human grouping.
maho history today
Section titled “maho history today”Returns today’s browser history for the selected profile.
maho history todaymaho --json history today | jq '.'This is a convenient input for a daily research/work log:
maho --json history today \ | jq '.' \ > "maho-history-$(date +%Y-%m-%d).json"Bookmarks
Section titled “Bookmarks”maho bookmarks listmaho bookmarks search <query>maho bookmarks add <url>maho bookmarks list
Section titled “maho bookmarks list”Lists bookmarks visible to the selected Maho profile.
maho bookmarks listmaho --json bookmarks list | jq '.'For migration or shell processing, save the structured form:
maho --json bookmarks list > bookmarks.jsonmaho bookmarks search <query>
Section titled “maho bookmarks search <query>”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.
maho bookmarks search 'rust'maho --json bookmarks search 'rust' | jq '.'Combine it with a fuzzy selector without parsing columns:
maho --json bookmarks search 'docs' \ | jq '.' \ | lessmaho bookmarks add <url>
Section titled “maho bookmarks add <url>”Adds a bookmark for the URL through Maho Browser.
maho bookmarks add https://example.comIf your installed build exposes metadata options such as a title/folder, they are shown by:
maho bookmarks add --helpThis avoids encoding version-specific optional metadata into scripts that only need the portable operation: bookmark this URL.
JSON and pipeline patterns
Section titled “JSON and pipeline patterns”Inspect before selecting fields
Section titled “Inspect before selecting fields”When you write a new script, inspect one result first:
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.
Browser state to another CLI
Section titled “Browser state to another CLI”maho --json tab list \ | jq '.' \ | tee /tmp/maho-tabs.jsonHistory to an LLM
Section titled “History to an LLM”If the downstream model CLI accepts stdin:
maho --json history today \ | llm 'Summarize the browsing themes. Do not invent activity not present in the JSON.'Open a URL, then extract readable content
Section titled “Open a URL, then extract readable content”maho tab open https://example.commaho page markdown | llm 'Summarize this page in five bullets.'For a URL-oriented, non-interactive pipeline, prefer
maho headless <url>.
Browser CLI vs MCP tools
Section titled “Browser CLI vs MCP tools”The CLI and MCP server overlap, but they serve different callers:
| Need | Prefer |
|---|---|
Shell script, CI-like local job, jq, fzf, llm | maho tab/history/bookmarks/page |
| Claude Desktop, Cursor, or another MCP host choosing browser tools dynamically | maho mcp |
| Explicit JavaScript evaluation from a trusted local terminal | maho tab eval |
| Policy-controlled page extraction for an agent | MCP typed content tools |
See MCP Server for the browser tool registry exposed to MCP clients.