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-mcpAsk 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.
| Name | Required | Description | Default |
|---|---|---|---|
| texts | Yes | ||
| file_sources | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It does well by disclosing that indexing is a graph-extraction pass with a time cost (minute per chunk), that the corpus remains partially queryable during the process, and that re-submission of identical content is a no-op due to hash de-duplication. These are critical behavioral traits an agent needs to know.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise, with three sentences that each carry weight: the purpose, the cost/behavior, and the de-duplication effect. It is front-loaded with the main purpose and then adds critical behavioral details, with no extraneous information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (graph extraction, performance implications), the absence of annotations, and a schema with little description, the description is quite complete. It covers the operational cost, eventual consistency, and idempotency. A minor gap is the lack of explicit handling for 'file_sources', but the core functionality is well covered.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It does add significant context: it explains that 'texts' are the content to be indexed and that identical content is de-duplicated. However, it does not describe the 'file_sources' parameter, which is optional but appears in the schema. The description adds meaning beyond the schema, but not complete coverage of both parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: inserting text documents into the LightRAG indexTm. It specifies the resource (LightRAG index) and the action (insert/ingest). However, it does not explicitly differentiate from sibling tools like docs_query and docs_stats, though those are clearly for retrieval and stats, so the purpose is clear enough.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by describing the indexing process and its cost, which indirectly suggests when to use it (when you need to add documents) and what to expect. However, it does not explicitly state when not to use it or mention alternatives. It could be more explicit about the trade-offs versus other operations.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | hybrid | |
| query | Yes | ||
| top_k | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It reveals that the answer is generated from retrieved graph context, that source files are returned for grounding, and that the call can take up to several minutes on a local model. These traits materially shape a caller's expectations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Four sentences, each earning its place: the core action, when to use it, output/grounding expectations, and latency warning. The most important information is front-loaded, with no filler or repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so the description doesn't need to explain return values. It covers intent, usage guidance, grounding behavior, and a critical latency caveat for a moderately complex tool. The only gap is parameter semantics, which is already scored separately; overall the description is complete enough to guide correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% and the description does not compensate. It only clarifies that the query is a question about the corpus; mode and top_k are left entirely unexplained, even though defaults exist. An agent has no way to understand what mode='hybrid' means or how top_k affects results.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description leads with a specific verb and resource: 'Search the indexed documentation knowledge graph and return a grounded answer.' It gives concrete examples of the kind of questions it handles, and the resource and behavior clearly distinguish it from docs_ingest and docs_stats.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly states when to use it ('questions about the libraries and tools in the corpus') and when not to ('instead of relying on recall'), and gives a preference directive ('prefer it over an ungrounded answer'). This is clear, actionable guidance even though sibling tools aren't named.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of behavioral disclosure. It states it reports status, which implies a read-only, non-destructive operation. It also specifies what data it returns, giving agents a clear expectation. It doesn't mention side effects, latency, or permissions, but for a status tool, the verb 'report' and the focus on state make it sufficiently transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, well-structured sentence that front-loads the primary purpose ('Report the state of the LightRAG instance') followed by concrete details. Every clause adds value, and there is no redundant or filler content. It is concise yet comprehensive.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has no parameters and a rich output schema (indicated in context), so the description doesn't need to explain return values. It provides complete guidance on when to use the tool and what it reports, covering all an agent needs to correctly invoke and interpret results. Nothing is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
There are zero parameters, and the input schema is empty. The baseline for a 0-parameter tool is 4. The description adds context about what the output represents (pipeline stage counts, indexing status, endpoints), which is valuable for interpreting results, even though no parameter details are needed.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool reports the state of the LightRAG instance with specific details (document counts by pipeline stage, indexing job status, model and embedding endpoints). It distinguishes itself from siblings by explicitly addressing when to use it (before a large ingest, to differentiate indexing from empty corpus), making its purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit scenarios for when to use the tool: before a large ingest, and to distinguish between 'still indexing' and 'empty' when a query returns nothing. This gives clear usage context and implicitly differentiates it from docs_query and docs_ingest, which are the sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.0- First observed
docs_ingest - First observed
docs_query - First observed
docs_stats
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.
Maintenance
Related MCP Connectors
Cloud or self-hosted knowledge for AI agents: hybrid search, reranking, GraphRAG, scoped MCP tools.
Make your knowledge agent-ready. One MCP endpoint, 5 connectors, 3 search modes.
Ingest, manage, and retrieve documents for RAG-powered AI applications
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
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.34 npmMIT
- 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.122-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to query and manage a document knowledge base via MCP, with RAG-powered search and grounded answers with citations.MIT