MCP, Pi, OMP and AI SDK
MCP
browsers mcp
{
"mcpServers": {
"browsers": { "command": "browsers", "args": ["mcp"] }
}
}
A stdio server. It reads the same environment as the CLI, so whichever keys you export are the providers a model gets. No key at all still leaves Playwright.
Pi and OMP
pi install git:github.com/agntn/browsers
omp install @agntn/browsers
Both extensions register the same tools as the MCP server, with the same names, schemas and descriptions, and a terminal view of each call.
AI SDK
Want your model to browse without writing wrappers? Good. Give it the same tools as MCP, Pi and OMP.
pnpm add @agntn/browsers ai @ai-sdk/anthropic
import { anthropic } from "@ai-sdk/anthropic";
import { browsersAiTools } from "@agntn/browsers/ai";
import { generateText, isStepCount } from "ai";
const { text } = await generateText({
model: anthropic("claude-sonnet-5-5"),
tools: browsersAiTools,
stopWhen: isStepCount(5),
prompt: "Which browser providers can I use right now?",
});
The model reads exactly the text an MCP client gets. Your app gets it as text in the tool output. Structured details sit next to it, like in Pi and OMP.
Screenshots reach the model as image parts, not base64 text. Anthropic, Google and openai(...) on the Responses API show images. But openai.chat() flattens tool output to JSON. There, the model reads base64 as text. Not quite eyes on the page.
Invalid arguments and provider failures return tool errors with reasons. The generateText loop keeps going.
Providers come from the same environment as the CLI. Export their API keys and the model gets those providers. No keys? Local Playwright is still there.
The import loads no provider or executor. Those load on the first call. The ai peer dependency is optional and wants version 7.
Don't need every tool? Pick from the plain object.
const { browsers_scrape, browsers_links } = browsersAiTools;
browsers_screenshot writes a file when the model passes path. browsers_pdf always writes to path. Neither overwrites an existing file. Leave both out if your app shouldn't touch disk.
The tools
browsers_scrapeRead-only/open-world network fetch: scrape content from a URL using a cloud browser provider.browsers_sessionCreate a cloud browser session.browsers_releaseRelease/destroy a cloud browser session.browsers_providersRead-only/idempotent local/env status: list browser-as-a-service providers and which ones are currently configured via environment variables.browsers_screenshotTake a screenshot of a URL using a cloud browser provider and return the image, or write it to `path` for captures too large to return.browsers_extractExtract structured data from a URL using AI.browsers_crawlCrawl a website following links.browsers_pdfGenerate a PDF from a URL and write it to `path`.browsers_linksExtract the unique links of a webpage in page order.browsers_accessibilityRead a webpage's accessibility tree: the roles, names, values and states (checked, disabled, expanded) of its headings, links, buttons and form fields, one node per indented line.browsers_webmcp_toolsList the WebMCP tools a webpage registers for agents (`document.modelContext.registerTool`): each tool's name, description, input JSON schema and the page's own hints (read-only, untrusted content, consequential).browsers_webmcp_callRun one WebMCP tool a webpage registers, with `input` matching its inputSchema from browsers_webmcp_tools, and return the tool's answer.browsers_searchWeb search via browser provider.browsers_capabilitiesRead-only: report which library operations a browser provider supports, including scrape, screenshot, element screenshot, navigate, evaluate, sessions, CDP, and stateless modes.
Hover a row for the whole description. It's the exact text a model gets in tools/list, and it's written to steer: which providers can do what, when to pass path, what to do with a jobId.
The same tools everywhere
MCP, Pi, OMP, the AI SDK and the terminal share one set of tools, with the same answers and refusals. browsers <command> --help lists the arguments a model gets. The panel on the home page shows real browsers_capabilities output.
Bounds a model can live with
browsers_scrapestops at 20 000 characters unless you passmaxChars, 200 000 at most, and says how much it cut.browsers_crawlshares that budget across every page it read.browsers_linksreturns 500 per call unless you passlimit, 5 000 at most, and names the nextoffset.browsers_searchreturns all ten results Hyperbrowser puts on a page unless you passmaxResults. Need one URL? Ask for one.browsers_accessibilitystops at the same 20 000 by default.browsers_webmcp_toolsandbrowsers_webmcp_callstop there too. The list cuts between two tools.browsers_screenshotreturns the image, or writes it topathwhen it's too big to return.
Cancelling agent tools
Done waiting? Don't keep the browser busy. Cancelling browsers_scrape, browsers_extract, browsers_crawl, browsers_links, browsers_accessibility, browsers_webmcp_tools, browsers_webmcp_call or browsers_search stops provider work. Temporary sessions get released too. No browser left reading to an empty room.
The signal comes from MCP request cancellation, the abort signal Pi and OMP hand each tool, or the AI SDK's abortSignal. Hyperbrowser crawl and extract jobs still run out on their own. Resumed crawl jobs also keep running, because their IDs belong to the caller.
browsers_screenshot, browsers_pdf and browsers_session write something, a file or a session. They run to the end on cancellation.
What a model can't do
Click. Log in. Type into a form. The tools never grew navigate or evaluate, and a session ID from browsers_session only goes to browsers_release. A model can read the web through this package. Driving it is your code's job, with the CDP URL a session gives you.
There's one exception: a page can hand out its own WebMCP tools. browsers_webmcp_call runs only what the site registered, nothing more. That can still change things on the site.
Need a plain fetch that isn't a browser? @agntn/web. Need last year's version of the page? @agntn/archives.