> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/test/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/test/compute/mcpg/web-search/firecrawl.md).

# Firecrawl

来自Firecrwal的网页抓取服务，可以将网页转成md格式

## MCP 工具

### Search（搜索）

来自Firecrwal的搜索服务

#### 参数

**Header 参数**

* `Authorization` (string, 可选): API Key | 示例值：`Bearer {{YOUR_API_KEY}}`

**Body 参数**

* `query` (string, 必需): 搜索查询 | 示例值：`zenlayer`
* `limit` (number, 可选): 返回结果的最大数量（1–100）。默认：`5` | 示例值：`5`
* `tbs` (string, 可选): 时间搜索参数，支持预定义区间 `qdr:h`、`qdr:d`、`qdr:w`、`qdr:m`、`qdr:y`，以及自定义范围 `cdr:1`、`cd_min:MM/DD/YYYY`、`cd_max:MM/DD/YYYY`
* `location` (string, 可选): 搜索结果的位置参数
* `timeout` (number, 可选): 超时时间（毫秒）。默认：`60000` | 示例值：`60000`
* `ignoreInvalidURLs` (boolean, 可选): 排除无效 URL 以减少后续端点调用错误。默认：`false`
* `scrapeOptions` (object, 可选): 抓取搜索结果的选项

### Scrape（页面抓取）

来自Firecrwal的网页抓取服务，可以将网页转成md格式

#### 参数

**Header 参数**

* `Authorization` (string, 可选): API Key | 示例值：`Bearer {{YOUR_API_KEY}}`

**Body 参数**

* `url` (string, 必需): | 示例值：`<string>`
* `formats` (array, 可选):
* `onlyMainContent` (boolean, 可选): | 示例值：`True`
* `includeTags` (array, 可选):
* `excludeTags` (array, 可选):
* `maxAge` (number, 可选): 返回缓存页面的最大年龄（毫秒）。`0` 禁用缓存 | 示例值：`0`
* `waitFor` (number, 可选): 延迟毫秒数，等待页面加载 | 示例值：`0`
* `mobile` (boolean, 可选): 是否模拟移动设备 | 示例值：`False`
* `skipTlsVerification` (boolean, 可选): 是否跳过 TLS 证书校验 | 示例值：`False`
* `timeout` (number, 可选): 请求超时时间（毫秒） | 示例值：`30000`
* `parsePDF` (boolean, 可选): PDF 处理方式，`true` 提取为 Markdown，`false` 返回 Base64 | 示例值：`True`
* `jsonOptions` (object, 可选): JSON 提取选项
* `location` (object, 可选): 请求位置设置，默认 `US`
* `removeBase64Images` (boolean, 可选): 移除 Base64 图片，仅保留替代文本 | 示例值：`True`
* `blockAds` (boolean, 可选): 启用广告拦截与弹窗拦截 | 示例值：`True`
* `proxy` (string, 可选): 代理类型 | 示例值：`basic`
* `storeInCache` (boolean, 可选): 是否将页面存入 Firecrawl 索引和缓存，数据敏感时设置为 `false` | 示例值：`True`

### Map（网站地图）

来自Firecrwal的网页地图获取服务

#### 参数

**Header 参数**

* `Authorization` (string, 可选): API Key | 示例值：`Bearer {{YOUR_API_KEY}}`

**Body 参数**

* `url` (string, 必需): | 示例值：`<string>`
* `search` (string, 可选): | 示例值：`<string>`
* `ignoreSitemap` (boolean, 可选): 是否忽略网站 sitemap | 示例值：`True`
* `sitemapOnly` (boolean, 可选): 仅返回 sitemap 中的链接 | 示例值：`False`
* `includeSubdomains` (boolean, 可选): 是否包含子域名 | 示例值：`False`
* `limit` (number, 可选): 返回链接的最大数量（最多 30000） | 示例值：`5000`
* `timeout` (number, 可选): 超时时间（毫秒） | 示例值：`123`
* `location` (object, 可选): 请求位置设置，默认 `US`

### MCP Cline 配置

此服务器需要通过您的 MCP 客户端进行配置。以下是不同环境下的示例：

需要替换你的租户ID和API Key（必需）

```
{
  "mcpServers": {
    "firecrawl": {
      "type": "streamable_http",
      "url": "https://mcp.ecn.ai/{租户ID}/firecrawl/mcp",
      "headers": {
        "Authorization": "Bearer 你的API Key"
      }
    }
  }
}
```

