lightrag-docs-rag-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@lightrag-docs-rag-mcp Ask the knowledge graph: what are the top security recommendations? Include sources."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
lightrag-docs-rag-mcp
An MCP server that exposes a LightRAG instance as three tools, so any MCP-capable agent can ground its answers in your indexed docs instead of relying on recall.
LightRAG ships a REST server but no MCP server of its own, and the community package uses different tool names. This one is a thin, auditable wrapper over four LightRAG HTTP routes, with tool names chosen to match how tool-calling corpora actually name them.
Tool | Purpose |
| Ask the knowledge graph a question; returns a grounded answer and the source files that grounded it |
| Add documents to the index |
| Document counts by pipeline stage, whether indexing is running, and the model endpoints in use |
Why these names
Registered under a server named docs_rag, the tools surface as
mcp__docs_rag__docs_query, mcp__docs_rag__docs_ingest, mcp__docs_rag__docs_stats.
That matches the naming used by existing agent tool-calling datasets, so a corpus
generated against this server validates without a rename layer.
Related MCP server: Cognify MCP Server
Install
uv tool install lightrag-docs-rag-mcp
# or, from a checkout:
uv tool install .Requires a running LightRAG server (lightrag-server). Python 3.10+.
Configure
Hermes Agent
hermes mcp add docs_rag --command lightrag-docs-rag-mcpor in ~/.hermes/config.yaml:
mcp_servers:
docs_rag:
command: "lightrag-docs-rag-mcp"
env:
LIGHTRAG_BASE_URL: "http://127.0.0.1:9621"
timeout: 900Claude Desktop / other MCP clients
{
"mcpServers": {
"docs_rag": {
"command": "lightrag-docs-rag-mcp",
"env": { "LIGHTRAG_BASE_URL": "http://127.0.0.1:9621" }
}
}
}Environment
Variable | Default | Meaning |
|
| LightRAG server root |
| (unset) | Sent as |
|
| Per-request timeout, seconds |
| (unset) | Verbose logging to stderr |
Operational notes
These are the things that will actually bite you.
Queries are slow, and that is the server's model choice, not this wrapper. A hybrid
query over a ~20-chunk context measured ~212 s on a local 9B. Context size dominates.
If you need faster answers, cap the server's MAX_TOTAL_TOKENS /
MAX_ENTITY_TOKENS / MAX_RELATION_TOKENS and raise LLM_TIMEOUT. The default timeout
here is 900 s so a slow-but-correct answer does not become an error.
The LightRAG LLM must have thinking disabled. With a thinking model, the query's
final answer call returns empty content with finish_reason=length, which surfaces as
OpenAI API Timeout Error — while retrieval looks perfectly healthy. That is an LLM-tier
bug that reads like a retrieval bug. For llama.cpp-served models, serve a dedicated entry:
llama-server ... --n-predict 4096 --chat-template-kwargs '{"enable_thinking":false}'An empty answer is not an empty index. llm_generated: false with no references
means the LLM or embedding tier is unreachable, not that retrieval found nothing. Check
docs_stats first — and note that ingestion completeness (processed: N) says nothing
about queryability.
Indexing is graph extraction, not a vector write. Budget roughly a minute per chunk on a local model; a corpus stays queryable-but-partial while extraction runs.
Development
uv venv && uv pip install -e '.[dev]'
ruff check .
pytestLicense
MIT
Available Tools
3 toolsdocs_ingestAdd documents to the knowledge graphA
Insert text documents into the LightRAG index. Indexing is a graph-extraction pass, not a cheap vector write: budget roughly a minute per chunk on a local model, and expect the corpus to stay queryable-but-partial while it runs. Identical content is de-duplicated by hash, so re-submitting an unchanged document is a no-op rather than a duplicate.
Inputs: texts (required), file_sources. Returns: result
docs_queryQuery the docs knowledge graphA
Search the indexed documentation knowledge graph and return a grounded answer. Use this for questions about the libraries and tools in the corpus (for example an engine's class API or a text editor's scripting API) instead of relying on recall. The answer is generated from retrieved graph context and comes with the source files that grounded it, so prefer it over an ungrounded answer and cite the returned file paths. Expect this call to take up to several minutes on a local model; it is not a fast lookup.
Inputs: query (required), mode, top_k. Returns: result
docs_statsKnowledge graph statusA
Report the state of the LightRAG instance: document counts by pipeline stage, whether an indexing job is currently running, and which model and embedding endpoints it is configured to use. Check this before a large ingest, and to distinguish 'the corpus is still indexing' from 'the corpus is empty' when a query returns nothing.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool targets a distinct operation: querying the graph, ingesting documents, and inspecting instance state. No two tools could be confused for one another.
All tool names follow a consistent docs_ prefix with a clear verb suffix (query, ingest, stats). The pattern is uniform and predictable.
Three tools cover the core RAG lifecycle (ingest, query, monitor) without redundancy. This is a well-scoped set for a focused documentation assistant.
The essential operations are present: adding documents, retrieving answers, and checking status. A delete or clear operation is the only notable gap, but it is not critical for the stated purpose.
Related MCP Connectors
Cloud or self-hosted knowledge for AI agents: hybrid search, reranking, GraphRAG, scoped MCP tools.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Make your knowledge agent-ready. One MCP endpoint, 5 connectors, 3 search modes.
Ingest, manage, and retrieve documents for RAG-powered AI applications
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI clients to interact with a LightRAG knowledge graph server via MCP, providing 30 tools for queries, document management, and graph operations.MIT
- AlicenseNot gradedqualityBmaintenanceEnables document ingestion and typed knowledge graph queries through Claude MCP tools, allowing agents to extract, store, and retrieve typed entities and relations from documents.2MIT
- FlicenseNot gradedqualityDmaintenanceMCP server that bridges LightRAG API with MCP-compatible clients, enabling retrieval-augmented generation, document management, and knowledge graph operations.127-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to query and manage a document knowledge base via MCP, with RAG-powered search and grounded answers with citations.MIT