claude-rag
MCP server that indexes Markdown files into a local SQLite vector store and provides semantic search tools for Claude Code.
README
claude-rag — MCP RAG Server for Markdown Knowledge Bases
MCP server that indexes a folder of .md files into a local SQLite vector store and exposes semantic search as Claude Code tools.
Stack: Python · sentence-transformers (all-MiniLM-L6-v2, ~90MB, CPU-only) · SQLite · MCP stdio
Tools exposed
| Tool | Description |
|---|---|
kb_search(query, top_k=5) |
Semantic search — returns top-K chunks with source file and section |
kb_reindex(force=False) |
Re-indexes files modified since last run (mtime-based) |
kb_stats() |
Shows indexed files, chunk counts, last update timestamps |
Setup
1. Clone
# Default layout: repo sits inside the KB folder
# KB files (.md) go in the parent directory
git clone https://github.com/sangelastro/claude-rag ~/.claude/my-kb/rag
Or clone anywhere and point to your KB folder via env var (see step 3).
2. Install dependencies
cd ~/.claude/my-kb/rag
pip install -r requirements.txt
On first run the model (all-MiniLM-L6-v2, ~90MB) is downloaded automatically from HuggingFace.
3. Register in Claude Code
Add to ~/.claude.json under mcpServers:
"my-kb": {
"command": "python",
"args": ["/absolute/path/to/rag/server.py"],
"env": {
"KB_RAG_DIR": "/absolute/path/to/your/kb/folder"
}
}
KB_RAG_DIR— folder containing your.mdfiles (default:../relative toserver.py)KB_RAG_DB— SQLite database path (default:kb.dbnext toserver.py)
If the repo is cloned inside the KB folder (as in the example above), both env vars can be omitted.
4. Restart Claude Code
The server starts automatically. On first launch it indexes all .md files in KB_RAG_DIR.
File structure
rag/
├── server.py # MCP server
├── requirements.txt
├── .gitignore
├── README.md
├── architecture.html # Technical documentation
└── kb_rag_slides.html # Architecture slide deck
kb.db is generated locally and excluded from git.
How it works
- Chunking — each
.mdfile is split on##headers; frontmatter is stripped - Embedding — chunks are encoded with
all-MiniLM-L6-v2(384 dimensions) - Storage — vectors stored as
float32BLOBs in SQLite (no external vector DB) - Search — cosine similarity computed in numpy over all chunks; top-K returned
- Invalidation — mtime-based: only modified files are re-indexed on startup
Environment variables
| Variable | Default | Description |
|---|---|---|
KB_RAG_DIR |
../ (relative to server.py) |
Folder with .md files to index |
KB_RAG_DB |
./kb.db (next to server.py) |
SQLite database path |
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.