F

Firecrawl抓取工具

@codyde/mcp-firecrawl-tool
0 Stars 676 次浏览 codyde 更新于 2026-08-23

一个提供工具的服务器,可以通过Firecrawl的API刮取网站并从中提取结构化数据,支持基本的多格式网站抓取和基于自定义模式的数据提取。

该服务暂未提供标准配置,请参考 README 手动接入

服务介绍

MCP Firecrawl 服务器

这是一个简单的MCP服务器,它提供了使用Firecrawl的API来抓取网站并提取结构化数据的工具。

设置

  1. 安装依赖项:
npm install
  1. 在根目录下创建一个包含以下变量的.env文件:
FIRECRAWL_API_TOKEN=your_token_here
SENTRY_DSN=your_sentry_dsn_here
  • FIRECRAWL_API_TOKEN(必需):您的Firecrawl API令牌
  • SENTRY_DSN(可选):用于错误跟踪和性能监控的Sentry DSN
  1. 启动服务器:
npm start

或者,您可以在运行服务器时直接设置环境变量:

FIRECRAWL_API_TOKEN=your_token_here npm start

功能

  • 网站抓取:以多种格式从网站中提取内容
  • 结构化数据提取:基于自定义模式提取特定的数据点
  • 错误跟踪:与Sentry集成进行错误跟踪和性能监控

使用

该服务器公开了两个工具:

  1. scrape-website:具有多种格式选项的基本网站抓取
  2. extract-data:基于提示和模式的结构化数据提取

工具:scrape-website

此工具抓取网站,并以请求的格式返回其内容。

参数:

  • url (字符串,必需):要抓取的网站的URL
  • formats (字符串数组,可选):所需的输出格式数组。支持的格式包括:
    • "markdown"(默认)
    • "html"
    • "text"

使用MCP Inspector示例:

# Basic usage (defaults to markdown)
mcp-inspector --tool scrape-website --args '{
  "url": "https://example.com"
}'

# Multiple formats
mcp-inspector --tool scrape-website --args '{
  "url": "https://example.com",
  "formats": ["markdown", "html", "text"]
}'

工具:extract-data

此工具根据提供的提示和模式从网站中提取结构化数据。

参数:

  • urls (字符串数组,必需):要从中提取数据的URL数组
  • prompt (字符串,必需):描述要提取哪些数据的提示
  • schema (对象,必需):要提取数据的模式定义

模式定义应该是一个对象,其中键是字段名,值是类型。支持的类型有:

  • "string":用于文本字段
  • "boolean":用于布尔字段
  • "number":用于数字字段
  • 数组:指定为["type"],其中type是上述之一
  • 对象:带有自己类型定义的嵌套对象

使用MCP Inspector示例:

# Basic example extracting company information
mcp-inspector --tool extract-data --args '{
  "urls": ["https://example.com"],
  "prompt": "Extract the company mission, whether it supports SSO, and whether it is open source.",
  "schema": {
    "company_mission": "string",
    "supports_sso": "boolean",
    "is_open_source": "boolean"
  }
}'

# Complex example with nested data
mcp-inspector --tool extract-data --args '{
  "urls": ["https://example.com/products", "https://example.com/pricing"],
  "prompt": "Extract product information including name, price, and features.",
  "schema": {
    "products": [{
      "name": "string",
      "price": "number",
      "features": ["string"]
    }]
  }
}'

如果抓取或提取失败,这两个工具都会返回适当的错误消息,并在配置的情况下自动将错误记录到Sentry。

故障排除

如果您遇到问题:

  1. 验证您的Firecrawl API令牌是否有效
  2. 检查您尝试抓取的URL是否可访问
  3. 对于复杂的模式,请确保它们遵循支持的格式
  4. 查看Sentry日志获取详细的错误信息(如果已配置)

相关 MCP 服务