@@ -5,10 +5,12 @@ A Model Context Protocol (MCP) server for FireCrawl, providing web scraping, cra
55## Features
66
77- Web scraping with JavaScript rendering
8- - Batch scraping with async processing
8+ - Batch scraping with parallel processing and queuing
99- URL discovery and crawling
1010- Web search with content extraction
11- - Rate limiting and error handling
11+ - Automatic retries with exponential backoff
12+ - Credit usage monitoring for cloud API
13+ - Comprehensive logging system
1214- Support for cloud and self-hosted FireCrawl instances
1315
1416## Installation
@@ -21,7 +23,7 @@ npm install -g @mendable/mcp-server-firecrawl
2123
2224### Environment Variables
2325
24- - ` FIRE_CRAWL_API_KEY ` (Required): Your FireCrawl API key
26+ - ` FIRE_CRAWL_API_KEY ` (Required for cloud API ): Your FireCrawl API key
2527- ` FIRE_CRAWL_API_URL ` (Optional): Custom API endpoint for self-hosted instances
2628 - Example: ` https://firecrawl.your-domain.com `
2729 - If not provided, the cloud API will be used
@@ -42,12 +44,36 @@ For cloud usage, only the API key is required:
4244export FIRE_CRAWL_API_KEY=your-api-key
4345```
4446
47+ ### System Configuration
48+
49+ The server includes several configurable parameters:
50+
51+ ``` typescript
52+ const CONFIG = {
53+ retry: {
54+ maxAttempts: 3 ,
55+ initialDelay: 1000 , // 1 second
56+ maxDelay: 10000 , // 10 seconds
57+ backoffFactor: 2
58+ },
59+ batch: {
60+ delayBetweenRequests: 2000 , // 2 seconds
61+ maxParallelOperations: 3
62+ },
63+ credit: {
64+ warningThreshold: 1000 ,
65+ criticalThreshold: 100
66+ }
67+ };
68+ ```
69+
4570### Rate Limits
4671
4772The server implements rate limiting to prevent API abuse:
4873
4974- 3 requests per minute
50- - 25-second cooldown when limit is reached
75+ - Automatic retries with exponential backoff
76+ - Parallel processing for batch operations
5177
5278## Available Tools
5379
@@ -81,75 +107,108 @@ Scrape content from a single URL with advanced options.
81107 "arguments" : {
82108 "url" : " https://example.com" ,
83109 "formats" : [" markdown" ],
84- "onlyMainContent" : true
110+ "onlyMainContent" : true ,
111+ "waitFor" : 1000 ,
112+ "timeout" : 30000
85113 }
86114}
87115```
88116
89117### 3. Batch Scrape Tool (` fire_crawl_batch_scrape ` )
90118
91- Scrape multiple URLs asynchronously .
119+ Scrape multiple URLs with parallel processing and queuing .
92120
93121``` json
94122{
95123 "name" : " fire_crawl_batch_scrape" ,
96124 "arguments" : {
97125 "urls" : [" https://example1.com" , " https://example2.com" ],
98126 "options" : {
99- "formats" : [" markdown" ]
127+ "formats" : [" markdown" ],
128+ "onlyMainContent" : true
100129 }
101130 }
102131}
103132```
104133
105- ### 4. Map Tool (` fire_crawl_map ` )
134+ Response includes operation ID for status checking:
135+ ``` json
136+ {
137+ "content" : [{
138+ "type" : " text" ,
139+ "text" : " Batch operation queued with ID: batch_1. Use fire_crawl_check_batch_status to check progress."
140+ }],
141+ "isError" : false
142+ }
143+ ```
144+
145+ ### 4. Check Batch Status (` fire_crawl_check_batch_status ` )
106146
107- Discover URLs from a starting point .
147+ Check the status of a batch operation .
108148
109149``` json
110150{
111- "name" : " fire_crawl_map " ,
151+ "name" : " fire_crawl_check_batch_status " ,
112152 "arguments" : {
113- "url" : " https://example.com" ,
114- "includeSubdomains" : true
153+ "id" : " batch_1"
115154 }
116155}
117156```
118157
119158### 5. Crawl Tool (` fire_crawl_crawl ` )
120159
121- Start an asynchronous crawl from a URL .
160+ Start an asynchronous crawl with advanced options .
122161
123162``` json
124163{
125164 "name" : " fire_crawl_crawl" ,
126165 "arguments" : {
127166 "url" : " https://example.com" ,
128167 "maxDepth" : 2 ,
129- "limit" : 100
168+ "limit" : 100 ,
169+ "allowExternalLinks" : false ,
170+ "deduplicateSimilarURLs" : true
130171 }
131172}
132173```
133174
175+ ## Logging System
176+
177+ The server includes comprehensive logging:
178+
179+ - Operation status and progress
180+ - Performance metrics
181+ - Credit usage monitoring
182+ - Rate limit tracking
183+ - Error conditions
184+
185+ Example log messages:
186+ ```
187+ [INFO] FireCrawl MCP Server initialized successfully
188+ [INFO] Starting scrape for URL: https://example.com
189+ [INFO] Batch operation queued with ID: batch_1
190+ [WARNING] Credit usage has reached warning threshold
191+ [ERROR] Rate limit exceeded, retrying in 2s...
192+ ```
193+
134194## Error Handling
135195
136- The server provides detailed error messages for :
196+ The server provides robust error handling :
137197
138- - Invalid inputs
139- - Rate limit exceeded
140- - API errors
141- - Network issues
198+ - Automatic retries for transient errors
199+ - Rate limit handling with backoff
200+ - Detailed error messages
201+ - Credit usage warnings
202+ - Network resilience
142203
143204Example error response:
144205
145206``` json
146207{
147- "content" : [
148- {
149- "type" : " text" ,
150- "text" : " Error: Rate limit exceeded. Please wait 25 seconds."
151- }
152- ],
208+ "content" : [{
209+ "type" : " text" ,
210+ "text" : " Error: Rate limit exceeded. Retrying in 2 seconds..."
211+ }],
153212 "isError" : true
154213}
155214```
@@ -168,6 +227,13 @@ npm test
168227npm run build
169228```
170229
230+ ### Contributing
231+
232+ 1 . Fork the repository
233+ 2 . Create your feature branch
234+ 3 . Run tests: ` npm test `
235+ 4 . Submit a pull request
236+
171237## License
172238
173239MIT
0 commit comments