Skip to main content

Firecrawl Plugin

The Firecrawl plugin provides web search and content extraction through the Firecrawl API. Firecrawl specializes in scraping JavaScript-rendered pages, bypassing anti-bot protections, and returning clean, well-structured markdown.

Source: packages/plugins/firecrawl/src/firecrawl.plugin.ts

Overview

PropertyValue
Plugin IDfirecrawl
Categorysearch
Capabilitiessearch, content-extractor
Version1.0.0
Configuration Modehybrid
Auto-enableNo
SDK@mendable/firecrawl-js

The plugin implements IPlugin, ISearchPlugin, and IContentExtractorPlugin.

Architecture

Configuration

Settings Schema

SettingTypeRequiredEnv VariableDescription
apiKeystringYesPLUGIN_FIRECRAWL_API_KEYYour Firecrawl API key. Marked as secret.

Obtaining an API Key

  1. Create an account at firecrawl.dev.
  2. Copy your API key from the dashboard.
  3. Enter it in the plugin settings or set the PLUGIN_FIRECRAWL_API_KEY environment variable.

Search Capability

The search method uses the Firecrawl SDK's search() function:

const response = await client.search(options.query, {
limit: options.limit
});

Response Mapping

Results are extracted from the response.web array and mapped to SearchResult:

FieldSourceFallback
titleitem.title""
urlitem.url""
snippetitem.descriptionitem.markdown
position1-based index--
sourceHostname from item.urlundefined

The search response always sets hasMore: false since Firecrawl does not provide pagination information.

Content Extraction

Single Page Scraping

The extract() method scrapes a single URL using Firecrawl's scrape() function with markdown output:

const doc = await client.scrape(options.url, {
formats: ['markdown']
});

Extraction Result

FieldDescription
contentClean markdown extracted from the page
markdownSame as content
titleFrom doc.metadata.title
finalUrlResolved URL from doc.metadata.url (if different from input)
wordCountWord count from splitting markdown on whitespace
readingTimeMath.ceil(wordCount / 200) minutes

If the scrape returns empty markdown, the method returns { success: false } with an appropriate error message.

Batch Scraping

The extractBatch() method attempts two strategies:

  1. Batch API (preferred): Calls client.batchScrape() with all URLs in a single request.
  2. Sequential fallback: If the batch API fails, falls back to Promise.allSettled() calling extract() for each URL individually.
// Strategy 1: Batch API
try {
const job = await client.batchScrape([...urls], {
options: { formats: ['markdown'] }
});
if (job.data && job.data.length > 0) {
return job.data.map(/* ... */);
}
} catch {
// Strategy 2: Sequential fallback
}

const results = await Promise.allSettled(urls.map((url) => this.extract({ url, ...options })));

The sequential fallback uses Promise.allSettled() instead of Promise.all() to ensure that individual failures do not prevent other URLs from being processed.

Supported Formats

getSupportedFormats(): readonly ('text' | 'html' | 'markdown')[] {
return ['markdown'];
}

Firecrawl returns markdown only. This is its primary strength -- it handles JavaScript rendering and produces clean markdown from any page.

Key Advantages

FeatureDescription
JavaScript renderingHandles dynamic/SPA pages that simple HTTP fetches miss
Anti-bot bypassAutomatically handles common protections like CAPTCHAs
Clean outputReturns well-structured markdown, stripping ads and navigation
Metadata extractionCaptures page title, description, and final URL
Batch processingNative batch API for efficient multi-URL extraction

Client Instantiation

A new FirecrawlApp instance is created for each operation:

private getClient(settings?: PluginSettings): FirecrawlApp {
const apiKey = settings?.apiKey as string;
if (!apiKey) {
throw new Error(API_KEY_ERROR);
}
return new FirecrawlApp({ apiKey });
}

Error Handling

ScenarioBehavior
Missing API keyThrows Error with descriptive message.
Search failureLogs error, re-throws to caller.
Single extraction failureReturns { success: false, error: '...' }.
Batch API failureFalls back to sequential extraction.
Sequential extraction failureUses Promise.allSettled() -- individual failures return error results.
Empty contentReturns { success: false, error: 'No content extracted' }.

Rate Limits

Rate limit tracking is not performed client-side (getRateLimitInfo() returns -1). Firecrawl enforces limits at the API level. Typical plan limits:

PlanCredits/MonthPages/Scrape
Free5001
Starter3,000Configurable
Standard100,000Configurable

Lifecycle

MethodBehavior
onLoad(context)Stores plugin context.
onUnload()Clears context.
healthCheck()Returns healthy.
isAvailable()Returns true.
canExtract(url)Returns true for http: and https: URLs.

Usage in the Platform

Firecrawl is particularly valuable for works that reference JavaScript-heavy websites. During generation:

  1. Search finds relevant pages about each work item.
  2. Content extraction scrapes those pages -- including SPAs and dynamically-rendered content -- into clean markdown for enriching item descriptions.