Skip to content
Back to search

lightrag-mcp

MCP server for integrating LightRAG with AI tools. Provides a unified interface for interacting with LightRAG API through the MCP protocol.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/shemhamforash23--lightrag-mcp/badge.svg)](/listings/shemhamforash23--lightrag-mcp)

HTML

<a href="/listings/shemhamforash23--lightrag-mcp"><img src="/api/listings/shemhamforash23--lightrag-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

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 .

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 206 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. [![MseeP.ai Security Assessment Badge](https://mseep.net/pr/shemhamforash23-lightrag-mcp-badge.png)](https://mseep.ai/app/shemhamforash23-lightrag-mcp)
  2. # LightRAG MCP Server
  3. MCP server for integrating LightRAG with AI tools. Provides a unified interface for interacting with LightRAG API through the MCP protocol.
  4. ## Description
  5. 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.
  6. ### Key Features
  7. - **Information Retrieval**: Execute semantic and keyword queries to documents
  8. - **Document Management**: Upload, index, and track document status
  9. - **Knowledge Graph Operations**: Manage entities and relationships in the knowledge graph
  10. - **Monitoring**: Check LightRAG API status and document processing
  11. ## Installation
  12. 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.
  13. ### Development Installation
  14. ```bash
  15. # Create a virtual environment
  16. uv venv --python 3.11
  17. # Install the package in development mode
  18. uv pip install -e .
  19. ```
  20. ## Requirements
  21. - Python 3.11+
  22. - Running LightRAG API server
  23. ## Usage
  24. LightRAG MCP server supports two MCP transport modes:
  25. - **stdio (default)**: run through an MCP client configuration file (`mcp-config.json`)
  26. - **streamable-http**: run as a standalone HTTP server for remote MCP clients
  27. ### Command Line Options
  28. LightRAG API connection:
  29. - `--host`: LightRAG API host (default: localhost)
  30. - `--port`: LightRAG API port (default: 9621, or 443 when `--ssl` is set)
  31. - `--api-key`: LightRAG API key (optional)
  32. - `--ssl`: Use HTTPS instead of HTTP (default: False)
  33. MCP transport:
  34. - `--mcp-transport`: MCP transport (`stdio` or `streamable-http`, default: stdio)
  35. - `--mcp-host`: MCP HTTP host (default: 127.0.0.1)
  36. - `--mcp-port`: MCP HTTP port (default: 8000)
  37. - `--mcp-streamable-http-path`: Streamable HTTP endpoint path (default: /mcp)
  38. - `--mcp-stateless-http`: Enable stateless Streamable HTTP mode (new session per request)
  39. - `--mcp-json-response`: Return JSON responses instead of SSE for Streamable HTTP
  40. ### Integration with LightRAG API
  41. The MCP server requires a running LightRAG API server. Start it as follows:
  42. ```bash
  43. # Create virtual environment
  44. uv venv --python 3.11
  45. # Install dependencies
  46. uv pip install -r LightRAG/lightrag/api/requirements.txt
  47. # Start LightRAG API
  48. 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
  49. ```
  50. ### Setting up as MCP server (stdio)
  51. To set up LightRAG MCP as an MCP server, add the following configuration to your MCP client configuration file (e.g., `mcp-config.json`):
  52. #### Using uvenv (uvx):
  53. ```json
  54. {
  55. "mcpServers": {
  56. "lightrag-mcp": {
  57. "command": "uvx",
  58. "args": [
  59. "lightrag_mcp",
  60. "--host",
  61. "localhost",
  62. "--port",
  63. "9621",
  64. "--api-key",
  65. "your_api_key"
  66. ]
  67. }
  68. }
  69. }
  70. ```
  71. #### Using HTTPS (SSL):
  72. ```json
  73. {
  74. "mcpServers": {
  75. "lightrag-mcp": {
  76. "command": "uvx",
  77. "args": [
  78. "lightrag_mcp",
  79. "--host",
  80. "lightrag.example.com",
  81. "--ssl"
  82. ]
  83. }
  84. }
  85. }
  86. ```
  87. #### Development
  88. ```json
  89. {
  90. "mcpServers": {
  91. "lightrag-mcp": {
  92. "command": "uv",
  93. "args": [
  94. "--directory",
  95. "/path/to/lightrag_mcp",
  96. "run",
  97. "src/lightrag_mcp/main.py",
  98. "--host",
  99. "localhost",
  100. "--port",
  101. "9621",
  102. "--api-key",
  103. "your_api_key"
  104. ]
  105. }
  106. }
  107. }
  108. ```
  109. Replace `/path/to/lightrag_mcp` with the actual path to your lightrag-mcp directory.
  110. ### Running over Streamable HTTP (standalone server)
  111. Use this when you need remote access or want to host the MCP server behind HTTP infrastructure:
  112. ```bash
  113. uv run src/lightrag_mcp/main.py \
  114. --mcp-transport streamable-http \
  115. --mcp-host 0.0.0.0 \
  116. --mcp-port 8000 \
  117. --mcp-streamable-http-path /mcp \
  118. --host localhost \
  119. --port 9621 \
  120. --api-key your_api_key
  121. ```
  122. MCP clients should connect to: `http://localhost:8000/mcp`
  123. ## Available MCP Tools
  124. ### Document Queries
  125. - `query_document`: Execute a query to documents through LightRAG API
  126. ### Document Management
  127. - `insert_document`: Add text directly to LightRAG storage
  128. - `upload_document`: Upload document from file to the /input directory
  129. - `insert_file`: Add document from file directly to storage
  130. - `insert_batch`: Add batch of documents from directory
  131. - `scan_for_new_documents`: Start scanning the /input directory for new documents
  132. - `get_documents`: Get list of all uploaded documents
  133. - `get_pipeline_status`: Get status of document processing in pipeline
  134. ### Knowledge Graph Operations
  135. - `get_graph_labels`: Get labels (node and relationship types) from knowledge graph
  136. - `create_entities`: Create multiple entities in knowledge graph
  137. - `edit_entities`: Edit multiple existing entities in knowledge graph
  138. - `delete_by_entities`: Delete multiple entities from knowledge graph by name
  139. - `delete_by_doc_ids`: Delete all entities and relationships associated with multiple documents
  140. - `create_relations`: Create multiple relationships between entities in knowledge graph
  141. - `edit_relations`: Edit multiple relationships between entities in knowledge graph
  142. - `merge_entities`: Merge multiple entities into one with relationship migration
  143. ### Monitoring
  144. - `check_lightrag_health`: Check LightRAG API status
  145. ## Development
  146. ### Installing development dependencies
  147. ```bash
  148. uv pip install -e ".[dev]"
  149. ```
  150. ### Running linters
  151. ```bash
  152. ruff check src/
  153. mypy src/
  154. ```
  155. ## License
  156. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.