MCP LLMS-TXT文档服务器
概述
llms.txt是法学硕士 (LLM) 的网站索引,提供背景信息、指导以及详细 Markdown 文件的链接。像 Cursor 和 Windsurf 这样的 IDE,或者像 Claude Code/Desktop 这样的应用程序,可以使用llms.txt
检索任务的上下文。然而,这些应用程序使用不同的内置工具来读取和处理像llms.txt
这样的文件。检索过程可能不透明,并且并不总是有办法审计工具调用或返回的上下文。
MCP为开发者提供了一种完全控制这些应用程序所用工具的方法。我们创建了一个开源 MCP 服务器,为 MCP 宿主应用程序(例如 Cursor、Windsurf、Claude Code/Desktop)提供 (1) 用户定义的llms.txt
文件列表,以及 (2) 一个简单的fetch_docs
工具,用于读取任何提供的llms.txt
文件中的 URL。这允许用户审计每个工具调用以及返回的上下文。
快速入门
安装 uv
- 请参阅官方 uv 文档以了解安装
uv
的其他方法。
选择要使用的llms.txt
文件。
- 例如,这是LangGraph
llms.txt
文件。
(可选)使用您选择的llms.txt
文件在本地测试 MCP 服务器:
- 这应该在以下位置运行: http://localhost:8082
- 运行MCP 检查器并连接到正在运行的服务器:
- 在这里,您可以测试
tool
调用。
连接到光标
- 打开
Cursor Settings
和MCP
选项卡。 - 这将打开
~/.cursor/mcp.json
文件。
- 将以下内容粘贴到文件中(我们使用
langgraph-docs-mcp
名称并链接到 LangGraphllms.txt
)。
- 确认服务器正在
Cursor Settings/MCP
选项卡中运行。 CMD+L
(在 Mac 上)打开聊天。- 确保已选择
agent
。
然后,尝试示例提示,例如:
连接到 Windsurf
- 使用
CMD+L
打开 Cascade(在 Mac 上)。 - 单击
Configure MCP
以打开配置文件~/.codeium/windsurf/mcp_config.json
。 - 如上所述,使用
langgraph-docs-mcp
进行更新。
CMD+L
(在 Mac 上)打开 Cascade 并刷新 MCP 服务器。- 可用的 MCP 服务器将被列出,并显示
langgraph-docs-mcp
已连接。
然后,尝试示例提示:
- 它将执行您的工具调用。
连接到 Claude 桌面
- 打开
Settings/Developer
来更新~/Library/Application\ Support/Claude/claude_desktop_config.json
。 - 如上所述,使用
langgraph-docs-mcp
进行更新。 - 重新启动 Claude 桌面应用程序。
- 您将在聊天输入的右下角看到您的工具。
然后,尝试示例提示:
- 在处理您的请求时,它会要求批准工具调用。
连接到克劳德代码
- 安装Claude Code后,在终端中运行此命令将 MCP 服务器添加到您的项目中:
- 您将看到
~/.claude.json
已更新。 - 通过启动 Claude Code 并运行来查看您的工具进行测试:
然后,尝试示例提示:
- 它将要求批准工具调用。
命令行界面
mcpdoc
命令提供了一个简单的 CLI 来启动文档服务器。
您可以通过三种方式指定文档源,并且可以组合使用:
- 使用 YAML 配置文件:
- 这将从此 repo 中的
sample_config.yaml
文件加载 LangGraph Python 文档。
- 使用 JSON 配置文件:
- 这将从此 repo 中的
sample_config.json
文件加载 LangGraph Python 文档。
- 直接指定带有可选名称的 llms.txt URL:
- URL 可以指定为纯 URL,也可以使用
name:url
格式的可选名称来指定。 - 这就是我们为上面的 MCP 服务器加载
llms.txt
的方式。
您还可以组合这些方法来合并文档源:
附加选项
--follow-redirects
:遵循 HTTP 重定向(默认为 False)--timeout SECONDS
:HTTP 请求超时时间(秒)(默认为 10.0)
带有附加选项的示例:
这将以 15 秒的超时时间加载 LangGraph Python 文档,并在必要时遵循任何 HTTP 重定向。
配置格式
YAML 和 JSON 配置文件都应包含文档源列表。
每个源必须包含一个llms_txt
URL,并且可以选择包含一个name
:
YAML 配置示例(sample_config.yaml)
JSON 配置示例 (sample_config.json)
程序化使用
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
一个开源 MCP 服务器,为 Cursor、Windsurf 和 Claude 等应用程序提供对 llms.txt 文档文件的访问权限,允许用户控制和审核上下文检索。
Related MCP Servers
- AsecurityAlicenseAqualityThis MCP server provides tools for interacting with Cloudflare Browser Rendering, allowing you to fetch and process web content for use as context in LLMs directly from Cline or Claude Desktop.Last updated -510TypeScriptMIT License
- -securityAlicense-qualityAn MCP server that connects any MCP client (like Claude or Cursor) with the browser using browser-use, allowing clients to utilize existing LLMs without requiring additional API keys.Last updated -74PythonApache 2.0
- -securityAlicense-qualityAn MCP server that provides tools to load and fetch documentation from any llms.txt source, giving users full control over context retrieval for LLMs in IDE agents and applications.Last updated -578PythonMIT License
- -securityFlicense-qualityA MCP server to allow the LLM in Cursor to access Rust Analyzer, Crate Docs and Cargo Commands.Last updated -67Rust