firecrawl/cli
Firecrawl CLI and agent skills: search, scrape, and interact with the web from your terminal or any coding agent, plus parse, crawl, map, Agent and Monitor. Firecrawl is the context API for AI agents.
🔥 Firecrawl CLI – 概述
Firecrawl CLI 是一个命令行工具,让你直接从终端调用 Firecrawl 平台。Firecrawl 是一个 AI 驱动的网页抓取、搜索和爬虫服务,可以获取页面、提取干净的 Markdown、截取屏幕截图、运行自定义操作,甚至可以查询专业索引(研究论文、开发者代码、政府文档)。CLI 将这些功能封装为易于输入的命令,并安装技能,教流行的 AI 编码助手(Claude Code、Cursor、OpenClaw 等)自动使用 Firecrawl。
快速开始
# 全局安装
npm install -g firecrawl-cli
# 或者一行命令,安装、登录并添加技能到检测到的所有 AI 编辑器
npx -y firecrawl-cli@latest init -y --browser
# 抓取页面(默认输出 markdown)
firecrawl https://example.com
首次运行会提示你通过浏览器登录或粘贴 API 密钥。
核心命令
| 命令 | 功能 | 典型标志 |
|---|---|---|
scrape |
获取 URL 并以 markdown、HTML、JSON、链接、图片、截图等格式返回内容。 | --format markdown,links, --html, --screenshot, --only-main-content, -o <file> |
search |
执行网络搜索(类似 Google),可带高亮并自动抓取结果。 | --limit, --sources web,news,images, --categories research,developer,gov, --scrape, --scrape-formats markdown,links |
developer |
查询开发者索引 – 精选的公共仓库、GitHub Issue、PR、README 和文档,适用于编程问题。 | --limit, --json, --pretty |
gov |
查询政府索引 – 美国联邦、州和地方来源的法令、法规、法院意见等。 | --limit, --json |
research |
(摘录中未显示但已提及)搜索学术论文。 | |
login / init |
以交互式、浏览器或提供 API 密钥/环境变量的方式认证。 |
技能与代理集成
Firecrawl 可以将技能安装到 AI 编码助手中,使这些代理无需编写胶水代码即可调用 CLI 或 Firecrawl API。
# 安装核心技能集(抓取/搜索/交互原语)
firecrawl setup core
# 为开发者安装构建时 SDK 技能
firecrawl setup build
# 安装现成的工作流(例如 SEO 审计、研究简报)
firecrawl setup workflows
你可以使用 --agent <name> 将安装范围限定为单个“工具”(代理) – 支持的代理包括 Claude Code、Cursor、OpenClaw、OpenHands 等。
认证与自托管
- 交互式登录 – 运行基于浏览器的 OAuth 流程。
- API 密钥登录 –
firecrawl login --api-key <key>或设置FIRECRAWL_API_KEY。 - 自托管实例 – 使用
--api-url(或FIRECRAWL_API_URL)将 CLI 指向自定义 URL。当使用非默认 URL 时,CLI 会跳过认证,允许你针对本地 Firecrawl 服务器运行。
示例工作流
# 1️⃣ 抓取页面,仅保留主要文章,并保存为 markdown
firecrawl https://blog.example.com --only-main-content -o article.md
# 2️⃣ 搜索网络获取最新 AI 新闻,抓取前 5 个结果作为 markdown,并写入 JSON 摘要文件
firecrawl search
相关
- 项目
- 项目
- 项目
- 项目
- 项目