> ## Documentation Index
> Fetch the complete documentation index at: https://stagehand-fix-docs-test-timeout.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP integrations

> Call Model Context Protocol (MCP) servers alongside Stagehand's primitives

<Note>
  Stagehand v4 does not include an autonomous agent or a general-purpose MCP client. To call third-party MCP tools alongside Stagehand, orchestrate both from your own code as shown below.
</Note>

Stagehand also provides experimental [integrations](/v4/integrations/overview) that expose a persistent Stagehand browser to CrewAI, Deep Agents, Mastra, and the Vercel AI SDK over MCP. The Eve integration exposes the same tools natively.

<Card title="Stagehand integrations" icon="puzzle-piece" href="/v4/integrations/overview">
  Give an agent the `run`, `snapshot`, and `screenshot` browser tools.
</Card>

## Calling MCP servers from your code

Interleave your tool results with Stagehand's primitives. Because v4 has no autonomous loop, you are already writing the orchestration, so a tool call is one more step in the sequence.

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    // Your MCP client, your credentials, your control flow
    const searchResults = await mcpClient.callTool("web_search", {
      query: "browserbase pricing",
    });

    // Hand the result to Stagehand as an ordinary instruction
    await page.goto(searchResults.topUrl);

    const { data } = await stagehand.extract(
      "extract the pricing tiers",
      z.object({ pricing: z.array(z.object({ tier: z.string(), price: z.string() })) }),
    );
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    # Your MCP client, your credentials, your control flow
    search_results = await mcp_client.call_tool(
        "web_search", {"query": "browserbase pricing"}
    )

    # Hand the result to Stagehand as an ordinary instruction
    await page.goto(search_results["top_url"])


    class Tier(BaseModel):
        tier: str
        price: str


    class Pricing(BaseModel):
        pricing: list[Tier]


    result = await stagehand.extract(
        instruction="extract the pricing tiers",
        schema=Pricing,
    )
    pricing = result.data
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    // Your MCP client, your credentials, your control flow
    searchResults, err := mcpClient.CallTool(ctx, "web_search", map[string]any{
    	"query": "browserbase pricing",
    })
    if err != nil {
    	return err
    }

    // Hand the result to Stagehand as an ordinary instruction
    if _, err := page.Goto(ctx, searchResults.TopURL, nil); err != nil {
    	return err
    }

    type tier struct {
    	Tier  string `json:"tier"`
    	Price string `json:"price"`
    }

    type pricing struct {
    	Pricing []tier `json:"pricing"`
    }


    extracted, err := stagehand.Extract[pricing](
    	ctx,
    	client,
    	"extract the pricing tiers",
    	nil,
    )
    if err != nil {
    	return err
    }

    for _, t := range extracted.Data.Pricing {
    	fmt.Println(t.Tier, t.Price)
    }
    ```
  </Tab>
</Tabs>

<Tip>
  MCP is still useful on the authoring side: wire the Stagehand docs MCP server into your coding assistant so it generates correct v4 code. See [AI Rules](/v4/first-steps/ai-rules#using-mcp-servers).
</Tip>

## Next steps

<CardGroup cols={3}>
  <Card title="Act" icon="play" href="/v4/basics/act">
    Perform a single action with natural language
  </Card>

  <Card title="Extract" icon="table" href="/v4/basics/extract">
    Pull typed data out of any page
  </Card>

  <Card title="AI rules" icon="screwdriver-wrench" href="/v4/first-steps/ai-rules">
    MCP servers for your coding assistant
  </Card>
</CardGroup>
