> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/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/api-reference/cn/compute/mcpg/web-search/exa.md).

# Exa

Exa AI 是一家新兴的 AI 搜索引擎公司，通过神经语义搜索技术为 AI 应用提供优化的搜索服务。与传统关键词搜索不同，Exa 理解查询的语义含义，能够返回更相关的结果。

## MCP 工具

### Search（搜索）

执行 Exa 提示工程优化的搜索查询，获取相关结果列表。可选择获取内容。

#### 参数

**Header 参数**

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

**Body 参数**

* `query` (string, 必需): 搜索查询字符串 | 示例值：`hottest AI startups`
* `type` (string, 可选): 搜索类型。`neural` 使用基于嵌入的模型，`auto`（默认）智能结合神经搜索和其他方法，`fast` 使用精简版搜索模型，`deep-lite` 是轻量级合成输出，`deep` 是深度搜索，`deep-reasoning` 是基础深度搜索，`instant` 提供最低延迟搜索。可选值：`neural`, `auto`, `fast`, `deep-lite`, `deep`, `deep-reasoning`, `instant` | 默认值：`auto`
* `numResults` (integer, 可选): 返回结果数量。neural 类型最多 100 条，deep-search 类型最多 100 条 | 默认值：`10`
* `additionalQueries` (array, 可选): 额外查询变体，用于更全面的搜索结果
* `systemPrompt` (string, 可选): 指导合成输出的指令，用于源偏好、新颖性或重复约束
* `stream` (boolean, 可选): 是否以服务器发送事件 (SSE) 流式返回 | 默认值：`false`
* `category` (string, 可选): 数据类别。`people` 和 `company` 类别可提高 LinkedIn 个人资料和公司页面的搜索质量。可选值：`company`, `research paper`, `news`, `personal site`, `financial report`, `people`
* `includeDomains` (array, 可选): 包含的域名列表
* `excludeDomains` (array, 可选): 排除的域名列表
* `startPublishedDate` (string, 可选): 发布日期下限，ISO 8601 格式 (如 2023-01-01T00:00:00.000Z)
* `endPublishedDate` (string, 可选): 发布日期上限，ISO 8601 格式
* `startCrawlDate` (string, 可选): 爬取日期下限（Exa 发现链接的日期），ISO 8601 格式
* `endCrawlDate` (string, 可选): 爬取日期上限，ISO 8601 格式
* `userLocation` (string, 可选): 用户所在国家/地区的两位 ISO 国家代码，如 `US`
* `moderation` (boolean, 可选): 启用内容审核过滤不安全内容 | 默认值：`false`

### Contents（获取内容）

获取 URL 的完整页面内容、摘要和元数据。从缓存返回即时结果，对于未缓存的页面自动回退到实时爬取。

#### 参数

**Header 参数**

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

**Body 参数**

* `urls` (array, 必需): 要爬取的 URL 数组（向后兼容 ids 参数）
* `ids` (array, 可选): 从搜索获取的文档 ID 数组
* `text` (boolean, 可选): 是否返回完整页面文本 | 默认值：`false`
* `highlights` (object, 可选): LLM 识别的最相关文本片段
  * `query` (string): 自定义查询以指导 LLM 选择高亮内容
  * `maxCharacters` (number): 高亮内容返回的最大字符数
* `summary` (object, 可选): 网页摘要
  * `query` (string): LLM 生成摘要的自定义查询
* `livecrawlTimeout` (number, 可选): 实时爬取超时时间（毫秒）| 默认值：`10000`
* `maxAgeHours` (number, 可选): 缓存内容最大年龄（小时）。正数（如 24）：如果内容少于 N 小时则使用缓存，否则实时爬取。0：始终实时爬取。-1：从不实时爬取，始终使用缓存。默认：仅在无缓存内容时回退到实时爬取
* `subpages` (number, 可选): 要爬取的子页面数量 | 默认值：`0`
* `subpageTarget` (string, 可选): 查找特定子页面的术语，可以是单个字符串或逗号分隔的字符串数组
* `extras` (object, 可选): 额外参数
  * `links` (number): 从每个网页返回的 URL 数量
  * `imageLinks` (number): 每个结果返回的图片数量

### Answer（回答）

获取由 Exa 搜索结果提供信息的 LLM 答案。针对特定查询返回直接答案，针对开放性查询返回带引用的详细摘要。

#### 参数

**Header 参数**

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

**Body 参数**

* `query` (string, 必需): 要回答的问题或查询 | 示例值：`What is the latest valuation of SpaceX?`
* `text` (boolean, 可选): 是否在搜索结果中包含完整文本内容 | 默认值：`false`
* `stream` (boolean, 可选): 是否以服务器发送事件 (SSE) 流式返回 | 默认值：`false`

### MCP Cline 配置

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

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

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

## API 接口

### Search（搜索）

#### 请求信息

* **Method**: POST
* **Endpoint**: `/exaai/search`

#### 请求参数

**Header 参数**

