grounded-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., "@grounded-rag-mcp Search my Q3 reports and answer with citations: what were our main risks?"
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 (TypeScript)
An MCP server that gives any LLM host grounded, cited retrieval over your own documents — hybrid retrieval (BM25 + dense), reranking-ready, citations, and a built-in eval harness. The TypeScript/Node twin of the Python package.
Point it at 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.
Grounding + citations — answers cite 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.
Zero-dependency default — a deterministic hashing embedder runs with nothing extra.
Strict TypeScript, ESM, tested, CI on Node 18/20/22.
Related MCP server: RAG Knowledge Base MCP Server
Status
Built in public, phase by phase.
Phase 0 — scaffold, packaging, CI
Phase 1 — core retrieval (chunk → embed → BM25 + dense → RRF)
Phase 2 — MCP server (stdio) with
ingest/searchPhase 3 — grounding +
answer(via MCP sampling)Phase 4 — eval, resource + prompt, docs
Phase 5 — publish to npm
Install
npm install grounded-rag-mcp
# or run without installing:
npx grounded-rag-mcpTools
Tool | What it does |
| Chunk, embed, and index files or raw text into a named collection |
| Hybrid / dense / bm25 retrieval, per-stage scores |
| Grounded, cited answer via MCP sampling; refuses when nothing is found |
| List collections and chunk counts |
| hitRate / mrr / recallAtK on labeled cases |
Also exposes a resource (rag://collections) and a prompt (grounded_answer).
Use it with an MCP host (e.g. Claude Desktop)
{
"mcpServers": {
"grounded-rag": {
"command": "npx",
"args": ["-y", "grounded-rag-mcp"]
}
}
}Development
npm install
npm run lint && npm run format:check && npm run typecheck && npm run build && npm testLicense
MIT © Chetan C
Available Tools
5 toolsanswerA
Answer a question grounded in a collection, with citations. Retrieves relevant passages and asks the host's model (via MCP sampling) to answer using only those, citing them. Refuses (grounded=false) when nothing relevant is found.
Inputs: query (required), topK, collection.
evaluate_retrievalA
Measure retrieval quality on labeled cases: hitRate, mrr, recallAtK. Each case is {query, relevantSources}. Use it to quantify quality and catch regressions.
Inputs: cases (required), mode, topK, collection.
ingest_documentsB
Ingest documents into a named collection so they can be searched. Provide paths (files/dirs of .txt/.md) and/or texts (raw strings). Returns chunks added and total.
Inputs: paths, texts, chunkSize, collection, +1 more.
list_collectionsA
List all ingested collections and how many chunks each contains.
Inputs: no named parameters.
searchA
Search a collection and return the most relevant chunks, each with its source and per-stage scores. mode: hybrid (default) | dense | bm25. Empty result = not in the docs.
Inputs: query (required), mode, topK, collection.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct role: ingest_documents adds content, search retrieves chunks, list_collections inspects collections, answer produces grounded responses with citations, and evaluate_retrieval measures quality. There is no meaningful overlap that would cause an agent to select the wrong tool.
Most tool names follow a clear verb_noun pattern like ingest_documents, list_collections, and evaluate_retrieval. search and answer are single verbs but are still intuitive and consistent in style, creating only minor deviation.
Five tools is well-scoped for a grounded RAG server: ingestion, listing, retrieval, grounded answering, and evaluation. Each tool earns its place without redundancy or bloat.
The core RAG workflow is covered end-to-end, including ingestion, retrieval, grounded answering, and retrieval evaluation. The main gap is the lack of deletion or update operations for documents and collections, which agents would need for full lifecycle management.
Maintenance
Related MCP Connectors
Ingest, manage, and retrieve documents for RAG-powered AI applications
Private, multimodal knowledge store for agents: hybrid search with cited, provenance-backed results.
1Cloud or self-hosted knowledge for AI agents: hybrid search, reranking, GraphRAG, scoped MCP tools.
Build a RAG pipeline station by station and search your own documents with cited answers.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI-powered querying of PDF documents using hybrid retrieval (BM25 + vector search) and retrieval-augmented generation, returning structured answers with source citations and confidence scores.-
- FlicenseNot gradedqualityDmaintenanceEnables searching a knowledge base and asking grounded questions with hybrid retrieval, reranking, and cited answers.-
- FlicenseNot gradedqualityCmaintenanceEnables document indexing and question answering with Retrieval-Augmented Generation, providing cited answers from user-supplied documents.-
- AlicenseAqualityCmaintenanceEnables any MCP host to search and answer over your own documents with hybrid BM25+dense retrieval, cross-encoder reranking, and grounded, cited responses that refuse when no evidence is found.5MIT