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

# MCP Setup (Browser Agents)

> Install the pre.dev MCP server — your coding agent gets browser automation as a native tool.

<Note>
  **One pre.dev MCP server, all the tools.** Install it once and your agent gets `browser_agent` (browser automation) plus `fast_spec` / `deep_spec` (the [Architect API](/architect-agent/overview)) in one shot.
</Note>

## Quick Start

<Steps>
  <Step title="Have a pre.dev account">
    Setup uses browser OAuth — your first MCP call opens pre.dev to sign in and authorize. No API key needed for editor use.
  </Step>

  <Step title="Install the MCP server">
    <Tabs>
      <Tab title="Claude Code">
        Run this in your terminal:

        ```bash theme={null}
        claude mcp add --transport http predev https://api.pre.dev/mcp
        ```

        Your browser opens to authorize — sign into pre.dev (if not already) and pick which account or organization to connect.

        <Info>
          See the [Claude Code MCP docs](https://docs.claude.com/en/docs/claude-code/mcp) for MCP basics.
        </Info>
      </Tab>

      <Tab title="Cursor — One-Click">
        [        <img src="https://mintcdn.com/predev/QGgGjSdBFC0UiIuz/images/addtocursor.png?fit=max&auto=format&n=QGgGjSdBFC0UiIuz&q=85&s=f5a8169180abacd0934f02f68bf5c4ec" alt="Add to Cursor" width="337" height="78" data-path="images/addtocursor.png" />](cursor://anysphere.cursor-deeplink/mcp/install?name=predev\&config=eyJ1cmwiOiJodHRwczovL2FwaS5wcmUuZGV2L21jcCJ9)

        Click the button above — Cursor installs the pre.dev server. On first tool use, a browser tab opens to authorize.
      </Tab>
    </Tabs>
  </Step>

  <Step title="Try it">
    Ask your agent:

    ```
    Use pre.dev browser_agent to extract the top 10 stories from
    news.ycombinator.com with title, url, and points.
    ```

    <Check>
      Your agent calls the `browser_agent` tool and returns structured JSON.
    </Check>
  </Step>
</Steps>

## Example prompts

<Tabs>
  <Tab title="Scrape structured data">
    ```
    Use pre.dev browser_agent to extract the top 10 products from
    https://www.producthunt.com with name, tagline, and upvote count.
    Return a JSON array.
    ```
  </Tab>

  <Tab title="Multi-step flow">
    ```
    Use pre.dev browser_agent: go to https://news.ycombinator.com/newest,
    click "More" twice to load 90 stories, then extract all titles and points.
    ```
  </Tab>

  <Tab title="Bulk enrichment">
    ```
    Use pre.dev browser_agent to process these 50 company URLs. For each:
    extract the company name, tagline, and link to their pricing page.
    Run with concurrency 10.
    ```
  </Tab>

  <Tab title="Authed SaaS scrape">
    ```
    Use pre.dev browser_agent to log into https://app.example.com with the
    credentials in `input` (email + password), then extract the list of
    projects from the dashboard.
    ```
  </Tab>
</Tabs>

## Live event streaming

Every step of a task emits an MCP `notifications/message` frame. The `taskIndex` field ties each event to a specific task in the batch. Your agent sees:

* `navigation` — the agent loaded a URL
* `plan` — the agent decided what to do next
* `action` — a click, type, or scroll executed
* `screenshot` — a screenshot was captured
* `done` — the task completed

Event shapes are identical to the REST SSE stream — see [Run a Task → SSE frames](/browser-agents/api/run-task#stream-stream-true).

## Auth

In editors, auth is browser OAuth — you sign in once and pick the account or org to connect. For programmatic MCP clients, an API key from [pre.dev/projects/key](https://pre.dev/projects/key) also works as a `predev-api-key` header.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Tool not found" icon="magnifying-glass">
    * Restart your client after adding the MCP config
    * Verify the URL is exactly `https://api.pre.dev/mcp`
    * Check JSON syntax in your config file
    * Confirm your API key is valid at [pre.dev/projects/key](https://pre.dev/projects/key)
  </Accordion>

  <Accordion title="Authentication failed" icon="triangle-exclamation">
    * Make sure the `Authorization` header starts with `Bearer ` (with the space)
    * Solo accounts: use your personal key. Enterprise: use the org key from your org settings
    * Check your subscription is active
  </Accordion>

  <Accordion title="Legacy tool names" icon="clock-rotate-left">
    `browser_task`, `browser_task_list`, `browser_task_get` still work as aliases — old integrations continue working without changes.
  </Accordion>
</AccordionGroup>
