---
title: "MCP, Pi, OMP and AI SDK"
description: "Hand the browsers to a model. Get the same tools and answers across MCP, Pi, OMP and the AI SDK."
canonical_url: "https://browsers.agntn.dev/guide/agents"
---
# MCP, Pi, OMP and AI SDK

> Hand the browsers to a model. Get the same tools and answers across MCP, Pi, OMP and the AI SDK.

## MCP

```bash
browsers mcp
```

```json [mcp.json]
{
  "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

```bash
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.

```bash
pnpm add @agntn/browsers ai @ai-sdk/anthropic
```

```ts
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.

```ts
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

<agent-tools>



</agent-tools>

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](https://browsers.agntn.dev/) shows real `browsers_capabilities` output.

## Bounds a model can live with

- `browsers_scrape` stops at 20 000 characters unless you pass `maxChars`, 200 000 at most, and says how much it cut.
- `browsers_crawl` shares that budget across every page it read.
- `browsers_links` returns 500 per call unless you pass `limit`, 5 000 at most, and names the next `offset`.
- `browsers_search` returns all ten results Hyperbrowser puts on a page unless you pass `maxResults`. Need one URL? Ask for one.
- `browsers_accessibility` stops at the same 20 000 by default.
- `browsers_webmcp_tools` and `browsers_webmcp_call` stop there too. The list cuts between two tools.
- `browsers_screenshot` returns the image, or writes it to `path` when 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](https://browsers.agntn.dev/guide/sessions) gives you.

There's one exception: a page can hand out its own [WebMCP](https://browsers.agntn.dev/guide/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](https://web.agntn.dev). Need last year's version of the page? [@agntn/archives](https://archives.agntn.dev).


## Sitemap

See the full [sitemap](https://browsers.agntn.dev/sitemap.md) for all pages.
