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

# Inspect CLI for coding agents

> Set up Inspect CLI and debug iOS Safari, Android Chrome, and WebViews with typed commands, raw CDP, or Chrome DevTools MCP.

Inspect CLI gives coding agents direct access to mobile browsers on physical
devices and iOS simulators. The canonical, copy-pasteable setup guide is
[inspect.dev/agent.md](https://inspect.dev/agent.md). Once installed, prefer
`inspect agent-context` and `inspect skills get mobile-debugging`: both are
generated from the installed CLI version and cannot drift from its commands.

## Install and preflight

```bash theme={null}
npm install -g @inspectdotdev/cli@latest
inspect --version
inspect status --json
inspect agent-context
```

The simulator-provisioning workflow below requires CLI 3.2.0 or newer. If
`inspect devices create` is absent, the registry has not supplied that release
yet: use an existing simulator or update the CLI before continuing. Do not mix
the foreground `inspect` server with typed commands on the same ports; typed
commands start and reuse their own daemon automatically.

Every command supports `--json`. Successful and failed responses use stable
`{ok, command, data | error}` envelopes, and errors include recovery
suggestions and meaningful exit codes.

## Zero-hardware iOS quickstart (macOS)

```bash theme={null}
inspect devices create "Inspect iPhone" "iPhone 17 Pro" --json
inspect devices boot <created-udid> --json
inspect devices list --json
inspect open http://localhost:3000 --json
inspect snapshot --interactive --json
inspect screenshot --json
```

The optional third `devices create` argument accepts an installed runtime name,
version, or identifier—for example `"iOS 26.5"`, `"26.5"`, or
`com.apple.CoreSimulator.SimRuntime.iOS-26-5`. Omit it to let Xcode choose the
newest compatible runtime. Simulator creation requires macOS and Xcode.

## Physical devices

* iPhone/iPad: connect over USB, unlock, trust the computer, and enable
  Settings → Safari → Advanced → Web Inspector.
* Android: enable Developer options and USB debugging, then accept the ADB
  authorization prompt.
* Run `inspect devices list --json`. If the device is absent or not `ready`,
  run `inspect doctor --json` and follow its suggestions.

## Agent debugging loop

```bash theme={null}
inspect open <url> --json
inspect snapshot --interactive --json
inspect console list --types error,exception --json
inspect network list --failed --json
# edit the project
inspect reload --json
inspect console list --after <lastEventId> --json
inspect screenshot --json
```

Use `--session <name>` to keep an agent's selected device, target, snapshot
references, and evidence checkpoints separate from other concurrent tasks.
`inspect devtools` opens Chrome DevTools for a human handoff without changing
the command workflow.

## Raw CDP and Chrome DevTools MCP

```bash theme={null}
inspect cdp --json
npx chrome-devtools-mcp@1.6.0 \
  --browser-url=http://127.0.0.1:9222
```

`inspect cdp` returns browser and page WebSocket URLs for custom CDP scripts.
See [MCP integrations](/developers/mcp) for the supported iOS/WebKit capability
matrix. Inspect returns explicit unsupported-capability errors where Chromium
features have no honest WebKit or host equivalent; callers must not treat error
text returned as MCP content as success.

## Current access model

Login is optional for the free tier. Every debugging capability is available
inside two free 15-minute sessions per day; device discovery, simulator
provisioning, target listing, diagnostics, status, and account commands never
open a session. `SUBSCRIPTION_REQUIRED` reports why access stopped and when a
new free session becomes available. Run `inspect upgrade --json` only when the
user wants a checkout link.

## Recovery

* No devices: `inspect doctor --json`.
* No targets: `inspect launch safari --url <url> --json`.
* Upgrade/daemon mismatch: rerun the command; the CLI follows the daemon
  sidecar and replaces an older daemon automatically. If a foreground server
  owns the ports, stop that server first.
* Stale snapshot ref: rerun `inspect snapshot --interactive --json` and use the
  new `@eN` reference.
* Need the exact installed contract: `inspect agent-context`.
