MCP LLMS-TXT Documentation Server

Official

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Integrates with Windsurf (by Codeium) to provide document context retrieval through the llms.txt protocol.

  • Provides access to LangGraph documentation through its llms.txt file, enabling contextual information retrieval for development tasks.

MCP LLMS-TXT ドキュメントサーバー

概要

llms.txtは LLM のウェブサイトインデックスであり、背景情報、ガイダンス、詳細なマークダウンファイルへのリンクを提供しています。Cursor や Windsurf などの IDE や Claude Code/Desktop などのアプリは、 llms.txtを使用してタスクのコンテキストを取得できます。ただし、これらのアプリはllms.txtなどのファイルの読み取りと処理に、異なる組み込みツールを使用しています。取得プロセスは不透明になる場合があり、ツールの呼び出しや返されたコンテキストを監査する方法が必ずしも存在しない場合があります。

MCPは、開発者がこれらのアプリケーションで使用されるツールを完全に制御する方法を提供します。ここでは、オープンソースのMCPサーバーを作成し、MCPホストアプリケーション(例:Cursor、Windsurf、Claude Code/Desktop)に、(1) ユーザー定義のllms.txtファイルリストと、(2) 提供されたllms.txtファイル内のURLを読み取るシンプルなfetch_docsツールを提供します。これにより、ユーザーは各ツールの呼び出しと返されるコンテキストを監査できます。

llms-txt

langgraph および langchain の llms.txt ファイルは、次の場所にあります。

図書館llms.txt
ラングラフPythonhttps://langchain-ai.github.io/langgraph/llms.txt
ラングラフJShttps://langchain-ai.github.io/langgraphjs/llms.txt
ランチェーンPythonhttps://python.langchain.com/llms.txt
ランチェーンJShttps://js.langchain.com/llms.txt

クイックスタート

uvをインストールする

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

使用するllms.txtファイルを選択します。

注: セキュリティとドメインアクセス制御

