rag-mcp-server
RAG document search MCP server that allows AI assistants to search a local document set and retrieve grounded passages via keyword (SQLite FTS5) or semantic (Chroma) backends.
README
RAG Document Search — MCP Server
A retrieval-augmented-generation backend that lets AI assistants search a
document set and answer questions grounded in real sources. It's exposed as a
Model Context Protocol (MCP) server, so any MCP-compatible client can call
its search tool.
Two interchangeable backends:
- SQLite FTS5 keyword search — the default, zero heavy dependencies.
- Chroma vector database — semantic search (
RAG_BACKEND=chroma).
Clean-room implementation written from scratch to demonstrate RAG + MCP engineering. Ships with no documents or data — you add your own.
How it works
documents/ ──▶ chunker ──▶ index (FTS5 or Chroma)
│
MCP client ──(search)──▶ server.py ──▶ ranked passages
▲
ingest.py --incremental ──┘ only re-indexes changed files
Quick start
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# 1) add your own .md/.txt files to ./documents (none are included)
# 2) build the index
python ingest.py --rebuild
# 3) run the MCP server (stdio transport)
python server.py
Semantic mode instead of keyword:
pip install chromadb
RAG_BACKEND=chroma python ingest.py --rebuild
RAG_BACKEND=chroma python server.py
Register with an MCP client
{
"mcpServers": {
"rag-search": {
"command": "/absolute/path/.venv/bin/python",
"args": ["/absolute/path/server.py"]
}
}
}
Configuration
All tunables are in config.py: DOCS_DIR, BACKEND, CHUNK_SIZE,
CHUNK_OVERLAP, DEFAULT_TOP_K. The document directory can also be set with the
RAG_DOCS_DIR environment variable.
Design notes
- Incremental ingestion: a manifest of file hashes means only new/edited files are re-processed — cheap to keep the index current (e.g. from CI or a timer).
- Pluggable backends behind one
get_store()factory: swap keyword ↔ vector search without touching the server or ingester. - Word-aligned overlapping chunks so passages stay readable and answers aren't split across a boundary.
Tests
python tests/test_chunker.py
python tests/test_store.py
# or: pytest -q
Tests use synthetic, generated text only — no datasets are bundled.
License
MIT © 2026 Wei-Ting Yen
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.