Skip to content

Commit 7d4056a

Browse files
committed
Release v1.1.0: Added parallel processing, credit monitoring, and retry logic
1 parent 883769c commit 7d4056a

File tree

4 files changed

+475
-261
lines changed

4 files changed

+475
-261
lines changed

README.md

Lines changed: 91 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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:
4244
export 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

4772
The 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

143204
Example 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
168227
npm 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

173239
MIT

package-lock.json

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mcp-server-firecrawl",
3-
"version": "1.2.0",
3+
"version": "1.1.0",
44
"description": "MCP Server for FireCrawl",
55
"type": "module",
66
"main": "dist/src/index.js",
@@ -22,6 +22,7 @@
2222
"@types/jest": "^29.5.11",
2323
"@types/node": "^20.10.5",
2424
"jest": "^29.7.0",
25+
"jest-mock-extended": "^4.0.0-beta1",
2526
"ts-jest": "^29.1.1",
2627
"typescript": "^5.3.3"
2728
}

0 commit comments

Comments
 (0)