# teddylee777
## 基本信息
- Slug: `teddylee777-mcpdoc`
- Source: modelscope
- Publisher: @teddylee777/mcpdoc
- Categories: documentation-access / rag-systems / knowledge-and-memory
- Hosted: Yes
- License: MIT License
- Source URL: https://www.modelscope.cn/mcp/servers/@teddylee777/mcpdoc
## 简介
暂无描述。
## MCP Server 详情

# MCP LLMS-TXT 文档服务器

## 概述

[llms.txt](https://llmstxt.org/) 是一个针对 LLMs 的网站索引，提供背景信息、指南和链接到详细的 markdown 文件。像 Cursor 和 Windsurf 这样的 IDE 或 Claude Code/Desktop 这样的应用程序可以使用 `llms.txt` 来获取任务的上下文。然而，这些应用程序使用不同的内置工具来读取和处理如 `llms.txt` 这样的文件。检索过程可能是不透明的，并且并不总是有办法审计工具调用或返回的上下文。

[MCP](https://github.com/modelcontextprotocol) 为开发者提供了对这些应用程序所使用的工具的*完全控制*。在这里，我们创建了一个[开源的 MCP 服务器](https://github.com/modelcontextprotocol)，为 MCP 主机应用程序（例如：Cursor, Windsurf, Claude Code/Desktop）提供 (1) 用户定义的 `llms.txt` 文件列表以及 (2) 一个简单的 `fetch_docs` 工具以读取任何提供的 `llms.txt` 文件中的 URL。这使得用户能够审计每个工具调用及返回的上下文。

![mcpdoc](https://github.com/user-attachments/assets/736f8f55-833d-4200-b833-5fca01a09e1b)

## 快速开始

#### 安装 uv
* 请参阅 [官方 uv 文档](https://docs.astral.sh/uv/getting-started/installation/#installation-methods) 获取其他安装 `uv` 的方法。

bash
curl -LsSf https://astral.sh/uv/install.sh | sh


#### 选择一个要使用的 `llms.txt` 文件。
* 例如，这里是 [LangGraph 的 `llms.txt` 文件](https://langchain-ai.github.io/langgraph/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


* 应该运行于: http://localhost:8082

![Screenshot 2025-03-18 at 3 29 30 PM](https://github.com/user-attachments/assets/24a3d483-cd7a-4c7e-a4f7-893df70e888f)

* 运行 [MCP 检查器](https://modelcontextprotocol.io/docs/tools/inspector) 并连接到正在运行的服务器：
bash
npx @modelcontextprotocol/inspector


![Screenshot 2025-03-18 at 3 30 30 PM](https://github.com/user-attachments/assets/14645d57-1b52-4a5e-abfe-8e7756772704)

* 在这里，您可以测试 `tool` 调用。

#### 连接到 Cursor

* 打开 `Cursor 设置` 和 `MCP` 标签页。
* 这将打开 `~/.cursor/mcp.json` 文件。

![Screenshot 2025-03-19 at 11 01 31 AM](https://github.com/user-attachments/assets/3d1c8eb3-4d40-487f-8bad-3f9e660f770a)

* 将以下内容粘贴到文件中（我们使用 `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`。

![Screenshot 2025-03-18 at 1 56 54 PM](https://github.com/user-attachments/assets/0dd747d0-7ec0-43d2-b6ef-cdcf5a2a30bf)

然后，尝试一个示例提示，比如：

使用 langgraph-docs-mcp 服务器回答任何关于 LangGraph 的问题 --
+ 调用 list_doc_sources 工具获取可用的 llms.txt 文件
+ 调用 fetch_docs 工具读取它
+ 反思 llms.txt 中的 URL
+ 反思输入的问题
+ 对与问题相关的任何 URL 调用 fetch_docs
+ 使用此信息回答问题

LangGraph 中有哪些类型的内存？


![Screenshot 2025-03-18 at 1 58 38 PM](https://github.com/user-attachments/assets/180966b5-ab03-4b78-8b5d-bab43f5954ed)

### 连接到 Windsurf

* 使用 `CMD+L`（在 Mac 上）打开 Cascade。
* 单击 `Configure MCP` 以打开配置文件 `~/.codeium/windsurf/mcp_config.json`。
* 如上所述更新 `langgraph-docs-mcp`。![Screenshot 2025-03-19 at 11:02:52 AM](https://github.com/user-attachments/assets/d45b427c-1c1e-4602-820a-7161a310af24)

* `CMD+L`（在Mac上）打开Cascade并刷新MCP服务器。
* 可用的MCP服务器将被列出，显示`langgraph-docs-mcp`为已连接。

![Screenshot 2025-03-18 at 2:02:12 PM](https://github.com/user-attachments/assets/5a29bd6a-ad9a-4c4a-a4d5-262c914c5276)

然后，尝试示例提示：
* 它将执行您的工具调用。

![Screenshot 2025-03-18 at 2:03:07 PM](https://github.com/user-attachments/assets/0e24e1b2-dc94-4153-b4fa-495fd768125b)

### 连接到Claude桌面版

* 打开`设置/开发者`以更新`~/Library/Application Support/Claude/claude_desktop_config.json`。
* 按照上述说明更新为`langgraph-docs-mcp`。
* 重启Claude桌面应用程序。

![Screenshot 2025-03-18 at 2:05:54 PM](https://github.com/user-attachments/assets/228d96b6-8fb3-4385-8399-3e42fa08b128)

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

![Screenshot 2025-03-18 at 2:05:39 PM](https://github.com/user-attachments/assets/71f3c507-91b2-4fa7-9bd1-ac9cbed73cfb)

然后，尝试示例提示：

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

![Screenshot 2025-03-18 at 2:06:54 PM](https://github.com/user-attachments/assets/59b3a010-94fa-4a4d-b650-5cd449afeec0)

### 连接到Claude Code

* 在安装[Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview)后，在终端中运行以下命令将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 


![Screenshot 2025-03-18 at 2:13:49 PM](https://github.com/user-attachments/assets/eb876a0e-27b4-480e-8c37-0f683f878616)

然后，尝试示例提示：

* 它会要求您批准工具调用。

![Screenshot 2025-03-18 at 2:14:37 PM](https://github.com/user-attachments/assets/5b9a2938-ea69-4443-8d3b-09061faccad0)

## 命令行界面

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

您可以使用三种方式指定文档源，并且这些方式可以组合使用：

1. 使用YAML配置文件：

* 这将从本仓库中的`sample_config.yaml`文件加载LangGraph Python文档。

bash
mcpdoc --yaml sample_config.yaml


2. 使用JSON配置文件：

* 这将从本仓库中的`sample_config.json`文件加载LangGraph Python文档。

bash
mcpdoc --json sample_config.json


3. 直接指定带有可选名称的llms.txt URL：

* URL可以指定为纯URL或使用`name:url`格式指定带名称的URL。
* 这是我们上面为MCP服务器加载`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配置示例 (sample_config.yaml)

yaml
# mcp-mcpdoc服务器的示例配置
# 每个条目必须有一个llms_txt URL，并且可以可选地有一个name
- name: LangGraph Python
  llms_txt: https://langchain-ai.github.io/langgraph/llms.txt### JSON 配置示例 (sample_config.json)

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


## 程序化使用

python
from mcpdoc.main import cr…

