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

# MCP

> Use the self-hosted Webcompute MCP server as a browser subagent, with advanced runtime tools available when the host needs exact control.

Use Webcompute MCP when a parent agent should get a browser specialist.

The recommended product path is agent mode: the host delegates a whole browsing
goal to `run_web_agent`. The technical default remains runtime mode, so
`web mcp run` without flags exposes low-level browser tools for backward
compatibility and model-free setup.

## Recommended setup

```bash theme={null}
web model setup --name browsing
web mcp setup claude --surface agent --model browsing --instructions
```

Replace `claude` with another supported host when needed:

```bash theme={null}
web mcp setup codex --surface agent --model browsing
web mcp setup openclaw --surface agent --model browsing --instructions
web mcp setup hermes --surface agent --model browsing --instructions
```

`--instructions` writes host-native guidance only where the safe instruction
path is verified. Codex setup writes MCP config; use the registered MCP prompt
or `mcpPrompt("agent")` for Codex-side instructions.

The MCP server is self-hosted. Your agent host starts a local stdio process with
your Webcompute credentials, model profile, and policy choices under your trust
boundary.

## Ask the parent agent

```text theme={null}
Use Webcompute to find Apple's latest 10-K on sec.gov. Return the filing URL and three risk-factor themes with citations.
```

The parent agent should call `run_web_agent` with the browsing goal:

```json theme={null}
{
  "goal": "Find Apple's latest 10-K on sec.gov. Return the filing URL and three risk-factor themes with citations.",
  "startUrl": "https://www.sec.gov/",
  "allowedDomains": ["sec.gov"],
  "outputSchema": {
    "type": "object",
    "properties": {
      "filingUrl": { "type": "string" },
      "riskThemes": {
        "type": "array",
        "items": { "type": "string" }
      }
    },
    "required": ["filingUrl", "riskThemes"]
  }
}
```

## Surfaces

| Surface   | Tools                                        | Positioning                                        |
| --------- | -------------------------------------------- | -------------------------------------------------- |
| `agent`   | `run_web_agent`                              | Recommended browser subagent path.                 |
| `runtime` | `manage_browsers`, `execute_playwright_code` | Technical default and advanced model-free control. |
| `all`     | All three tools                              | Expert escape hatch for debugging and migration.   |

Use `all` only when the parent agent truly needs both delegation and manual
follow-up. When both modes are visible, tell the parent agent to prefer
`run_web_agent` for whole browsing goals.

## Instruction delivery

Webcompute does not rely on large MCP initialize instructions. Hosts that
support MCP prompts can request:

* `browser_agent`
* `browser_runtime`
* `browser_all`

Code-first frameworks should import the SDK prompt helper:

```ts theme={null}
import { mcpPrompt } from "@webcompute/sdk";

const instructions = mcpPrompt("agent");
```

`mcpPrompt()` defaults to runtime, so agent examples call `mcpPrompt("agent")`
explicitly.

## Runtime escape hatch

Run the default runtime surface directly when a host needs exact browser-code
control and no nested model:

```bash theme={null}
web mcp run
```

Runtime mode exposes:

| Tool                      | Use it for                                                                                                        |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `manage_browsers`         | Create, list, inspect, status, stop, resume, close, Debug UI URL, CDP URL, and CAPTCHA status.                    |
| `execute_playwright_code` | Run focused browser code on the active page and receive result, status, logs, artifacts, and bounded observation. |

<Warning>
  Debug UI and CDP URLs returned through MCP are signed bearer capabilities.
  Treat them like credentials.
</Warning>

Reference: [agent mode](/integrations/mcp-agent-mode), [runtime mode](/integrations/mcp-runtime-mode), [framework examples](/integrations/mcp-frameworks), [MCP tool reference](/reference/mcp-tool-reference), and [agent contract](/reference/agent-contract).