## API 接口

### Search（搜索）

#### 请求信息

* **Method**: POST
* **Endpoint**: `/firecrawl/v1/search`

#### 请求参数

**Header 参数**

* `Authorization` (string, 可选): API Key | 示例值：`Bearer {{YOUR_API_KEY}}`

**Body 参数**

* `query` (string, 必需): 搜索查询 | 示例值：`zenlayer`
* `limit` (number, 可选): 返回结果的最大数量（1–100）。默认：`5` | 示例值：`5`
* `tbs` (string, 可选): 时间搜索参数，支持预定义区间 `qdr:h`、`qdr:d`、`qdr:w`、`qdr:m`、`qdr:y`，以及自定义范围 `cdr:1`、`cd_min:MM/DD/YYYY`、`cd_max:MM/DD/YYYY`
* `location` (string, 可选): 搜索结果的位置参数
* `timeout` (number, 可选): 超时时间（毫秒）。默认：`60000` | 示例值：`60000`
* `ignoreInvalidURLs` (boolean, 可选): 排除无效 URL 以减少后续端点调用错误。默认：`false`
* `scrapeOptions` (object, 可选): 抓取搜索结果的选项

#### 返回响应

* **200 成功**
  * Content-Type：`application/json`

#### 请求示例

```
curl --location --request POST 'https://api.ecn.ai/firecrawl/v1/search' \
	--header 'Content-Type: application/json' \
	--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
	--data-raw '{
  "query": "<string>",
  "limit": 5,
  "tbs": "<string>",
  "location": "<string>",
  "timeout": 60000,
  "ignoreInvalidURLs": false,
  "scrapeOptions": {
    "onlyMainContent": true,
    "maxAge": 0,
    "waitFor": 0,
    "mobile": false,
    "skipTlsVerification": false,
    "timeout": 30000,
    "parsePDF": true,
    "location": {
      "country": "US"
    },
    "removeBase64Images": true,
    "blockAds": true,
    "storeInCache": true,
    "formats": []
  }
}'
```

#### 响应示例

```json
{
  "success": true,
  "data": [
    {
      "title": "<string>",
      "description": "<string>",
      "url": "<string>",
      "markdown": "<string>",
      "html": "<string>",
      "rawHtml": "<string>",
      "links": [
        "<string>"
      ],
      "screenshot": "<string>",
      "metadata": {
        "title": "<string>",
        "description": "<string>",
        "sourceURL": "<string>",
        "statusCode": 123,
        "error": "<string>"
      }
    }
  ],
  "warning": "<string>",
  "id": "<string>"
}
```

### Scrape（页面抓取）

#### 请求信息

* **Method**: POST
* **Endpoint**: `/firecrawl/v1/scrape`

#### 请求参数

**Header 参数**

* `Authorization` (string, 可选): API Key | 示例值：`Bearer {{YOUR_API_KEY}}`

**Body 参数**

* `url` (string, 必需): | 示例值：`<string>`
* `formats` (array, 可选):
* `onlyMainContent` (boolean, 可选): | 示例值：`True`
* `includeTags` (array, 可选):
* `excludeTags` (array, 可选):
* `maxAge` (number, 可选): 返回缓存页面的最大年龄（毫秒）。`0` 禁用缓存 | 示例值：`0`
* `waitFor` (number, 可选): 延迟毫秒数，等待页面加载 | 示例值：`0`
* `mobile` (boolean, 可选): 是否模拟移动设备 | 示例值：`False`
* `skipTlsVerification` (boolean, 可选): 是否跳过 TLS 证书校验 | 示例值：`False`
* `timeout` (number, 可选): 请求超时时间（毫秒） | 示例值：`30000`
* `parsePDF` (boolean, 可选): PDF 处理方式，`true` 提取为 Markdown，`false` 返回 Base64 | 示例值：`True`
* `jsonOptions` (object, 可选): JSON 提取选项
* `location` (object, 可选): 请求位置设置，默认 `US`
* `removeBase64Images` (boolean, 可选): 移除 Base64 图片，仅保留替代文本 | 示例值：`True`
* `blockAds` (boolean, 可选): 启用广告拦截与弹窗拦截 | 示例值：`True`
* `proxy` (string, 可选): 代理类型 | 示例值：`basic`
* `storeInCache` (boolean, 可选): 是否将页面存入 Firecrawl 索引和缓存，数据敏感时设置为 `false` | 示例值：`True`

