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

# MCP Web Search & Scrape with OpenAI Agents

> Give OpenAI models Firecrawl web search and scraping through the Responses API MCP tool

Connect OpenAI models to Firecrawl by adding the hosted MCP server as a remote `mcp` tool in the Responses API. OpenAI lists the Firecrawl tools, and the model calls them to search the web and read pages.

<Note>
  OpenAI's documentation says Agent Builder is scheduled to shut down on November 30, 2026. The remote MCP tool on this page does not depend on Agent Builder.
</Note>

## Requirements

* An OpenAI API key in `OPENAI_API_KEY` and the `openai` Python package.
* A [Firecrawl API key](https://www.firecrawl.dev/app/api-keys) in `FIRECRAWL_API_KEY`.

## Quick setup

Add the Firecrawl server to the `tools` list. The `authorization` field carries your Firecrawl API key, and `allowed_tools` limits what the model can call:

```python theme={null}
import os
from openai import OpenAI

client = OpenAI()

response = client.responses.create(
    model="gpt-6-astra",
    tools=[
        {
            "type": "mcp",
            "server_label": "firecrawl",
            "server_description": "Search the web and read pages as Markdown.",
            "server_url": "https://mcp.firecrawl.dev/v2/mcp",
            "authorization": os.environ["FIRECRAWL_API_KEY"],
            "allowed_tools": ["firecrawl_search", "firecrawl_scrape"],
            "require_approval": "never",
        }
    ],
    input="Search the web for the latest Next.js release notes and summarize the sources.",
)

print(response.output_text)
```

OpenAI does not store the `authorization` value, so send it on every request. Set `require_approval` to `"always"` if you want to review each tool call before data is sent to the server.

See [Configure an API key](/mcp-server/keyless#add-an-api-key) for more on key-based connections. This setup makes no direct Firecrawl API calls from your code, because OpenAI connects to the MCP server for you.

## Try it

```text theme={null}
Search the web for the latest TypeScript release notes and summarize the sources.
```

```text theme={null}
Scrape https://firecrawl.dev and explain what it does.
```

## What you can do

<CardGroup cols={2}>
  <Card title="Search" icon="magnifying-glass" href="/features/search">
    Find current information and read the content of relevant results.
  </Card>

  <Card title="Scrape" icon="file-lines" href="/features/scrape">
    Turn URLs into clean markdown or structured data.
  </Card>

  <Card title="Interact" icon="hand-pointer" href="/features/interact">
    Navigate, click, and fill forms to reach the data you need.
  </Card>

  <Card title="Alexandria" icon="books" href="/features/alexandria">
    Discover structured data tools, inspect inputs and pricing, then run them through Firecrawl.
  </Card>
</CardGroup>

## Troubleshooting

* **The request fails while listing tools:** confirm `server_url` is exactly `https://mcp.firecrawl.dev/v2/mcp` and that `FIRECRAWL_API_KEY` is set in the environment that runs the script.
* **The server returns `401`:** replace the key and send the request again, since OpenAI does not keep the `authorization` value between requests.
* **A tool is missing:** add its name to `allowed_tools`, or remove `allowed_tools` to import every tool the server exposes.
* **The model answers without using Firecrawl:** name the tool in your prompt, for example "Use firecrawl\_search to find...".


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.