Firecrawl MCP Server
A Model Context Protocol (MCP) server implementation that integrates with Firecrawl for web scraping capabilities.
Big thanks to @vrknetha, @cawstudios for the initial implementation!
Features
- Scrape, crawl, search, extract, deep research and batch scrape support
- Web scraping with JS rendering
- URL discovery and crawling
- Web search with content extraction
- Automatic retries with exponential backoff
-
- Efficient batch processing with built-in rate limiting
- Credit usage monitoring for cloud API
- Comprehensive logging system
- Support for cloud and self-hosted FireCrawl instances
- Mobile/Desktop viewport support
- Smart content filtering with tag inclusion/exclusion
Installation
Running with npx
1env FIRECRAWL_API_KEY=fc-YOUR_API_KEY npx -y firecrawl-mcp
Manual Installation
1npm install -g firecrawl-mcp
Running on Cursor
Configuring Cursor 🖥️ Note: Requires Cursor version 0.45.6+
To configure FireCrawl MCP in Cursor:
- Open Cursor Settings
- Go to Features > MCP Servers
- Click "+ Add New MCP Server"
- Enter the following:
- Name: "firecrawl-mcp" (or your preferred name)
- Type: "command"
- Command:
env FIRECRAWL_API_KEY=your-api-key npx -y firecrawl-mcp
If you are using Windows and are running into issues, try
cmd /c "set FIRECRAWL_API_KEY=your-api-key && npx -y firecrawl-mcp"
Replace your-api-key
with your FireCrawl API key.
After adding, refresh the MCP server list to see the new tools. The Composer Agent will automatically use FireCrawl MCP when appropriate, but you can explicitly request it by describing your web scraping needs. Access the Composer via Command+L (Mac), select "Agent" next to the submit button, and enter your query.
Running on Windsurf
Add this to your ./codeium/windsurf/model_config.json
:
1{ 2 "mcpServers": { 3 "mcp-server-firecrawl": { 4 "command": "npx", 5 "args": ["-y", "firecrawl-mcp"], 6 "env": { 7 "FIRECRAWL_API_KEY": "YOUR_API_KEY_HERE" 8 } 9 } 10 } 11}
Installing via Smithery (Legacy)
To install FireCrawl for Claude Desktop automatically via Smithery:
1npx -y @smithery/cli install @mendableai/mcp-server-firecrawl --client claude
Configuration
Environment Variables
Required for Cloud API
FIRECRAWL_API_KEY
: Your FireCrawl API key- Required when using cloud API (default)
- Optional when using self-hosted instance with
FIRECRAWL_API_URL
FIRECRAWL_API_URL
(Optional): Custom API endpoint for self-hosted instances- Example:
https://firecrawl.your-domain.com
- If not provided, the cloud API will be used (requires API key)
- Example:
Optional Configuration
Retry Configuration
FIRECRAWL_RETRY_MAX_ATTEMPTS
: Maximum number of retry attempts (default: 3)FIRECRAWL_RETRY_INITIAL_DELAY
: Initial delay in milliseconds before first retry (default: 1000)FIRECRAWL_RETRY_MAX_DELAY
: Maximum delay in milliseconds between retries (default: 10000)FIRECRAWL_RETRY_BACKOFF_FACTOR
: Exponential backoff multiplier (default: 2)
Credit Usage Monitoring
FIRECRAWL_CREDIT_WARNING_THRESHOLD
: Credit usage warning threshold (default: 1000)FIRECRAWL_CREDIT_CRITICAL_THRESHOLD
: Credit usage critical threshold (default: 100)
Configuration Examples
For cloud API usage with custom retry and credit monitoring:
1# Required for cloud API 2export FIRECRAWL_API_KEY=your-api-key 3 4# Optional retry configuration 5export FIRECRAWL_RETRY_MAX_ATTEMPTS=5 # Increase max retry attempts 6export FIRECRAWL_RETRY_INITIAL_DELAY=2000 # Start with 2s delay 7export FIRECRAWL_RETRY_MAX_DELAY=30000 # Maximum 30s delay 8export FIRECRAWL_RETRY_BACKOFF_FACTOR=3 # More aggressive backoff 9 10# Optional credit monitoring 11export FIRECRAWL_CREDIT_WARNING_THRESHOLD=2000 # Warning at 2000 credits 12export FIRECRAWL_CREDIT_CRITICAL_THRESHOLD=500 # Critical at 500 credits
For self-hosted instance:
1# Required for self-hosted 2export FIRECRAWL_API_URL=https://firecrawl.your-domain.com 3 4# Optional authentication for self-hosted 5export FIRECRAWL_API_KEY=your-api-key # If your instance requires auth 6 7# Custom retry configuration 8export FIRECRAWL_RETRY_MAX_ATTEMPTS=10 9export FIRECRAWL_RETRY_INITIAL_DELAY=500 # Start with faster retries
Usage with Claude Desktop
Add this to your claude_desktop_config.json
:
1{ 2 "mcpServers": { 3 "mcp-server-firecrawl": { 4 "command": "npx", 5 "args": ["-y", "firecrawl-mcp"], 6 "env": { 7 "FIRECRAWL_API_KEY": "YOUR_API_KEY_HERE", 8 9 "FIRECRAWL_RETRY_MAX_ATTEMPTS": "5", 10 "FIRECRAWL_RETRY_INITIAL_DELAY": "2000", 11 "FIRECRAWL_RETRY_MAX_DELAY": "30000", 12 "FIRECRAWL_RETRY_BACKOFF_FACTOR": "3", 13 14 "FIRECRAWL_CREDIT_WARNING_THRESHOLD": "2000", 15 "FIRECRAWL_CREDIT_CRITICAL_THRESHOLD": "500" 16 } 17 } 18 } 19}
System Configuration
The server includes several configurable parameters that can be set via environment variables. Here are the default values if not configured:
1const CONFIG = { 2 retry: { 3 maxAttempts: 3, // Number of retry attempts for rate-limited requests 4 initialDelay: 1000, // Initial delay before first retry (in milliseconds) 5 maxDelay: 10000, // Maximum delay between retries (in milliseconds) 6 backoffFactor: 2, // Multiplier for exponential backoff 7 }, 8 credit: { 9 warningThreshold: 1000, // Warn when credit usage reaches this level 10 criticalThreshold: 100, // Critical alert when credit usage reaches this level 11 }, 12};
These configurations control:
-
Retry Behavior
- Automatically retries failed requests due to rate limits
- Uses exponential backoff to avoid overwhelming the API
- Example: With default settings, retries will be attempted at:
- 1st retry: 1 second delay
- 2nd retry: 2 seconds delay
- 3rd retry: 4 seconds delay (capped at maxDelay)
-
Credit Usage Monitoring
- Tracks API credit consumption for cloud API usage
- Provides warnings at specified thresholds
- Helps prevent unexpected service interruption
- Example: With default settings:
- Warning at 1000 credits remaining
- Critical alert at 100 credits remaining
Rate Limiting and Batch Processing
The server utilizes FireCrawl's built-in rate limiting and batch processing capabilities:
- Automatic rate limit handling with exponential backoff
- Efficient parallel processing for batch operations
- Smart request queuing and throttling
- Automatic retries for transient errors
Available Tools
1. Scrape Tool (firecrawl_scrape
)
Scrape content from a single URL with advanced options.
1{ 2 "name": "firecrawl_scrape", 3 "arguments": { 4 "url": "https://example.com", 5 "formats": ["markdown"], 6 "onlyMainContent": true, 7 "waitFor": 1000, 8 "timeout": 30000, 9 "mobile": false, 10 "includeTags": ["article", "main"], 11 "excludeTags": ["nav", "footer"], 12 "skipTlsVerification": false 13 } 14}
2. Batch Scrape Tool (firecrawl_batch_scrape
)
Scrape multiple URLs efficiently with built-in rate limiting and parallel processing.
1{ 2 "name": "firecrawl_batch_scrape", 3 "arguments": { 4 "urls": ["https://example1.com", "https://example2.com"], 5 "options": { 6 "formats": ["markdown"], 7 "onlyMainContent": true 8 } 9 } 10}
Response includes operation ID for status checking:
1{ 2 "content": [ 3 { 4 "type": "text", 5 "text": "Batch operation queued with ID: batch_1. Use firecrawl_check_batch_status to check progress." 6 } 7 ], 8 "isError": false 9}
3. Check Batch Status (firecrawl_check_batch_status
)
Check the status of a batch operation.
1{ 2 "name": "firecrawl_check_batch_status", 3 "arguments": { 4 "id": "batch_1" 5 } 6}
4. Search Tool (firecrawl_search
)
Search the web and optionally extract content from search results.
1{ 2 "name": "firecrawl_search", 3 "arguments": { 4 "query": "your search query", 5 "limit": 5, 6 "lang": "en", 7 "country": "us", 8 "scrapeOptions": { 9 "formats": ["markdown"], 10 "onlyMainContent": true 11 } 12 } 13}
5. Crawl Tool (firecrawl_crawl
)
Start an asynchronous crawl with advanced options.
1{ 2 "name": "firecrawl_crawl", 3 "arguments": { 4 "url": "https://example.com", 5 "maxDepth": 2, 6 "limit": 100, 7 "allowExternalLinks": false, 8 "deduplicateSimilarURLs": true 9 } 10}
6. Extract Tool (firecrawl_extract
)
Extract structured information from web pages using LLM capabilities. Supports both cloud AI and self-hosted LLM extraction.
1{ 2 "name": "firecrawl_extract", 3 "arguments": { 4 "urls": ["https://example.com/page1", "https://example.com/page2"], 5 "prompt": "Extract product information including name, price, and description", 6 "systemPrompt": "You are a helpful assistant that extracts product information", 7 "schema": { 8 "type": "object", 9 "properties": { 10 "name": { "type": "string" }, 11 "price": { "type": "number" }, 12 "description": { "type": "string" } 13 }, 14 "required": ["name", "price"] 15 }, 16 "allowExternalLinks": false, 17 "enableWebSearch": false, 18 "includeSubdomains": false 19 } 20}
Example response:
1{ 2 "content": [ 3 { 4 "type": "text", 5 "text": { 6 "name": "Example Product", 7 "price": 99.99, 8 "description": "This is an example product description" 9 } 10 } 11 ], 12 "isError": false 13}
Extract Tool Options:
urls
: Array of URLs to extract information fromprompt
: Custom prompt for the LLM extractionsystemPrompt
: System prompt to guide the LLMschema
: JSON schema for structured data extractionallowExternalLinks
: Allow extraction from external linksenableWebSearch
: Enable web search for additional contextincludeSubdomains
: Include subdomains in extraction
When using a self-hosted instance, the extraction will use your configured LLM. For cloud API, it uses FireCrawl's managed LLM service.
7. Deep Research Tool (firecrawl_deep_research)
Conduct deep web research on a query using intelligent crawling, search, and LLM analysis.
1{ 2 "name": "firecrawl_deep_research", 3 "arguments": { 4 "query": "how does carbon capture technology work?", 5 "maxDepth": 3, 6 "timeLimit": 120, 7 "maxUrls": 50 8 } 9}
Arguments:
- query (string, required): The research question or topic to explore.
- maxDepth (number, optional): Maximum recursive depth for crawling/search (default: 3).
- timeLimit (number, optional): Time limit in seconds for the research session (default: 120).
- maxUrls (number, optional): Maximum number of URLs to analyze (default: 50).
Returns:
- Final analysis generated by an LLM based on research. (data.finalAnalysis)
- May also include structured activities and sources used in the research process.
8. Generate LLMs.txt Tool (firecrawl_generate_llmstxt)
Generate a standardized llms.txt (and optionally llms-full.txt) file for a given domain. This file defines how large language models should interact with the site.
1{ 2 "name": "firecrawl_generate_llmstxt", 3 "arguments": { 4 "url": "https://example.com", 5 "maxUrls": 20, 6 "showFullText": true 7 } 8}
Arguments:
- url (string, required): The base URL of the website to analyze.
- maxUrls (number, optional): Max number of URLs to include (default: 10).
- showFullText (boolean, optional): Whether to include llms-full.txt contents in the response.
Returns:
- Generated llms.txt file contents and optionally the llms-full.txt (data.llmstxt and/or data.llmsfulltxt)
Logging System
The server includes comprehensive logging:
- Operation status and progress
- Performance metrics
- Credit usage monitoring
- Rate limit tracking
- Error conditions
Example log messages:
[INFO] FireCrawl MCP Server initialized successfully
[INFO] Starting scrape for URL: https://example.com
[INFO] Batch operation queued with ID: batch_1
[WARNING] Credit usage has reached warning threshold
[ERROR] Rate limit exceeded, retrying in 2s...
Error Handling
The server provides robust error handling:
- Automatic retries for transient errors
- Rate limit handling with backoff
- Detailed error messages
- Credit usage warnings
- Network resilience
Example error response:
1{ 2 "content": [ 3 { 4 "type": "text", 5 "text": "Error: Rate limit exceeded. Retrying in 2 seconds..." 6 } 7 ], 8 "isError": true 9}
Development
1# Install dependencies 2npm install 3 4# Build 5npm run build 6 7# Run tests 8npm test
Contributing
- Fork the repository
- Create your feature branch
- Run tests:
npm test
- Submit a pull request
License
MIT License - see LICENSE file for details