セキュリティ上の理由から、mcpdoc は厳格なドメイン アクセス制御を実装しています。

  1. リモート llms.txt ファイル:リモート llms.txt URL(例: https://langchain-ai.github.io/langgraph/llms.txt ://langchain-ai.github.io/langgraph/llms.txt)を指定すると、mcpdoc は自動的にそのドメイン( langchain-ai.github.io )のみを許可ドメインリストに追加します。つまり、ツールはそのドメインの URL からのみドキュメントを取得できます。
  2. ローカル llms.txt ファイル: ローカルファイルを使用する場合、ドメインは許可リストに自動的に追加されません。-- --allowed-domainsパラメータを使用して、許可するドメインを明示的に指定する必要があります。
  1. 追加のドメインの追加: 自動的に含まれるドメイン以外のドメインからの取得を許可するには:
  • 特定のドメインを追加するには、 --allowed-domains domain1.com domain2.comを使用します。
  • すべてのドメインを許可するには、 --allowed-domains '*'を使用します(注意して使用してください)

このセキュリティ対策により、ユーザーによって明示的に承認されていないドメインへの不正アクセスが防止され、信頼できるソースからのみドキュメントを取得できるようになります。

(オプション) 選択したllms.txtファイルを使用して、MCP サーバーをローカルでテストします。

uvx --from mcpdoc mcpdoc \ --urls "LangGraph:https://langchain-ai.github.io/langgraph/llms.txt" "LangChain:https://python.langchain.com/llms.txt" \ --transport sse \ --port 8082 \ --host localhost

npx @modelcontextprotocol/inspector

  • ここで、 tool呼び出しをテストできます。

カーソルに接続

  • Cursor SettingsMCPタブを開きます。
  • これにより~/.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 LangChain:https://python.langchain.com/llms.txt", "--transport", "stdio" ] } } }
  • Cursor Settings/MCPタブでサーバーが実行中であることを確認します。
  • ベストプラクティスは、カーソル グローバル (ユーザー) ルールを更新することです。
  • カーソルSettings/Rulesを開き、 User Rules次のように更新します (または同様の内容にします)。
for ANY question about LangGraph, use the langgraph-docs-mcp server to help answer -- + 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
  • CMD+L (Mac の場合) を押すとチャットが開きます。
  • agentが選択されていることを確認します。

次に、次のようなサンプルプロンプトを試してください。

what are types of memory in LangGraph?

ウィンドサーフィンに接続する

  • CMD+L (Mac の場合) で Cascade を開きます。
  • Configure MCPクリックして、構成ファイル~/.codeium/windsurf/mcp_config.jsonを開きます。
  • 上記のとおり、 langgraph-docs-mcpで更新します。

  • Windsurf Rules/Global rules次の内容 (または同様の内容) で更新します。
for ANY question about LangGraph, use the langgraph-docs-mcp server to help answer -- + 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

次に、次のサンプルプロンプトを試してください。

  • ツール呼び出しを実行します。

Claudeデスクトップに接続

  • Settings/Developerを開いて、 ~/Library/Application\ Support/Claude/claude_desktop_config.jsonを更新します。
  • 上記のとおり、 langgraph-docs-mcpで更新します。
  • Claude デスクトップ アプリを再起動します。

[!Note] Claude Desktop に MCPDoc ツールを追加しようとしたときに Python バージョンの非互換性の問題が発生する場合は、 uvxコマンドでpython実行可能ファイルへのファイルパスを明示的に指定できます。

{ "mcpServers": { "langgraph-docs-mcp": { "command": "uvx", "args": [ "--python", "/path/to/python", "--from", "mcpdoc", "mcpdoc", "--urls", "LangGraph:https://langchain-ai.github.io/langgraph/llms.txt", "--transport", "stdio" ] } } }

[!Note] 現在 (2025 年 3 月 21 日)、Claude Desktop はグローバル ルールのrulesをサポートしていないようですので、プロンプトに次の内容を追加します。

<rules> for ANY question about LangGraph, use the langgraph-docs-mcp server to help answer -- + 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 </rules>

  • チャット入力の右下にツールが表示されます。

次に、次のサンプルプロンプトを試してください。

  • リクエストを処理する際に、ツール呼び出しの承認を求められます。

クロード・コードに接続する

  • 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", "--urls", "LangChain:https://python.langchain.com/llms.txt"]}' -s local
  • ~/.claude.json更新されていることがわかります。
  • Claude Code を起動して実行し、ツールを表示してテストします。
$ Claude $ /mcp

[!Note] 現在 (2025 年 3 月 21 日)、Claude Code はグローバル ルールのrulesをサポートしていないようですので、プロンプトに次の内容を追加します。

<rules> for ANY question about LangGraph, use the langgraph-docs-mcp server to help answer -- + 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 </rules>

次に、次のサンプルプロンプトを試してください。

  • ツールの呼び出しを承認するように求められます。

コマンドラインインターフェース

mcpdocコマンドは、ドキュメント サーバーを起動するためのシンプルな CLI を提供します。

ドキュメント ソースは次の 3 つの方法で指定でき、これらを組み合わせることもできます。

  1. YAML 構成ファイルの使用:
  • これにより、このリポジトリのsample_config.yamlファイルから LangGraph Python ドキュメントが読み込まれます。
mcpdoc --yaml sample_config.yaml
  1. JSON 構成ファイルの使用:
  • これにより、このリポジトリのsample_config.jsonファイルから LangGraph Python ドキュメントが読み込まれます。
mcpdoc --json sample_config.json
  1. オプションの名前を使用して llms.txt URL を直接指定します。
  • URL は、プレーン URL として指定することも、 name:url形式を使用してオプションの名前で指定することもできます。
  • --urlsパラメータを複数回使用して複数の URL を指定できます。
  • これは、上記の MCP サーバーのllms.txtをロードする方法です。
mcpdoc --urls LangGraph:https://langchain-ai.github.io/langgraph/llms.txt --urls LangChain:https://python.langchain.com/llms.txt

これらの方法を組み合わせてドキュメント ソースをマージすることもできます。

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

これにより、LangGraph Python ドキュメントが 15 秒のタイムアウトで読み込まれ、必要に応じて 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

任意の llms.txt ソースからドキュメントをロードおよび取得するためのツールを提供する MCP サーバー。これにより、ユーザーは IDE エージェントおよびアプリケーションで LLM のコンテキスト取得を完全に制御できます。

  1. Overview
    1. llms-txt
      1. Quickstart
        1. Install uv
        2. Choose an llms.txt file to use.
        3. (Optional) Test the MCP server locally with your llms.txt file(s) of choice:
        4. Connect to Cursor
        5. Connect to Windsurf
        6. Connect to Claude Desktop
        7. Connect to Claude Code
      2. Command-line Interface
        1. Additional Options
          1. Configuration Format
            1. YAML Configuration Example (sample_config.yaml)
            2. JSON Configuration Example (sample_config.json)
          2. Programmatic Usage
            ID: 655da7rcrv