Skip to main content
Glama

MCP LLMS-TXT Documentation Server

by teddylee777

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。这允许用户审计每个工具调用以及返回的上下文。

mcpdoc

快速入门

安装 uv
curl -LsSf https://astral.sh/uv/install.sh | sh
选择要使用的llms.txt文件。
  • 例如,这是LangGraph llms.txt文件。
(可选)使用您选择的llms.txt文件在本地测试 MCP 服务器:
uvx --from mcpdoc mcpdoc \ --urls LangGraph:https://langchain-ai.github.io/langgraph/llms.txt \ --transport sse \ --port 8082 \ --host localhost

截图于 2025-03-18 下午 3 点 29 分 30 秒

npx @modelcontextprotocol/inspector

截图于 2025-03-18 下午 3 点 30 分

  • 在这里,您可以测试tool调用。
连接到光标
  • 打开Cursor SettingsMCP选项卡。
  • 这将打开~/.cursor/mcp.json文件。

截图于 2025-03-19 上午 11:01:31

  • 将以下内容粘贴到文件中(我们使用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 Settings/MCP选项卡中运行。
  • CMD+L (在 Mac 上)打开聊天。
  • 确保已选择agent

截图于 2025-03-18 下午 1 点 56 分 54 秒

然后,尝试示例提示,例如:

use the langgraph-docs-mcp server to answer any LangGraph questions -- + call list_doc_sources tool to get the available llms.txt file + call fetch_docs tool to read it + reflect on the urls in llms.txt + reflect on the input question + call fetch_docs on any urls relevant to the question + use this to answer the question what are types of memory in LangGraph?

截图于 2025-03-18 下午 1 点 58 分 38 秒

连接到 Windsurf

  • 使用CMD+L打开 Cascade(在 Mac 上)。
  • 单击Configure MCP以打开配置文件~/.codeium/windsurf/mcp_config.json
  • 如上所述,使用langgraph-docs-mcp进行更新。

截图于 2025-03-19 上午 11:02:52

  • CMD+L (在 Mac 上)打开 Cascade 并刷新 MCP 服务器。
  • 可用的 MCP 服务器将被列出,并显示langgraph-docs-mcp已连接。

截图于 2025-03-18 下午 2:02

然后,尝试示例提示:

  • 它将执行您的工具调用。

截图于 2025-03-18 下午 2 点 03 分 07 秒

连接到 Claude 桌面

  • 打开Settings/Developer来更新~/Library/Application\ Support/Claude/claude_desktop_config.json
  • 如上所述,使用langgraph-docs-mcp进行更新。
  • 重新启动 Claude 桌面应用程序。

截图于 2025-03-18 下午 2 点 05 分 54 秒

  • 您将在聊天输入的右下角看到您的工具。

截图于 2025-03-18 下午 2 点 05 分 39 秒

然后,尝试示例提示:

  • 在处理您的请求时,它会要求批准工具调用。

截图于 2025-03-18 下午 2 点 06 分 54 秒

连接到克劳德代码

  • 安装Claude Code后,在终端中运行此命令将 MCP 服务器添加到您的项目中:
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 并运行来查看您的工具进行测试:
$ Claude $ /mcp

截图于 2025-03-18 下午 2 点 13 分 49 秒

然后,尝试示例提示:

  • 它将要求批准工具调用。

截图于 2025-03-18 下午 2 点 14 分 37 秒

命令行界面

mcpdoc命令提供了一个简单的 CLI 来启动文档服务器。

您可以通过三种方式指定文档源,并且可以组合使用:

  1. 使用 YAML 配置文件:
  • 这将从此 repo 中的sample_config.yaml文件加载 LangGraph Python 文档。
mcpdoc --yaml sample_config.yaml
  1. 使用 JSON 配置文件:
  • 这将从此 repo 中的sample_config.json文件加载 LangGraph Python 文档。
mcpdoc --json sample_config.json
  1. 直接指定带有可选名称的 llms.txt URL:
  • URL 可以指定为纯 URL,也可以使用name:url格式的可选名称来指定。
  • 这就是我们为上面的 MCP 服务器加载llms.txt的方式。
mcpdoc --urls LangGraph:https://langchain-ai.github.io/langgraph/llms.txt

您还可以组合这些方法来合并文档源:

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)

带有附加选项的示例:

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

这将以 15 秒的超时时间加载 LangGraph Python 文档,并在必要时遵循任何 HTTP 重定向。

配置格式

YAML 和 JSON 配置文件都应包含文档源列表。

每个源必须包含一个llms_txt URL,并且可以选择包含一个name

YAML 配置示例(sample_config.yaml)

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

JSON 配置示例 (sample_config.json)

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

程序化使用

from mcpdoc.main import create_server # Create a server with documentation sources server = create_server( [ { "name": "LangGraph Python", "llms_txt": "https://langchain-ai.github.io/langgraph/llms.txt", }, # You can add multiple documentation sources # { # "name": "Another Documentation", # "llms_txt": "https://example.com/llms.txt", # }, ], follow_redirects=True, timeout=15.0, ) # Run the server server.run(transport="stdio")
-
security - not tested
A
license - permissive license
-
quality - not tested

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 文档文件的访问权限,允许用户控制和审核上下文检索。

  1. 概述
    1. 快速入门
      1. 安装 uv
      2. 选择要使用的llms.txt文件。
      3. (可选)使用您选择的llms.txt文件在本地测试 MCP 服务器:
      4. 连接到光标
      5. 连接到 Windsurf
      6. 连接到 Claude 桌面
      7. 连接到克劳德代码
    2. 命令行界面
      1. 附加选项
        1. 配置格式
          1. YAML 配置示例(sample\_config.yaml)
          2. JSON 配置示例 (sample\_config.json)
        2. 程序化使用

          Related MCP Servers

          • -
            security
            F
            license
            -
            quality
            An MCP server that allows Claude and other LLMs to manage persistent memories across conversations through text file storage, enabling commands to add, search, delete and list memory entries.
            Last updated -
            2
            TypeScript
          • -
            security
            F
            license
            -
            quality
            An MCP server that provides detailed information about your development environment to the Cursor code editor, enabling more context-aware assistance.
            Last updated -
            1
            Python
            • Linux
            • Apple
          • -
            security
            A
            license
            -
            quality
            An 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 -
            177
            Python
            MIT License
            • Apple
          • -
            security
            A
            license
            -
            quality
            A Model Context Protocol (MCP) server for Cursor IDE that simplifies the installation and configuration of other MCP servers.
            Last updated -
            882
            23
            JavaScript
            MIT License
            • Apple
            • Linux

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/teddylee777/mcpdoc'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server