LLMS.txt Documentation

LLMS.txt Documentation

🚀 mcpdoc 项目

mcpdoc 是一个用于加载和管理文档源的工具,支持通过多种方式配置文档服务器,能方便地查询文档信息。

🚀 快速开始

启动文档服务器

通过以下命令启动文档服务器:

mcpdoc --urls LangGraph:https://langchain-ai.github.io/langgraph/llms.txt

此命令将加载并提供 LangGraph Python 文档

查询文档

启动服务器后,可以通过以下方式查询文档:

/mcp query "请列举所有支持的模型"

📦 安装指南

使用 pip 安装:

pip install mcpdoc

📚 详细文档

配置指南

文档服务器支持多种配置方式,可以灵活地添加和管理文档源。

使用 YAML 配置文件

创建 sample_config.yaml 文件:

# Sample configuration for mcpdoc server
# Each entry must have a llms_txt URL and can optionally include a name
- name: LangGraph Python
llms_txt: https://langchain-ai.github.io/langgraph/llms.txt

启动服务器时指定 YAML 配置文件:

mcpdoc --yaml sample_config.yaml

使用 JSON 配置文件

创建 sample_config.json 文件:

[
{
"name": "LangGraph Python",
"llms_txt": "https://langchain-ai.github.io/langgraph/llms.txt"
}
]

启动服务器时指定 JSON 配置文件:

mcpdoc --json sample_config.json

直接指定 URL

可以通过 --urls 参数直接指定文档源的 URL,格式为 name:url。例如:

mcpdoc --urls LangGraph:https://langchain-ai.github.io/langgraph/llms.txt --urls LangChain:https://python.langchain.com/llms.txt

组合使用

可以将 YAML、JSON 配置文件和 --urls 参数组合使用:

mcpdoc --yaml sample_config.yaml --json sample_config.json --urls LangGraph:https://langchain-ai.github.io/langgraph/llms.txt --urls LangChain:https://python.langchain.com/llms.txt

额外选项

  • --follow-redirects:是否跟随 HTTP 重定向(默认为 False)
  • --timeout SECONDS:HTTP 请求超时时间,以秒为单位(默认为 10.0)

示例:

mcpdoc --yaml sample_config.yaml --follow-redirects --timeout 15

💻 使用示例

基础用法

from mcpdoc.main import create_server

# 创建服务器实例,指定文档源
server = create_server(
[
{
"name": "LangGraph Python",
"llms_txt": "https://langchain-ai.github.io/langgraph/llms.txt",
},
# 可以添加多个文档源
# {
#     "name": "Another Documentation",
#     "llms_txt": "https://example.com/llms.txt",
# },
],
follow_redirects=True,
timeout=15.0,
)

# 启动服务器
server.run(transport="stdio")
  • 0 关注
  • 0 收藏,9 浏览
  • system 提出于 2025-09-18 07:39

相似服务问题