lightrag-mcp
Enables AI agents to query a persistent LightRAG knowledge base through any MCP client, offering both ready-made answers with source links and raw context retrieval for custom response generation.
README
lightrag-mcp
MCP-сервер, который подключает LightRAG к любому MCP-клиенту — Cursor, Claude Desktop и другим. Даёт агенту доступ к постоянной базе знаний: заметкам, решениям, документации, ранбукам.
Два инструмента, потому что у извлечения знаний два разных сценария:
| Инструмент | Что делает | Когда нужен |
|---|---|---|
search_lightrag |
Возвращает готовый ответ со ссылками на источники | Обычный вопрос к базе знаний |
get_lightrag_context |
Возвращает только контекст и источники, без генерации ответа | Когда ответ нужно собрать самому: сверить с кодом, совместить с текущим диалогом |
Оба инструмента помечены как readOnlyHint, поэтому клиент не будет
воспринимать их как изменяющие состояние.
Установка
npm install
Требуется Node.js 18 или новее — используется встроенный fetch.
Настройка
Создайте .env рядом с package.json:
LIGHTRAG_URL=http://localhost:9621
LIGHTRAG_API_KEY=ваш-ключ
LIGHTRAG_URL необязателен и по умолчанию равен http://localhost:9621.
LIGHTRAG_API_KEY обязателен: без него сервер падает на старте с внятной
ошибкой, а не в момент первого запроса.
Путь к файлу окружения можно переопределить переменной
LIGHTRAG_MCP_ENV_FILE — удобно, когда клиент запускает сервер из другого
рабочего каталога.
Подключение к Cursor
В ~/.cursor/mcp.json:
{
"mcpServers": {
"lightrag": {
"command": "node",
"args": ["/абсолютный/путь/lightrag-mcp/src/server.js"],
"env": {
"LIGHTRAG_MCP_ENV_FILE": "/абсолютный/путь/lightrag-mcp/.env"
}
}
}
}
Режимы поиска
Параметр mode принимает mix (по умолчанию), hybrid, local, global и
naive. Неизвестный режим отклоняется до сетевого запроса. Запросы всегда
уходят с включёнными ссылками на источники и реранкингом.
Тесты
npm test
Тесты используют встроенный node --test, без внешних зависимостей. HTTP
подменяется через параметр fetchImpl, поэтому проверяются и успешные ответы,
и ошибки: отсутствующий ключ, пустой вопрос, неизвестный режим, неуспешный
статус ответа.
Лицензия
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.