MCP Server for LightRAG
Project description
LightRAG MCP Server
MCP server for integrating LightRAG with AI tools. Provides a unified interface for interacting with LightRAG API through the MCP protocol.
Description
LightRAG MCP Server is a bridge between LightRAG API and MCP-compatible clients. It allows using LightRAG (Retrieval-Augmented Generation) capabilities in various AI tools that support the MCP protocol.
Key Features
- Information Retrieval: Execute semantic and keyword queries to documents
- Document Management: Upload, index, and track document status
- Knowledge Graph Operations: Manage entities and relationships in the knowledge graph
- Monitoring: Check LightRAG API status and document processing
Installation
This server is designed to be used as an MCP server and should be installed in a virtual environment using uv, not as a system-wide package.
Development Installation
# Create a virtual environment
uv venv --python 3.11
# Install the package in development mode
uv pip install -e .
Requirements
- Python 3.11+
- Running LightRAG API server
Usage
Important: LightRAG MCP server should only be run as an MCP server through an MCP client configuration file (mcp-config.json).
Command Line Options
The following arguments are available when configuring the server in mcp-config.json:
--host: LightRAG API host (default: localhost)--port: LightRAG API port (default: 9621)--api-key: LightRAG API key (optional)
Integration with LightRAG API
The MCP server requires a running LightRAG API server. Start it as follows:
# Create virtual environment
uv venv --python 3.11
# Install dependencies
uv pip install -r LightRAG/lightrag/api/requirements.txt
# Start LightRAG API
uv run LightRAG/lightrag/api/lightrag_server.py --host localhost --port 9621 --working-dir ./rag_storage --input-dir ./input --llm-binding openai --embedding-binding openai --log-level DEBUG
Setting up as MCP server
To set up LightRAG MCP as an MCP server, add the following configuration to your MCP client configuration file (e.g., mcp-config.json):
Using uvenv (uvx):
{
"mcpServers": {
"lightrag-mcp": {
"command": "uvx",
"args": [
"lightrag_mcp",
"--host",
"localhost",
"--port",
"9621",
"--api-key",
"your_api_key"
]
}
}
}
Development
{
"mcpServers": {
"lightrag-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/lightrag_mcp",
"run",
"src/lightrag_mcp/main.py",
"--host",
"localhost",
"--port",
"9621",
"--api-key",
"your_api_key"
]
}
}
}
Replace /path/to/lightrag_mcp with the actual path to your lightrag-mcp directory.
Available MCP Tools
Document Queries
query_document: Execute a query to documents through LightRAG API
Document Management
insert_document: Add text directly to LightRAG storageupload_document: Upload document from file to the /input directoryinsert_file: Add document from file directly to storageinsert_batch: Add batch of documents from directoryscan_for_new_documents: Start scanning the /input directory for new documentsget_documents: Get list of all uploaded documentsget_pipeline_status: Get status of document processing in pipeline
Knowledge Graph Operations
get_graph_labels: Get labels (node and relationship types) from knowledge graphcreate_entities: Create multiple entities in knowledge graphedit_entities: Edit multiple existing entities in knowledge graphdelete_by_entities: Delete multiple entities from knowledge graph by namedelete_by_doc_ids: Delete all entities and relationships associated with multiple documentscreate_relations: Create multiple relationships between entities in knowledge graphedit_relations: Edit multiple relationships between entities in knowledge graphmerge_entities: Merge multiple entities into one with relationship migration
Monitoring
check_lightrag_health: Check LightRAG API status
Development
Installing development dependencies
uv pip install -e ".[dev]"
Running linters
ruff check src/
mypy src/
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mseep_lightrag_mcp-0.1.1.tar.gz.
File metadata
- Download URL: mseep_lightrag_mcp-0.1.1.tar.gz
- Upload date:
- Size: 52.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33c7fdaa734c4cf7af7d958f6e4b6637e79a0c1439b8bdd2d2cec4522b96a7cb
|
|
| MD5 |
f4f01a0b15c9c6ea1ca9234ae2d62961
|
|
| BLAKE2b-256 |
f4dacf62359ff0a8b4887350d6f3168fbc97d457046b7808dc0feb761c48ffbb
|
File details
Details for the file mseep_lightrag_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mseep_lightrag_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 98.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f8e7ed32abb943ea070b246861cca74b2a217526bc4bf6532f367ce00c4813d
|
|
| MD5 |
9e2f5fb40929e4251dad128cdccf5a45
|
|
| BLAKE2b-256 |
09a8afa71b0b6126094427b4c73d30b1f44e2a200941a107147aeb3011bd015a
|