langgraph-mcp
LangGraph RAG MCP
Система генерации с дополнением на основе поиска (Retrieval-Augmented Generation, RAG), которая предоставляет документацию LangGraph через Model Context Protocol (MCP).
Обзор
Этот проект создаёт систему поиска по документации, которая:
Собирает и обрабатывает документацию LangGraph с официального сайта
Создаёт векторную базу данных из этой документации для семантического поиска
Предоставляет доступ к этим знаниям через Model Context Protocol (MCP)
Интегрируется с 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.
Using Docker (Recommended)
Clone this repository:
git clone https://github.com/yourusername/langraph-rag-mcp.git cd langraph-rag-mcpSet up your API keys in a
.envfile: Create a.envfile in the project root and add your Anthropic API key:echo "ANTHROPIC_API_KEY=your_api_key_here" > .envThe
docker-compose.ymlfile will automatically load this environment variable.
Local Environment (without Docker)
Clone this repository:
git clone https://github.com/yourusername/langraph-rag-mcp.git cd langraph-rag-mcpCreate and activate a virtual environment:
conda create -n mcp python=3.13 conda activate mcpInstall the required packages:
pip install -r requirements.txtSet up your API keys in a
.envfile: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.
Open and run the
rag-tool.ipynbnotebook in a Jupyter environment.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.shThis 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.pyConfiguring MCP Hosts
To use this MCP server with a compatible editor, you need to configure it.
VS Code
Open your VS Code
settings.jsonfile. (You can find it via the command palette:Preferences: Open User Settings (JSON)).Add the following configuration to the file. Make sure to replace
<path-to-your-project>with the absolute path to thelangraph-rag-mcpdirectory 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
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for langchain documentation, generated by doc2mcp.
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.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA customized MCP server that enables integration between LLM applications and documentation sources, providing AI-assisted access to LangGraph and Model Context Protocol documentation.-
- FlicenseNot gradedqualityDmaintenanceAn MCP-based AI agent that retrieves and processes documents to answer queries using a RAG pipeline with LangChain and Claude models. It enables document indexing, context-aware retrieval, and multi-tool orchestration for research and knowledgebase applications.1-
- FlicenseBqualityCmaintenanceRetrieval-Augmented Generation system serving LangGraph documentation through the Model Context Protocol, enabling semantic search and context-aware responses.216-
- FlicenseNot gradedqualityCmaintenanceEnables MCP-compatible hosts to retrieve LangGraph documentation through retrieval-augmented generation, with source attribution for responses.-