* `Authorization` (string, 可选): API KEY | 示例值：`Bearer {{YOUR_API_KEY}}`
* `Content-Type` (string, 必需): `application/json`

**Body 参数**

* `query` (string, 必需): 搜索查询字符串 | 示例值：`hottest AI startups`
* `type` (string, 可选): 搜索类型 | 默认值：`auto` | 可选值：`neural`, `auto`, `fast`, `deep-lite`, `deep`, `deep-reasoning`, `instant`
* `numResults` (integer, 可选): 返回结果数量 | 默认值：`10`
* `additionalQueries` (array, 可选): 额外查询变体
* `systemPrompt` (string, 可选): 指导合成输出的指令
* `stream` (boolean, 可选): 是否流式返回 | 默认值：`false`
* `category` (string, 可选): 数据类别 | 可选值：`company`, `research paper`, `news`, `personal site`, `financial report`, `people`
* `includeDomains` (array, 可选): 包含的域名列表
* `excludeDomains` (array, 可选): 排除的域名列表
* `startPublishedDate` (string, 可选): 发布日期下限 (ISO 8601)
* `endPublishedDate` (string, 可选): 发布日期上限 (ISO 8601)
* `startCrawlDate` (string, 可选): 爬取日期下限 (ISO 8601)
* `endCrawlDate` (string, 可选): 爬取日期上限 (ISO 8601)
* `userLocation` (string, 可选): 用户所在国家代码
* `moderation` (boolean, 可选): 启用内容审核 | 默认值：`false`

#### 返回响应

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

#### 请求示例

```bash
curl --location --request POST 'https://api.ecn.ai/exaai/search' \
	--header 'Content-Type: application/json' \
	--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
	--data-raw '{
  "query": "hottest AI startups",
  "type": "auto",
  "numResults": 10
}'
```

#### 响应示例

```json
{
  "results": [
    {
      "id": "abc123",
      "title": "Example Article",
      "url": "https://example.com/article",
      "publishedDate": "2024-01-15T00:00:00.000Z",
      "score": 0.95
    }
  ]
}
```

### Contents（获取内容）

#### 请求信息

* **Method**: POST
* **Endpoint**: `/exaai/contents`

#### 请求参数

**Header 参数**

* `Authorization` (string, 可选): API KEY | 示例值：`Bearer {{YOUR_API_KEY}}`
* `Content-Type` (string, 必需): `application/json`

**Body 参数**

* `urls` (array, 必需): 要爬取的 URL 数组
* `ids` (array, 可选): 从搜索获取的文档 ID 数组
* `contents` (object, 可选): 内容选项
  * `text` (boolean): 是否返回完整页面文本
  * `highlights` (object): 高亮内容选项
    * `query` (string): 自定义查询
    * `maxCharacters` (number): 最大字符数
  * `summary` (object): 摘要选项
    * `query` (string): 自定义查询
  * `subpages` (number): 子页面数量
  * `subpageTarget` (string): 子页面目标
  * `maxAgeHours` (number): 缓存最大年龄（小时）
  * `livecrawlTimeout` (number): 实时爬取超时（毫秒）
  * `extras` (object): 额外参数
    * `links` (number): 返回的链接数
    * `imageLinks` (number): 返回的图片数

#### 返回响应

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

#### 请求示例

```bash
curl --location --request POST 'https://api.ecn.ai/exaai/contents' \
	--header 'Content-Type: application/json' \
	--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
	--data-raw '{
  "urls": ["https://example.com"],
  "contents": {
    "text": true,
    "highlights": {
      "numSentences": 1
    }
  }
}'
```

#### 响应示例

```json
{
  "results": [
    {
      "url": "https://example.com",
      "text": "Page content...",
      "highlights": ["Relevant highlight..."]
    }
  ]
}
```

### Answer（回答）

#### 请求信息

* **Method**: POST
* **Endpoint**: `/exaai/answer`

#### 请求参数

**Header 参数**

* `Authorization` (string, 可选): API KEY | 示例值：`Bearer {{YOUR_API_KEY}}`
* `Content-Type` (string, 必需): `application/json`

**Body 参数**

* `query` (string, 必需): 要回答的问题 | 示例值：`What is the latest valuation of SpaceX?`
* `text` (boolean, 可选): 是否包含完整文本内容 | 默认值：`false`
* `stream` (boolean, 可选): 是否流式返回 | 默认值：`false`

#### 返回响应

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

#### 请求示例

```bash
curl --location --request POST 'https://api.ecn.ai/exaai/answer' \
	--header 'Content-Type: application/json' \
	--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
	--data-raw '{
  "query": "What is the latest valuation of SpaceX?",
  "text": false
}'
```

#### 响应示例

```json
{
  "answer": "Based on recent reports, SpaceX's latest valuation is approximately $150 billion as of early 2024.",
  "sources": [
    {
      "url": "https://example.com/article",
      "title": "SpaceX Valuation Article"
    }
  ]
}
```


---

# 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/api-reference/cn/compute/mcpg/web-search/exa.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.
