> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiI4OWJkZDE0NS0wZmRhLTRiMWYtOWQ1NC1lN2RmYTI3YzY2MDQiLCJleHAiOjE3NzgyNjY4MjAsImlhdCI6MTc3ODI2NjUyMH0.vlCQMwEGgOGqHO05_qxhnGOi2y_p8Rf18Yo1lJN0B4o
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# Context7

> 在您的 Fern 文档站点上托管 Context7 验证文件以启用 Context7 集成。

[Context7](https://context7.com/) 为 AI 代码助手提供最新的、特定版本的文档上下文。要向 Context7 注册库，您需要在库的基础 URL 下的任何位置托管一个 `context7.json` 文件。Fern 通过 `docs.yml` 中的 `integrations` 配置为您处理此事。

<Note>
  需要 Fern CLI 版本 `4.52.0` 或更高版本。运行 `fern upgrade` 进行更新。
</Note>

<Steps>
  <Step title="获取您的 `context7.json` 文件">
    按照 [Context7 的设置说明](https://context7.com/) 为您的域名生成一个 `context7.json` 验证文件。
  </Step>

  <Step title="将文件添加到您的 Fern 项目">
    将 `context7.json` 文件放置在您的 `fern/` 目录中（或相对于 `docs.yml` 的任何路径）。
  </Step>

  <Step title="配置 `docs.yml`">
    在您的 `docs.yml` 文件中添加 `integrations.context7` 属性，指向您的 `context7.json` 文件的相对路径：

    <CodeBlock title="docs.yml">
      ```yaml
      integrations:
        context7: ./path/to/context7.json
      ```
    </CodeBlock>
  </Step>

  <Step title="发布您的文档">
    运行 `fern generate --docs` 进行发布。Fern 会在您的文档站点上的 `/context7.json` 处托管该文件（例如，`https://docs.example.com/context7.json`）。
  </Step>
</Steps>