RAG Chatbot MCP Server
Exposes a local RAG document index as MCP tools (ask, search, rebuild_index, status) for MCP clients like Claude Desktop and Claude Code to query your documents over stdio.
README
RAG Chatbot
A small numpy-based vector index (vector_store.py) over your own documents — no compiled/native
dependencies beyond numpy, so it needs no admin rights to install. The LLM/embeddings backend is
pluggable via config.LLM_PROVIDER: "ollama" (100% local, no API key) or "gemini" (Google's
cloud API, needs a free key).
Setup
Provider: Gemini (config.py → LLM_PROVIDER = "gemini", the current default)
- Get a free API key from Google AI Studio.
- Set it as an environment variable (don't paste it into files or commit it):
# macOS/Linux
export GOOGLE_API_KEY="your-key-here"
# Windows PowerShell
$env:GOOGLE_API_KEY = "your-key-here"
Provider: Ollama (set LLM_PROVIDER = "ollama" in config.py)
- Install Ollama and pull the models used:
ollama pull nomic-embed-text
ollama pull llama3.1
Then, for either provider, install Python dependencies:
pip install -r requirements.txt
Usage — CLI
- Drop your files (
.pdf,.txt,.md,.docx,.csv,.xlsx) into thedocs/folder. - Build the index:
python ingest.py
- Chat:
python chat.py
Type exit to quit.
Usage — Web app (frontend + backend)
Runs a FastAPI backend that serves a JSON API and a static chat UI, all on one port.
python -m uvicorn server:app --reload --port 8000
Open http://localhost:8000 in a browser. From there you can:
- Upload files (drag/select, click Upload)
- Click Rebuild Index to (re)embed everything currently in
docs/ - Chat in the main panel — answers include source file names
API endpoints, if you want to script against it directly:
GET /api/status— index/model infoPOST /api/upload— multipart file upload, saved intodocs/POST /api/ingest— rebuilds the index fromdocs/POST /api/chat—{"question": "..."}→{"answer": "...", "sources": [...]}
Usage — MCP server
Exposes the document index as MCP tools (ask, search, rebuild_index, status) so any
MCP client (Claude Desktop, Claude Code, etc.) can query your docs. Runs over stdio - the
client launches it as a subprocess, no port involved.
Add it to your MCP client config, e.g. Claude Desktop's claude_desktop_config.json:
{
"mcpServers": {
"rag-chatbot": {
"command": "python",
"args": ["C:/Users/Nikita_Admin/Desktop/mcm/rag-chatbot/mcp_server.py"]
}
}
}
For Claude Code, run:
claude mcp add rag-chatbot -- python C:/Users/Nikita_Admin/Desktop/mcm/rag-chatbot/mcp_server.py
Restart the client afterward. The index must already exist (python ingest.py), or call the
rebuild_index tool from within the chat once files are in docs/.
Notes
- Re-run
python ingest.pyafter adding/changing files indocs/. It rebuildsindex.npzfrom scratch each time. - Change models or chunking behavior in
config.py. - Larger/more capable local models (e.g.
llama3.1:70b,mixtral) give better answers but need more RAM/VRAM — swapLLM_MODELinconfig.py. - The vector index is a single
index.npzfile (numpy arrays + JSON), fine for personal/small document sets. For large corpora, swapvector_store.pyfor a proper vector DB.
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.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
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.