grounded-rag-mcp
Click on "Install 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., "@grounded-rag-mcpUsing my uploaded docs, what does the refund policy say about returns?"
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.
grounded-rag-mcp
An MCP server that gives any LLM host grounded, cited retrieval over your own documents — hybrid retrieval (BM25 + dense), cross-encoder reranking, citations, and a built-in eval harness.
Point it at a folder of documents. Your MCP host (Claude Desktop, an IDE, a custom agent) can then
searchandanswerover them — grounded in the real text, with citations, and an honest "not in the documents" path.
Why
Most RAG-over-MCP examples are toys. This one is built production-flavored:
Hybrid retrieval — BM25 (exact terms) + dense (semantics), fused with Reciprocal Rank Fusion.
Cross-encoder reranking — precision on the top candidates without blowing latency.
Grounding + citations — answers cite their sources; if the answer isn't in the docs, it says so.
Built-in eval — measure retrieval quality (recall@k, MRR, hit-rate), not just vibes.
Local-first — the default path runs with no external services or API keys.
Both transports — stdio and Streamable HTTP.
Related MCP server: insight-mcp
Status
🚧 Early development. Building in public, phase by phase (see PROJECT_REQUIREMENTS.md).
Phase 0 — scaffold, packaging, CI
Phase 1 — core retrieval (chunk → embed → BM25 + dense → RRF)
Phase 2 — MCP server (stdio) with
ingest/searchPhase 3 — rerank + grounding +
answer(via MCP sampling)Phase 4 — tests, types, docs, resource + prompt
Phase 5 — Streamable HTTP transport +
evaluate_retrievalPhase 6 — publish to PyPI
Install
pip install grounded-rag-mcp # lean, local-first default (no torch)
pip install "grounded-rag-mcp[st]" # + sentence-transformers for semantic embeddings & rerankingTools
Tool | What it does |
| Chunk, embed, and index files or raw text into a named collection |
| Hybrid / dense / bm25 retrieval, optional rerank, per-stage scores |
| Grounded, cited answer via MCP sampling; refuses when nothing is found |
| List collections and chunk counts |
| hit_rate / MRR / recall@k on labeled cases |
Also exposes a resource (rag://collections) and a prompt (grounded_answer).
Use it with an MCP host (e.g. Claude Desktop)
Add to your host's MCP config:
{
"mcpServers": {
"grounded-rag": {
"command": "grounded-rag-mcp"
}
}
}Or run it directly:
grounded-rag-mcp # stdio (default, for local hosts)
grounded-rag-mcp --http # Streamable HTTP on 127.0.0.1:8000 (remote / multi-client)Use the retrieval engine as a Python library
from grounded_rag_mcp.collection import Collection
from grounded_rag_mcp.embeddings import HashingEmbedder
from grounded_rag_mcp.ingest import load_texts
from grounded_rag_mcp.config import RetrievalConfig
col = Collection("kb", HashingEmbedder(dim=512))
col.add(load_texts(["The refund policy allows returns within 30 days of purchase."]))
for hit in col.retrieve("refund policy", RetrievalConfig(top_k=1)):
print(hit.chunk.source, hit.score, hit.stage_scores)Development
pip install -e ".[dev]"
ruff check . && ruff format --check . && mypy src && pytest -qSee docs/ARCHITECTURE.md, docs/BUILD_STORY.md, and PUBLISHING.md.
License
MIT © Chetan C
Available Tools
5 toolsanswerA
Answer a question grounded in a collection, with citations.
Retrieves the most relevant passages and asks the host's model (via MCP sampling) to
answer using ONLY those passages, citing them. Returns {grounded, answer, citations}.
If nothing relevant is found, grounded is false and no answer is invented. If the
host does not support sampling, the grounded context is returned for the host to
compose the answer itself.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| top_k | No | ||
| collection | No | default |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and does so admirably. It discloses the MCP sampling mechanism, the exact return shape (`{grounded, answer, citations}`), the no-invention behavior when nothing relevant is found, and the fallback to returning grounded context when sampling is unsupported.
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 well-structured and front-loaded, stating the core purpose first, then explaining the mechanism, return format, and fallbacks. Every sentence adds meaningful information with no redundancy.
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 description thoroughly covers the tool's behavior, return values, and edge cases, making it largely complete for selection and invocation. It is missing parameter-level explanation for `top_k` and `collection`, but the presence of an output schema and the tool's relatively focused scope keep the gap minor.
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 explain the `top_k` or `collection` parameters at all. While `query` is self-evident from the description's reference to a question, the other two parameters are left undocumented in both the schema and the description, so the description fails to compensate for the coverage gap.
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 opens with a specific verb and resource: 'Answer a question grounded in a collection, with citations.' It clearly differentiates itself from sibling tools like `search` by emphasizing grounded, citation-backed answers rather than raw retrieval.
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 clearly implies when to use the tool—when a grounded, cited answer is needed—and explains fallback behavior when sampling is unsupported. It does not explicitly name alternatives or exclusion criteria, but the behavioral context is strong enough for an agent to select it appropriately.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
evaluate_retrievalA
Measure retrieval quality on labeled cases: hit_rate, MRR, and recall@k.
Each case is {query, relevant_sources}. Use this to quantify quality and catch
regressions — e.g. before and after changing chunking or switching embedders.
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | hybrid | |
| cases | Yes | ||
| top_k | No | ||
| collection | No | default |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must carry behavior disclosure. It conveys that the tool measures/evaluates rather than mutates, but it does not explicitly state whether it runs live retrievals against a collection, requires an existing collection, or has side effects. This is adequate but leaves some operational behavior implicit.
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 two compact sentences: the first states purpose and metrics, the second defines the case structure and provides usage context. Every sentence earns its place with no redundancy or filler.
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?
With an output schema present, return values do not need to be described. The description covers purpose, case format, and usage context, but leaves mode/top_k/collection semantics and behavioral details to the schema or inference. This is adequate for a moderately complex tool, but not fully complete.
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 explains the shape of cases as `{query, relevant_sources}` and implicitly connects top_k to recall@k, but it does not explain mode (hybrid/dense/bm25) or collection beyond their enum/default values. The partial compensation keeps it at an adequate 3.
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 opens with a specific verb and resource: 'Measure retrieval quality on labeled cases' and names the concrete metrics hit_rate, MRR, and recall@k. This clearly distinguishes the tool from sibling tools like search (actual retrieval) or answer (generation), establishing it as an evaluation utility.
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 says when to use it: 'Use this to quantify quality and catch regressions — e.g. before and after changing chunking or switching embedders.' It provides clear context and examples, though it does not mention when not to use it or name alternative tools explicitly.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ingest_documentsA
Ingest documents into a named collection so they can be searched.
Provide paths (files or directories of .txt/.md) and/or texts (raw strings).
Documents are chunked, embedded, and indexed for both semantic and keyword search.
Returns how many chunks were added and the collection's new total.
| Name | Required | Description | Default |
|---|---|---|---|
| paths | No | ||
| texts | No | ||
| chunk_size | No | ||
| collection | No | default | |
| chunk_overlap | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and discloses the main behavioral pipeline: chunking, embedding, and indexing for semantic and keyword search. It also states the return value (chunks added and new total), which adds useful non-obvious information.
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 short, front-loaded sentences with no filler. The key action and purpose appear first, followed by the input options, processing behavior, and return value.
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 description covers the main inputs, processing steps, and return output, and an output schema exists for return details. It could mention collection creation behavior or defaults for chunking parameters, but it is sufficiently complete for an agent to call this tool correctly.
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?
The description compensates partially for 0% schema coverage by explaining paths and texts, including allowed file extensions and directories. However, it does not explain the semantics of chunk_size, chunk_overlap, or collection beyond vague references to chunking and a named collection.
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 action (ingest), the resource (documents into a named collection), and the purpose (so they can be searched). It distinguishes this tool from sibling read/search tools by framing it as the ingestion-side counterpart.
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 gives clear context for when to use this tool: before searching, by adding documents to a collection. It also explains the two accepted input modes (paths and/or texts), but it does not explicitly name alternatives or say when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_collectionsA
List all ingested collections and how many chunks each contains.
| 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 provided, the description carries the transparency burden, and 'List' plus 'how many chunks each contains' conveys a read-only aggregation-style operation with no side effects. It does not explicitly mention caveats like ordering or rate limits, but for a parameterless listing tool the core behavior is clear.
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?
Exactly one sentence with no filler; the key verb, scope, and output are front-loaded. Every word earns its place.
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 is a simple parameterless listing operation with an output schema available, and the description specifies both the scope and the per-item chunk count. No prerequisite or return-shape detail is missing for an agent to invoke it correctly.
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?
The input schema has zero properties and 100% coverage, so there are no parameter semantics to document. The description adds useful scope information ('ingested,' 'each') that clarifies what the empty parameter list returns.
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 uses the specific verb 'List' with a clear resource, 'all ingested collections,' and specifies the returned information ('how many chunks each contains'). This is unambiguous and distinguishes it from sibling tools like ingest_documents and search.
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 the tool is for inspecting ingested collections, but it does not explicitly state when to choose it over alternatives. The phrase 'ingested collections' signals it is relevant after ingestion, but there is no direct when/when-not guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
searchA
Search a collection and return the most relevant chunks, each with its source.
mode is "hybrid" (BM25 + semantic, default), "dense" (semantic only), or "bm25"
(keyword only). rerank applies the cross-encoder reranker if one is configured.
Each result includes per-stage scores for transparency. An empty list means nothing
relevant was found — treat that as "not in the documents".
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | hybrid | |
| query | Yes | ||
| top_k | No | ||
| rerank | No | ||
| collection | No | default |
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 behavioral burden. It discloses meaningful runtime behavior: per-stage scores are included for transparency, reranking is conditional on a configured cross-encoder, and an empty result has a specific meaning. This goes well beyond a bare description, though it does not address rate limits or auth.
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 four sentences with no filler. The core purpose is front-loaded, followed by mode semantics, rerank behavior, and output interpretation. Every sentence adds value.
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 an output schema, so return-value details do not need to be repeated. The description covers the key calling nuances: mode options, rerank behavior, per-stage scores, and empty-result semantics. A minor gap is that the collection parameter's role is not elaborated, but the schema title and default make it reasonably clear.
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 coverage is 0%, so the description must compensate. It does for the two most complex parameters: it explains what each mode means (hybrid = BM25 + semantic, dense = semantic only, bm25 = keyword only) and what rerank does. query, top_k, and collection are left to their schema titles and defaults, which are fairly self-explanatory.
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 opens with a specific verb and resource ('Search a collection and return the most relevant chunks') and clearly defines the output as chunks with sources. This distinguishes it from siblings like ingest_documents, answer, list_collections, and evaluate_retrieval without needing to reference them.
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 gives clear context for when this tool is appropriate: retrieving relevant chunks with sources. It also provides practical interpretation guidance, such as treating an empty list as 'not in the documents.' It does not explicitly name alternatives or state when not to use it, so it stops short of a full 5.
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.
5 tool updates
v0.1.0- First observed
answer - First observed
evaluate_retrieval - First observed
ingest_documents - First observed
list_collections - First observed
search
TDQS
Scored across 5 tools
Each tool targets a distinct operation: ingestion, search, grounded answering, collection listing, and retrieval evaluation. There is no overlap in purpose, and descriptions clearly delineate when to use each.
Tool names follow a clear imperative, snake_case style. Most use verb_noun (ingest_documents, list_collections, evaluate_retrieval), though search and answer are bare verbs rather than verb_noun, creating a minor inconsistency.
Five tools is well-scoped for a grounded RAG server: ingest, search, answer, list collections, and evaluate retrieval. Each tool covers a necessary part of the workflow without redundancy or bloat.
Core RAG workflows are covered end-to-end, including ingestion, retrieval, grounded answering, and quality evaluation. The main gap is lifecycle management: there is no way to delete or update documents or collections once ingested.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
- docs2mcpOAuthcom.docs2mcp
Query your own PDFs and documents from any MCP client. Every answer cites the page it came from.
Agentic search over your Dewey document collections from any MCP-compatible client.
Multi-engine search for AI agents. Trust scoring, local corpus, MCP-native. Self-hostable, BYOK.
Make your knowledge agent-ready. One MCP endpoint, 5 connectors, 3 search modes.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables any MCP-compatible AI assistant to search, filter, and retrieve information from a local document collection using a hybrid search pipeline with vector, BM25, reranking, and LLM enrichment.4-
- AlicenseNot gradedqualityBmaintenanceEnables hybrid document search (BM25 and dense) over a configurable corpus via MCP tools, returning passages and sources for AI agents to cite in answers.MIT
- AlicenseNot gradedqualityBmaintenanceProvides hybrid retrieval (dense + BM25 + RRF) with collection-based isolation and document ingestion for private knowledge access via MCP.MIT
- FlicenseNot gradedqualityCmaintenanceEnables agent tools like Claude Code and GitHub Copilot to perform knowledge retrieval using hybrid search (BM25 + dense) with reranking, via MCP protocol.-