#### 返回响应

* **200 成功**
  * Content-Type：`application/json`

#### 请求示例

```
curl --location --request POST 'https://api.ecn.ai/firecrawl/v1/scrape' \
	--header 'Content-Type: application/json' \
	--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
	--data-raw '{
  "url": "<string>",
  "onlyMainContent": true,
  "includeTags": [
    "<string>"
  ],
  "excludeTags": [
    "<string>"
  ],
  "maxAge": 0,
  "headers": {},
  "waitFor": 0,
  "mobile": false,
  "skipTlsVerification": false,
  "timeout": 30000,
  "parsePDF": true,
  "jsonOptions": {
    "schema": {},
    "systemPrompt": "<string>",
    "prompt": "<string>"
  },
  "actions": [
    {
      "type": "wait",
      "milliseconds": 2,
      "selector": "#my-element"
    }
  ],
  "location": {
    "country": "US",
    "languages": [
      "en-US"
    ]
  },
  "removeBase64Images": true,
  "blockAds": true,
  "proxy": "basic",
  "storeInCache": true,
  "formats": [
    "markdown"
  ],
  "changeTrackingOptions": {
    "modes": [
      "git-diff"
    ],
    "schema": {},
    "prompt": "<string>",
    "tag": null
  },
  "zeroDataRetention": false
}'
```

#### 响应示例

```json
{
  "success": true,
  "data": {
    "markdown": "<string>",
    "html": "<string>",
    "rawHtml": "<string>",
    "screenshot": "<string>",
    "links": [
      "<string>"
    ],
    "actions": {
      "screenshots": [
        "<string>"
      ],
      "scrapes": [
        {
          "url": "<string>",
          "html": "<string>"
        }
      ],
      "javascriptReturns": [
        {
          "type": "<string>",
          "value": "<unknown>"
        }
      ],
      "pdfs": [
        "<string>"
      ]
    },
    "metadata": {
      "title": "<string>",
      "description": "<string>",
      "language": "<string>",
      "sourceURL": "<string>",
      "keywords": "<string>",
      "ogLocaleAlternate": [
        "<string>"
      ],
      "<any other metadata> ": "<string>",
      "statusCode": 123,
      "error": "<string>"
    },
    "llm_extraction": {},
    "warning": "<string>",
    "changeTracking": {
      "previousScrapeAt": "2023-11-07T05:31:56Z",
      "changeStatus": "new",
      "visibility": "visible",
      "diff": "<string>",
      "json": {}
    }
  }
}
```

### Map（网站地图）

#### 请求信息

* **Method**: POST
* **Endpoint**: `/firecrawl/v1/map`

#### 请求参数

**Header 参数**

* `Authorization` (string, 可选): API Key | 示例值：`Bearer {{YOUR_API_KEY}}`

**Body 参数**

* `url` (string, 必需): | 示例值：`<string>`
* `search` (string, 可选): | 示例值：`<string>`
* `ignoreSitemap` (boolean, 可选): 是否忽略网站 sitemap | 示例值：`True`
* `sitemapOnly` (boolean, 可选): 仅返回 sitemap 中的链接 | 示例值：`False`
* `includeSubdomains` (boolean, 可选): 是否包含子域名 | 示例值：`False`
* `limit` (number, 可选): 返回链接的最大数量（最多 30000） | 示例值：`5000`
* `timeout` (number, 可选): 超时时间（毫秒） | 示例值：`123`
* `location` (object, 可选): 请求位置设置，默认 `US`

#### 返回响应

* **200 成功**
  * Content-Type：`application/json`

#### 请求示例

```
curl --location --request POST 'https://api.ecn.ai/firecrawl/v1/map' \
	--header 'Content-Type: application/json' \
	--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
	--data-raw '{
  "url": "<string>",
  "search": "<string>",
  "ignoreSitemap": true,
  "sitemapOnly": false,
  "includeSubdomains": true,
  "limit": 5000,
  "timeout": 123,
  "location": {
    "country": "US",
    "languages": [
      "en-US"
    ]
  }
}'
```

#### 响应示例

```json
{
  "success": true,
  "links": [
    "<string>"
  ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/test/compute/mcpg/web-search/firecrawl.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
