Skip to main content
Connect the Vercel AI SDK MCP client to Firecrawl’s hosted MCP server and use Firecrawl’s tools in generateText and streamText.
Looking for Firecrawl tools packaged as AI SDK tools instead of an MCP connection? See the Vercel AI SDK guide.

Quick setup

Create a Firecrawl API key, then install the AI SDK and its MCP package:
Create the client with the HTTP transport and your key in the Authorization header:
The list includes firecrawl_scrape, firecrawl_search, firecrawl_map, and firecrawl_crawl. Pass tools to generateText or streamText as described in the AI SDK MCP guide, and close the client with await mcpClient.close() when the response is finished. Prefer a local process? Use the AI SDK’s stdio transport with npx -y firecrawl-mcp and FIRECRAWL_API_KEY in env; the AI SDK recommends HTTP for production.

Try it

Call a tool directly to confirm the connection:
Then give the tools to a model with a prompt such as:

Troubleshooting

  • Authentication errors: confirm FIRECRAWL_API_KEY is set in the process that runs the client and that the header reads Bearer <key>.
  • Redirect errors: the AI SDK client rejects redirects by default; use the exact URL https://mcp.firecrawl.dev/v2/mcp.
  • Open handles after a script ends: call mcpClient.close() when you are done with the tools.