← Catalog

@benvargas/pi-firecrawl

Firecrawl tools for pi - Web scraping, crawling, and data extraction via Firecrawl's REST API

Extension

Install

Install with PiG

pig install npm:@benvargas/pi-firecrawl

Install with Pi

pi install npm:@benvargas/pi-firecrawl
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./extensions/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 1.2.0 (README.md). PiG does not review it.

@benvargas/pi-firecrawl

Firecrawl tools for pi, the AI coding agent.

Provides focused Firecrawl REST API (v2) access for:

  • firecrawl_scrape
  • firecrawl_map
  • firecrawl_search

Features

  • Scrape (firecrawl_scrape) — Scrape a single URL
  • Map (firecrawl_map) — Discover URLs on a site
  • Search (firecrawl_search) — Search the web and optionally scrape results
  • Tool allowlist — Enable/disable tools via tools config
  • Configurable limits — Client-side truncation with configurable max bytes/lines
  • Multiple config sources — JSON config, environment variables, or CLI flags
  • Direct REST API — Simple, fast, no protocol overhead; targets Firecrawl API v2

Firecrawl v1 shutdown: Firecrawl's v1 API stops working on December 10, 2026 (15:00 UTC). pi-firecrawl 1.2.0 and later call v2; upgrade before that date. See API Version.

Installation

pi install npm:@benvargas/pi-firecrawl

Or try without installing:

pi -e npm:@benvargas/pi-firecrawl

Setup

Get an API key from firecrawl.dev and configure it using one of these methods.

Option 1: Environment Variable

export FIRECRAWL_API_KEY="your_firecrawl_api_key"
pi

Option 2: JSON Config

Create firecrawl.json in pi's agent extensions directory (~/.pi/agent/extensions/firecrawl.json by default; the agent directory honors PI_CODING_AGENT_DIR):

{
  "url": "https://api.firecrawl.dev",
  "apiKey": "your_firecrawl_api_key",
  "headers": null,
  "tools": ["firecrawl_scrape", "firecrawl_map", "firecrawl_search"],
  "timeoutMs": 30000,
  "maxBytes": 51200,
  "maxLines": 2000
}

If you want to disable search, remove it from the tools array.

Option 3: CLI Flags

pi --firecrawl-api-key=your_firecrawl_api_key

Usage

Once installed, the AI can use these tools when appropriate:

"Scrape https://example.com and get the main content"
"Map docs.example.com and list likely API pages"
"Search for React tutorials and summarize top results"

Tools

firecrawl_scrape

Scrape a single URL.

ParameterDescriptionDefault
urlTarget URL (required)—
formatsOutput formats: strings (markdown, html, links, summary, ...) or objects ({ "type": "json", "prompt", "schema" }, { "type": "screenshot", "fullPage": true })["markdown"]
onlyMainContentExtract only main content—
maxAgeAccept a cached copy up to this many milliseconds old; 0 forces a fresh scrape2 days
waitForWait time in milliseconds—
timeoutRequest timeout—
mobileUse mobile viewport—
includeTagsTags to include—
excludeTagsTags to exclude—
skipTlsVerificationSkip TLS verification—
piMaxBytesClient-side max bytes override—
piMaxLinesClient-side max lines override—

firecrawl_map

Discover URLs on a site.

ParameterDescriptionDefault
urlBase URL to map (required)—
searchSearch query to filter URLs—
sitemapSitemap handling mode (include, skip, only)—
includeSubdomainsInclude subdomains—
limitMaximum URLs to return—
ignoreQueryParametersIgnore query parameters—
piMaxBytesClient-side max bytes override—
piMaxLinesClient-side max lines override—

Search the web and optionally scrape results.

ParameterDescriptionDefault
querySearch query (required)—
limitMaximum results per source5
sourcesResult types: web, news, images["web"]
tbsTime filter (e.g. qdr:d, qdr:w)—
locationGeo-target location string—
langLanguage codeen
countryISO country code—
highlightsReplace short snippets with query-relevant page excerpts (much larger output)false
scrapeOptionsScrape options for results—
piMaxBytesClient-side max bytes override—
piMaxLinesClient-side max lines override—

Configuration

Config File Locations

Config files are loaded in order (first match wins):

  1. Path from --firecrawl-config flag
  2. Path from FIRECRAWL_CONFIG environment variable
  3. ./.pi/extensions/firecrawl.json (project-level)
  4. <agent-dir>/extensions/firecrawl.json (global — <agent-dir> is pi's agent directory, ~/.pi/agent by default or $PI_CODING_AGENT_DIR when set)
  5. ~/.pi/agent/extensions/firecrawl.json (legacy global — only checked when $PI_CODING_AGENT_DIR relocates the agent directory, so configs written before the relocation keep working)

If none exist, the extension writes a default config to the global path (<agent-dir>/extensions/firecrawl.json) with apiKey set to null.

Config File Format

{
  "url": "https://api.firecrawl.dev",
  "apiKey": null,
  "headers": null,
  "tools": ["firecrawl_scrape", "firecrawl_map", "firecrawl_search"],
  "timeoutMs": 30000,
  "maxBytes": 51200,
  "maxLines": 2000
}

Environment Variables

VariableDescriptionDefault
FIRECRAWL_URLAPI base URLhttps://api.firecrawl.dev
FIRECRAWL_API_KEYFirecrawl API key (Bearer token)—
FIRECRAWL_TIMEOUT_MSRequest timeout (ms)30000
FIRECRAWL_TOOLSComma-separated tool list—
FIRECRAWL_MAX_BYTESMax bytes to keep from output51200
FIRECRAWL_MAX_LINESMax lines to keep from output2000
FIRECRAWL_CONFIGPath to JSON config file—

CLI Flags

FlagDescription
--firecrawl-urlOverride the Firecrawl API base URL
--firecrawl-api-keyFirecrawl API key
--firecrawl-timeout-msHTTP timeout (milliseconds)
--firecrawl-configPath to JSON config file
--firecrawl-toolsComma-separated tool list
--firecrawl-max-bytesMax bytes to keep from output
--firecrawl-max-linesMax lines to keep from output

API Version

The tools call Firecrawl's v2 endpoints (/v2/scrape, /v2/map, /v2/search). The configured url is the service root and /v2/... is appended to it as given, so self-hosted instances mounted under a path keep working; they must serve the v2 API. On the hosted API only (api.firecrawl.dev), a pasted trailing /v1 or /v2 is dropped.

Differences from the v1-based releases (1.1.0 and earlier), as of 1.2.0:

  • Search output is an object grouped by source ({ "web": [...] }, plus news/images when requested) instead of a bare array.
  • Search default limit: the default limit stays at 5 (v2's own default is 10).
  • Search highlights defaults to false. v2 turns highlights on by default, which replaces the short snippet with page excerpts that can exceed 10KB per result; pass highlights: true to opt in.
  • Scrape caching: v2 serves cached pages up to 2 days old by default. Pass maxAge: 0 for a fresh scrape.
  • v1 argument shapes are translated so older prompts keep working: screenshot@fullPage, extract/jsonOptions, changeTrackingOptions, parsePDF: false, geolocation, and map ignoreSitemap/sitemapOnly. Map maxDepth and allowBackwardLinks have no v2 equivalent and are dropped.

Output Truncation

Tool output is automatically truncated to prevent context window overflow:

  • Default limits: 51200 bytes and 2000 lines
  • Client overrides: models can request piMaxBytes/piMaxLines (clamped to configured max)
  • Temp files: when truncated, full output is saved to a temp file with the path included in the response

Requirements

Uninstall

pi remove npm:@benvargas/pi-firecrawl

License

MIT