
the best mcp server for lightrag with support for idempotent uploads
概览
A Model Context Protocol (MCP) server that enables AI assistants to interact with LightRAG knowledge graphs. Query documents, manage entities, and build semantic relationships through a standardized tool interface. : The built-in smart upsert and document tracking capabilities make it perfect for agents that need to sync and reason over evolving Obsidian knowledge bases. - : Intelligent upsert logic that detects changes in documents, skipping redundant uploads and re-indexing only when necessary - : Perform semantic, keyword, or hybrid searches across your indexed documents - : Add text, files, or entire directories to your knowledge base - : Create, update, merge, and delete entities in the graph - : Define and modify connections between entities - : Automatic retry with exponential backoff for reliable API communication - : Set options via environment variables or command-line arguments 1. (must be running before the MCP server) 3.
README
以下为原文 README 节选,完整内容请查看原文。
LightRAG MCP Server
A Model Context Protocol (MCP) server that enables AI assistants to interact with LightRAG knowledge graphs. Query documents, manage entities, and build semantic relationships through a standardized tool interface. Optimized for Obsidian Vaults: The built-in smart upsert and document tracking capabilities make it perfect for agents that need to sync and reason over evolving Obsidian knowledge bases.
Features
- Smart Updates: Intelligent
upsertlogic that detects changes in documents, skipping redundant uploads and re-indexing only when necessary - Knowledge Graph Queries: Perform semantic, keyword, or hybrid searches across your indexed documents
- Document Ingestion: Add text, files, or entire directories to your knowledge base
- Entity Management: Create, update, merge, and delete entities in the graph
- Relationship Handling: Define and modify connections between entities
- Robust Connectivity: Automatic retry with exponential backoff for reliable API communication
- Flexible Configuration: Set options via environment variables or command-line arguments
Installation
# Clone the repository
git clone https://github.com/enriquecatala/mcp-lightrag.git
cd mcp-lightrag
# Install dependencies
uv sync
Quick Start
-
Start your LightRAG server (must be running before the MCP server)
-
Launch the MCP server:
uv run mcp-lightrag --host localhost --port 9621 -
Connect your AI assistant via the MCP protocol (stdio transport)
Configuration
| Option | Environment Variable | Default | Description |
|---|---|---|---|
--host |
LIGHTRAG_HOST |
localhost |
LightRAG API host |
--port |
LIGHTRAG_PORT |
9621 |
LightRAG API port |
--api-key |
LIGHTRAG_API_KEY |
(none) | Optional API key |
--log-level |
— | INFO |
Logging verbosity |
Setting up as MCP Server
To integrate this server with an MCP client (such as Claude Desktop), add the following configuration to your mcp-server-config.json key in your settings file. This configuration uses uv to run the server from the source directory.
{
"mcpServers": {
"mcp-lightrag": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-lightrag",
"run",
"mcp-lightrag",
"--host",
"localhost",
"--port",
"9621"
],
"env": {
"LIGHTRAG_API_KEY": "optional_api_key"
}
}
}
}
Note: Replace
/absolute/path/to/mcp-lightragwith the actual full path to where you cloned this repository.
Smart Document Handling
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"mcp-lightrag": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-lightrag",
"run",
"mcp-lightrag",
"--host",
"localhost",
"--port",
"9621"
],
"env": {
"LIGHTRAG_API_KEY": "optional_api_key"
}
}
}
}