For AI agents: the complete documentation index is available at https://rspress.rs/zh/llms.txt, the full documentation bundle is available at https://rspress.rs/zh/llms-full.txt, and this page is available as Markdown at https://rspress.rs/zh/api/config/config-agent.md.
close
  • 中文
  • AI 配置

    这些选项用于配置 Markdown 生成和浏览器智能体工具。llms 和 webMcp 是 rspress.config.ts 的顶层选项。

    llms

    • 类型:
    boolean | {
      llmsTxt?: (context: LlmsTxtContext) => string | Promise<string>;
      remarkSplitMdxOptions?: RemarkSplitMdxOptions;
    }
    • 默认值:false

    是否开启 SSG-MD 来生成 llms.txt、llms-full.txt 以及每个页面对应的 Markdown 文件,使你的文档更容易被大语言模型理解。

    开启 llms 后,默认也会启用 Markdown 复制和 AI 工具入口。可以通过 themeConfig.llmsUI 自定义或关闭这些界面。

    可通过 llmsTxt 基于站点信息和页面分组编排完整的 llms.txt 内容。详见自定义 llms.txt。

    rspress.config.ts
    import { defineConfig } from '@rspress/core';
    
    export default defineConfig({
      llms: true,
    });
    Warning

    llms 为实验性功能。如果由于代码不兼容 SSR 而无法开启 SSG-MD,请使用 @rspress/plugin-llms 作为备选方案。

    详细用法、配置选项和实现原理请参阅 llms.txt(SSG-MD)。

    webMcp

    • 类型:boolean | { exposedTo?: string[] }
    • 默认值:true

    通过浏览器原生 WebMCP API 提供内置文档工具,设置 webMcp: false 仅关闭 Rspress 内置工具,仍可使用 useWebMcp hook 注册自定义工具。不支持 WebMCP 的浏览器仍可正常访问站点。

    通过 exposedTo 允许指定的安全来源发现工具:

    rspress.config.ts
    import { defineConfig } from '@rspress/core';
    
    export default defineConfig({
      webMcp: {
        exposedTo: ['https://agent.example'],
      },
    });

    可用工具、浏览器要求和跨域访问详见 WebMCP。