modelscope·@teddylee777/mcpdoc
暂无描述。
llms.txt 是一个针对 LLMs 的网站索引,提供背景信息、指南和链接到详细的 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 的方法。bash curl -LsSf https://astral.sh/uv/install.sh | sh
llms.txt 文件。llms.txt 文件。llms.txt 文件在本地测试 MCP 服务器:bash uvx --from mcpdoc mcpdoc --urls LangGraph:https://langchain-ai.github.io/langgraph/llms.txt --transport sse --port 8082 --host localhost
tool 调用。Cursor 设置 和 MCP 标签页。~/.cursor/mcp.json 文件。langgraph-docs-mcp 名称并链接到 LangGraph 的 llms.txt)。{ "mcpServers": { "langgraph-docs-mcp": { "command": "uvx", "args": [ "--from", "mcpdoc", "mcpdoc", "--urls", "LangGraph:https://langchain-ai.github.io/langgraph/llms.txt", "--transport", "stdio", "--port", "8081", "--host", "localhost" ] } } }
Cursor 设置/MCP 标签页中运行。CMD+L(在 Mac 上)打开聊天。agent。然后,尝试一个示例提示,比如:
使用 langgraph-docs-mcp 服务器回答任何关于 LangGraph 的问题 --
LangGraph 中有哪些类型的内存?
使用 CMD+L(在 Mac 上)打开 Cascade。
单击 Configure MCP 以打开配置文件 ~/.codeium/windsurf/mcp_config.json。
如上所述更新 langgraph-docs-mcp。
CMD+L(在Mac上)打开Cascade并刷新MCP服务器。
可用的MCP服务器将被列出,显示langgraph-docs-mcp为已连接。
然后,尝试示例提示:
设置/开发者以更新~/Library/Application Support/Claude/claude_desktop_config.json。langgraph-docs-mcp。然后,尝试示例提示:
在安装Claude Code后,在终端中运行以下命令将MCP服务器添加到您的项目中: bash claude mcp add-json langgraph-docs {"type":"stdio","command":"uvx" ,"args":["--from", "mcpdoc", "mcpdoc", "--urls", "langgraph:https://langchain-ai.github.io/langgraph/llms.txt"]} -s local
您将看到~/.claude.json已更新。
通过启动Claude Code并运行以下命令来测试您的工具: bash $ Claude $ /mcp
然后,尝试示例提示:
mcpdoc命令提供了一个简单的CLI用于启动文档服务器。
您可以使用三种方式指定文档源,并且这些方式可以组合使用:
sample_config.yaml文件加载LangGraph Python文档。bash mcpdoc --yaml sample_config.yaml
sample_config.json文件加载LangGraph Python文档。bash mcpdoc --json sample_config.json
name:url格式指定带名称的URL。llms.txt的方式。bash mcpdoc --urls LangGraph:https://langchain-ai.github.io/langgraph/llms.txt
您还可以结合这些方法来合并文档源:
bash mcpdoc --yaml sample_config.yaml --json sample_config.json --urls https://langchain-ai.github.io/langgraph/llms.txt
--follow-redirects:跟随HTTP重定向(默认为False)--timeout SECONDS:HTTP请求超时时间(秒,默认为10.0)带有其他选项的示例:
bash mcpdoc --yaml sample_config.yaml --follow-redirects --timeout 15
这将以15秒的超时时间加载LangGraph Python文档,并在必要时跟随任何HTTP重定向。
YAML和JSON配置文件都应包含一个文档源列表。
每个源必须包括一个llms_txt URL,并且可以可选地包括一个name:
yaml
json [ { "name": "LangGraph Python", "llms_txt": "https://langchain-ai.github.io/langgraph/llms.txt" } ]
python from mcpdoc.main import cr…