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

# Quickstart

> Launch your first cloud browser session in under 2 minutes

# Quickstart

Get a persistent cloud browser running in minutes.

## 1. Install

<Tabs>
  <Tab title="CLI (Homebrew)">
    ```bash theme={null}
    brew tap meshbrow-dev/tap
    brew install meshbrow
    ```

    Verify the installation:

    ```bash theme={null}
    meshbrow version
    # meshbrow v0.1.0 (darwin/arm64)
    ```
  </Tab>

  <Tab title="MCP Server (for AI agents)">
    ```bash theme={null}
    brew tap meshbrow-dev/tap
    brew install meshbrow-mcp
    ```
  </Tab>

  <Tab title="TypeScript SDK">
    ```bash theme={null}
    npm install @meshbrow/sdk
    ```
  </Tab>

  <Tab title="Linux / CI">
    ```bash theme={null}
    curl -sSL https://get.meshbrow.dev | sh
    ```
  </Tab>
</Tabs>

## 2. Authenticate

Sign up at [meshbrow.dev](https://meshbrow.dev/signup) to get your API key.

<Tabs>
  <Tab title="CLI">
    ```bash theme={null}
    meshbrow auth login
    ```

    This opens your browser to authenticate — approve the request and the CLI completes automatically. To skip the browser, pass a key directly:

    ```bash theme={null}
    meshbrow auth login --key mb_live_your_key_here
    ```

    <Tip>
      Alternatively, set the `MESHBROW_API_KEY` environment variable — useful in CI/CD.

      ```bash theme={null}
      export MESHBROW_API_KEY=mb_live_your_key_here
      ```
    </Tip>
  </Tab>

  <Tab title="TypeScript SDK">
    ```typescript theme={null}
    import { Meshbrow } from '@meshbrow/sdk';

    const client = new Meshbrow({ apiKey: 'mb_live_...' });
    ```
  </Tab>
</Tabs>

## 3. Launch a Session

<Tabs>
  <Tab title="CLI">
    ```bash theme={null}
    meshbrow sessions create --proxy-type residential --proxy-country US --stealth max
    # ✓ Session created: sess_abc123
    #   CDP URL: wss://api.meshbrow.dev/cdp/sess_abc123?token=...
    #   Proxy:   US residential
    #   Stealth: max
    ```
  </Tab>

  <Tab title="TypeScript SDK">
    ```typescript theme={null}
    const session = await client.sessions.create({
      proxy: { type: 'residential', country: 'US' },
      stealth: 'max',
      fingerprint: 'auto',
    });

    console.log(`Session: ${session.id}`);
    console.log(`CDP URL: ${session.cdpUrl}`);
    ```
  </Tab>
</Tabs>

## 4. Connect with Playwright

```typescript theme={null}
import { chromium } from 'playwright';

const browser = await chromium.connectOverCDP(session.cdpUrl);
const context = browser.contexts()[0];
const page = context.pages()[0];

// Browse the web as a real user
await page.goto('https://app.example.com/dashboard');
await page.waitForTimeout(3000);

// Take a screenshot
await page.screenshot({ path: 'result.png' });
console.log('Session ready!');
```

Or via CLI:

```bash theme={null}
meshbrow actions navigate --session sess_abc123 --url https://app.example.com/dashboard
meshbrow actions screenshot --session sess_abc123 --output result.png
```

## 5. Destroy the Session

<Tabs>
  <Tab title="CLI">
    ```bash theme={null}
    meshbrow sessions destroy sess_abc123
    ```
  </Tab>

  <Tab title="TypeScript SDK">
    ```typescript theme={null}
    await client.sessions.destroy(session.id);
    ```
  </Tab>
</Tabs>

## Full Example

Here's the complete script with the TypeScript SDK:

```typescript theme={null}
import { Meshbrow } from '@meshbrow/sdk';
import { chromium } from 'playwright';

async function main() {
  const client = new Meshbrow({ apiKey: process.env.MESHBROW_API_KEY! });

  // Launch session
  const session = await client.sessions.create({
    proxy: { type: 'residential', country: 'US' },
    stealth: 'max',
  });

  try {
    // Connect Playwright
    const browser = await chromium.connectOverCDP(session.cdpUrl);
    const page = browser.contexts()[0].pages()[0];

    // Navigate and extract data
    await page.goto('https://example.com');
    const title = await page.title();
    console.log(`Page title: ${title}`);

    // Capture HAR
    await page.context().tracing.start({ screenshots: true });
    await page.goto('https://httpbin.org/ip');
    await page.context().tracing.stop({ path: 'trace.zip' });

  } finally {
    // Always clean up
    await client.sessions.destroy(session.id);
  }
}

main();
```

## Using the REST API Directly

If you prefer raw HTTP:

```bash theme={null}
# Create a session
curl -X POST https://api.meshbrow.dev/v1/sessions \
  -H "Authorization: Bearer mb_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "proxy": { "type": "residential", "country": "US" },
    "stealth": "max"
  }'

# Response:
# { "id": "sess_abc123", "cdpUrl": "wss://api.meshbrow.dev/cdp/sess_abc123?token=..." }

# Destroy when done
curl -X DELETE https://api.meshbrow.dev/v1/sessions/sess_abc123 \
  -H "Authorization: Bearer mb_live_..."
```

## Next Steps

* [CLI Reference](/guides/cli) — Full command reference for the `meshbrow` CLI
* [MCP Server](/guides/mcp-agents) — Give AI agents browser tools (Claude, Copilot, Cursor)
* [Browser Agent](/guides/agent) — The session daemon for health monitoring and metrics
* [Playwright Guide](/guides/playwright) — Advanced Playwright patterns
* [Session Profiles](/concepts/persistence) — Reuse cookies and login states
* [Proxy Selection](/guides/proxy-selection) — Choose the right proxy type
