14a133777bad94e12fc9ce79910eef5babaff985
LightRAG MCP Server
An MCP server exposing the LightRAG Server API as tools, resources, and prompts for coding agents.
Features
- Retrieval tools:
query_data,query,query_stream,query_stream_chunks - Ingestion tools:
ingest_text,ingest_texts,upload_document - Freshness tools:
scan_documents,scan_and_wait,pipeline_status,wait_for_idle,track_status - Memory tool:
ingest_memoryfor lessons, preferences, decisions, structures, functions, relationships - Graph tools: entity/relation CRUD, entity existence check, label search, graph export
- Health tool:
health - Macro tool:
refresh_and_query(scan -> wait idle -> query_data -> query) - Resources: health, pipeline status, documents, graph, labels (list + popular), status counts
- Prompts: evidence-first answering, refresh-then-query, record project memory
Quickstart
# Create a venv and install
python -m venv .venv
. .venv/bin/activate
pip install -e .
# Run the MCP server (SSE, recommended for Claude Code)
export MCP_TRANSPORT=sse
export MCP_HOST=127.0.0.1
export MCP_PORT=8150
export LIGHTRAG_BASE_URL=http://127.0.0.1:9621
export MCP_DISABLE_DNS_REBINDING=true
export MCP_ALLOWED_HOSTS='["192.168.50.185:*","192.168.50.151:*"]'
export MCP_ALLOWED_ORIGINS='["http://192.168.50.185:*","http://192.168.50.151:*"]'
lightrag-mcp
# Smoke test (health + optional retrieval)
lightrag-mcp-smoke --query "What is this project?" --format pretty
Configuration
LIGHTRAG_BASE_URL(defaulthttp://127.0.0.1:9621)LIGHTRAG_TIMEOUT_S(default60)LIGHTRAG_POLL_INTERVAL_S(default1)LIGHTRAG_POLL_TIMEOUT_S(default120)MCP_TRANSPORT(defaultstreamable-http)MCP_HOST(default127.0.0.1)MCP_PORT(default8000)MCP_SERVER_NAME(defaultLightRAG MCP)
Notes
query_streamcollects the streaming response and returns it as a single string.query_stream_chunksreturns chunked output and reports progress to clients that support progress events.refresh_and_queryis a convenience macro for evidence-first workflows.
Description
Languages
Python
98%
Dockerfile
2%