> ## Documentation Index
> Fetch the complete documentation index at: https://hyperbrowser.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Authenticate REST, SDK, and CLI requests with the `x-api-key` header using the `HYPERBROWSER_API_KEY` environment variable (create keys at https://app.hyperbrowser.ai).
> Always stop browser sessions (`sessions.stop(id)` / `PUT /api/session/{id}/stop`) and sandboxes (`sandboxes.stop(id)` / `PUT /api/sandbox/{id}/stop`) in `try`/`finally` blocks to avoid idle billing.
> Choose the right surface: use Web API (`/api/web/fetch`, `batch-fetch`, `crawl`, `search`) for stateless reading and extraction (prefer it over legacy `/api/scrape`); Browser Sessions (`/api/session`) for interactive, authenticated, or Playwright/Puppeteer workflows; Cloud Agents (`/api/task/*`) for autonomous browser tasks; and Sandboxes (`/api/sandbox`) for isolated Linux or macOS code execution.
> Use `@hyperbrowser/sdk` for Node.js/TypeScript, `hyperbrowser` 1.0+ typed-dict request params for Python (avoid legacy Pydantic request classes), the unified `hx` CLI for terminal workflows, and hosted OAuth MCP at `https://mcp.hyperbrowser.ai/mcp/web` (web tools; use `https://mcp.hyperbrowser.ai/mcp` only when browser, sandbox, admin, and usage tools are needed).

# Coding Agents + Hosted MCP Workflow

> Configure Claude Code or Codex with web-only Hosted MCP and verify live web apps with the hx CLI

This recipe sets up a coding agent so it can read documentation, verify live web pages, and run browser checks. Its MCP connection uses `/mcp/web`, which works without needing administrative permissions over your Hyperbrowser account.

## Prerequisites

* A Hyperbrowser account for OAuth browser consent (for MCP) and `HYPERBROWSER_API_KEY` or `hx auth login` (for Step 3).
* Claude Code, Codex, or VS Code with MCP support, plus the [`hx` CLI](https://hyperbrowser.ai/docs/cli/overview) installed for terminal checks.

***

## Step 1: Connect Hosted MCP (`/mcp/web`)

Use the `/mcp/web` URL path so the coding agent gets web search, fetch, crawl, and extract tools without browser, sandbox, or account-admin tools. The full `/mcp` endpoint also includes admin and usage tools and scopes; see [Connect to MCP](https://hyperbrowser.ai/docs/mcp/overview.md#hosted-server-and-endpoints) for every endpoint.

> [tab] Claude Code
>
> ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
> claude mcp add --transport http hyperbrowser https://mcp.hyperbrowser.ai/mcp/web
> ```

> [tab] Codex
>
> ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
> codex mcp add hyperbrowser --url https://mcp.hyperbrowser.ai/mcp/web
> codex mcp login hyperbrowser
> ```

***

## Step 2: Add a Guardrail Block to `AGENTS.md`

Paste a concise rule block into your repository's `AGENTS.md` or `CLAUDE.md` so the agent picks the cheapest surface and always cleans up sessions:

```markdown theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
## Hyperbrowser Rules
- Use `web_fetch` / `search_web` / `hx web fetch` for reading public pages instead of launching a full browser.
- Always stop browser sessions (`sessions.stop(id)` / `hx browser stop <id>`) and sandboxes (`sandbox.stop()` / `hx vm stop <id>`) in `try`/`finally` blocks.
- In Python, use `hyperbrowser` 1.0+ TypedDict payloads (`{"use_stealth": True}`), never legacy Pydantic request models.
```

***

## Step 3: Verify from the Terminal with `hx`

Pair MCP with `hx` when debugging a rendered page or streaming browser logs:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# Quick Markdown check on a live page
hx web fetch https://example.com --format markdown

# Open a stealth cloud browser with Live View for interactive debugging
SESSION_ID=$(hx --json browser create --stealth | jq -r '.data.id')
hx browser open "$SESSION_ID"
hx browser logs "$SESSION_ID" chrome --tail 100
hx browser stop "$SESSION_ID"
```

## Expected output

* Your coding agent completes browser OAuth consent for `https://mcp.hyperbrowser.ai/mcp/web` and lists only web tools (no browser, sandbox, or account-admin tools).
* `hx web fetch` prints clean Markdown to stdout, `hx --json browser create --stealth` returns a session ID, `hx browser open` opens Live View, and `hx browser stop` cleans up the session.

## Next Steps

* [Coding Agents & Skills](https://hyperbrowser.ai/docs/ai/coding-agents.md) — copyable `AGENTS.md` and role-split `SKILL.md` templates.
* [MCP Toolsets](https://hyperbrowser.ai/docs/mcp/toolsets.md) — customize toolset URL paths and scopes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.