Skip to main content
Glama
Jaynt27

langgraph-mcp

by Jaynt27

LangGraph RAG MCP

Система генерации с дополнением на основе поиска (Retrieval-Augmented Generation, RAG), которая предоставляет документацию LangGraph через Model Context Protocol (MCP).

Обзор

Этот проект создаёт систему поиска по документации, которая:

  1. Собирает и обрабатывает документацию LangGraph с официального сайта

  2. Создаёт векторную базу данных из этой документации для семантического поиска

  3. Предоставляет доступ к этим знаниям через Model Context Protocol (MCP)

  4. Интегрируется с MCP-совместимыми хостами — такими как VS Code, Cursor, Claude Desktop или Windsurf

Related MCP server: AI Research Assistant MCP Server

Как это работает

1. Сбор и обработка документации (Context)

  • Рекурсивно извлекает и очищает документацию LangGraph с нескольких URL-адресов сайтов с помощью RecursiveUrlLoader и BeautifulSoup.

  • Разбивает текст на фрагменты удобного размера с помощью RecursiveCharacterTextSplitter с tiktoken для точного подсчёта токенов.

  • Преобразует фрагменты в векторные представления с помощью эмбеддингов BAAI/bge-large-en-v1.5.

  • Хранит векторы в SKLearnVectorStore для эффективного поиска.

2. Система поиска (Tool)

  • Реализует функцию поиска, которая находит наиболее релевантные фрагменты документации для заданного запроса.

  • Интегрирует эту функцию с языковыми моделями, такими как Claude, для предоставления ответов с учётом контекста.

  • Возвращает отформатированные ответы, содержащие указание источников и релевантный контекст.

3. Интеграция MCP-сервера

  • Оборачивает инструмент поиска в MCP-сервер с помощью библиотеки fastmcp.

  • Предоставляет функцию поиска как инструмент, который могут использовать MCP-совместимые хосты.

  • Обеспечивает доступ и к системе поиска, и к дополнительным ресурсам (например, к полному файлу документации).

Требования

  • Python 3.10+

  • Docker and Docker Compose (recommended)

  • An Anthropic API key (for Claude models)

Installation and Setup

You can run this project either with Docker (recommended) or in a local Python environment.

  1. Clone this repository:

    git clone https://github.com/yourusername/langraph-rag-mcp.git
    cd langraph-rag-mcp
  2. Set up your API keys in a .env file: Create a .env file in the project root and add your Anthropic API key:

    echo "ANTHROPIC_API_KEY=your_api_key_here" > .env

    The docker-compose.yml file will automatically load this environment variable.

Local Environment (without Docker)

  1. Clone this repository:

    git clone https://github.com/yourusername/langraph-rag-mcp.git
    cd langraph-rag-mcp
  2. Create and activate a virtual environment:

    conda create -n mcp python=3.13
    conda activate mcp
  3. Install the required packages:

    pip install -r requirements.txt
  4. Set up your API keys in a .env file:

    echo "ANTHROPIC_API_KEY=your_api_key_here" > .env

Usage

The process involves two main steps: first generate the vector store, and second run the MCP server.

Step 1: Generate the Vector Store

You only need to do this once, or whenever you want to update the documentation.

  1. Open and run the rag-tool.ipynb notebook in a Jupyter environment.

  2. This will:

    • Download the latest LangGraph documentation.

    • Save the full documentation to llms_full.txt.

    • Split the documents into chunks.

    • Create and persist a vector store at sklearn_vectorstore.parquet.

Step 2: Run the MCP Server

With Docker

The easiest way to run the server is using the provided shell script, which wraps Docker Compose.

bash run-mcp-docker.sh

This script will build the Docker image if it doesn't exist, start the container, and then execute the MCP server inside it, correctly handling standard I/O for MCP communication.

Without Docker

If you are not using Docker, you can run the MCP server directly in dev mode through the command:

mcp dev langgraph-mcp.py

Configuring MCP Hosts

To use this MCP server with a compatible editor, you need to configure it.

VS Code

  1. Open your VS Code settings.json file. (You can find it via the command palette: Preferences: Open User Settings (JSON)).

  2. Add the following configuration to the file. Make sure to replace <path-to-your-project> with the absolute path to the langraph-rag-mcp directory on your machine.

"mcp.servers": [
    {
        "name": "langgraph-mcp",
        "command": [
            "/bin/bash",
            "<path-to-your-project>/run-mcp-docker.sh"
        ],
        "env": {
            "ANTHROPIC_API_KEY": "<your-anthropic-api-key>"
        }
    }
]

If you are not using Docker, change the command to:

"command": [
    "<path-to-your-conda-env>/bin/python",
    "<path-to-your-project>/langgraph-mcp.py"
]

System Architecture

(Phase 1: Data Ingestion - Performed once on Host Machine)
┌─────────────┐      ┌──────────────────┐      ┌───────────────────────────────┐
│ LangGraph   │      │ Jupyter Notebook │      │ Vector Store & Full Docs      │
│ Docs (Web)  │───▶  │ (rag-tool.ipynb) │───▶  │ (.parquet & .txt files)       │
└─────────────┘      └──────────────────┘      └───────────────────────────────┘


(Phase 2: Live RAG System - Request/Response Flow)
┌──────────────┐                             ┌─────────────┐
│   VS Code    │                             │  .env file  │
│(User Interface)│                             │ (API KEY)   │
└──────┬───────┘                             └──────┬──────┘
       │ 1. User Query                             │ (provides)
       ▼                                           │
┌──────┴───────────────────────────────────────────┴───────────────────────────────┐
│ Host Machine Boundary                                                            │
│                                                                                  │
│      ┌────────────────────┐          ┌─────────────────────────────────────────┐ │
│      │ run-mcp-docker.sh  │ 2. Execs │  🐳 Docker Container                      │ │
│      │ (Entrypoint Script)│────▶     │                                         │ │
│      └────────────────────┘          │  ┌───────────────────────────────────┐  │ │
│                                      │  │   🐍 Python MCP Server              │  │ │
│      ▲                             ◀─┼──│   (langgraph-mcp.py)              │  │ │
│      │ 7. Final Response             │  └───────────────┬───────────────────┘  │ │
│      │                               │                  │ 3. Reads Data From  │ │
│      └───────────────────────────────│──────────────────│─────────────────────┘ │
│                                      │                  │                       │
│                                      │                  ▼                       │
│                                      │  ┌───────────────────────────────────┐  │
│ (files mounted from Host) ············  │   Mounted Vector Store & Docs     │  │
│                                      │  └───────────────────────────────────┘  │
│                                      └─────────────────────────────────────────┘ │
│                                                                                  │
└──────────────────────────────────────────────────────────────────────────────────┘
                                                        │ 4. API Call
                                                        │    (sends augmented prompt)
                                                        ▼
                                             ┌────────────────────┐
                                             │ ☁️ Anthropic API   │
                                             │   (Claude LLM)     │
                                             └──────────┬─────────┘
                                                        │ 5. Generation
                                                        │
                                                        ◀························
                                                          6. Returns Response
                                                          (to MCP Server)

Resources

MCP From Scratch

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Query any docs site via MCP. Submit a URL, ask questions, get cited answers.

  • Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.

  • Turn a GitHub repo or docs site into agent-ready context: pack it or search it, over MCP.

View all MCP Connectors

Latest Blog Posts

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/Jaynt27/langgraph-rag-mcp'

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