MCP-RAGNAR
A local MCP server implementing Retrieval-Augmented Generation (RAG) with sentence window retrieval and support for multiple file types.
MCP-RAGNAR - a local RAG MCP Server
A local MCP server that implements RAG (Retrieval-Augmented Generation) with sentence window retrieval.
Features
- Document indexing with support for multiple file types (txt, md, pdf, doc, docx)
- Sentence window retrieval for better context understanding
- Configurable embedding models (OpenAI or local hugging face mode - i.e BAAI/bge-large-en-v1.5)
- MCP server integration for easy querying
Requirements
- Python 3.10+
- UV package manager
Installation
- Clone the repository:
git clone <repository-url>
cd mcp-ragnar
- Install dependencies using UV:
uv pip install -e .
Usage
Indexing Documents
You can index documents either programmatically or via the command line.
Indexing
python -m indexer.index /path/to/documents /path/to/index
# to change the default local embedding model and chunk size
python -m indexer.index /path/to/documents /path/to/index --chunk-size=512 --embed-model BAAI/bge-small-en-v1.5
# With OpenAI embedding endpoint (put your OPENAI_API_KEY in env)
python -m indexer.index /path/to/documents /path/to/index --embed-endpoint https://api.openai.com/v1 --embed-model text-embedding-3-small --tokenizer-model o200k_base
# Get help
python -m indexer.index --help
Running the MCP Server
Configuration
can be supplied as env var or .env file
EMBED_ENDPOINT: (Optional) Path to an OpenAI compatible embedding endpoint (ends with /v1). If not set, a local Hugging Face model is used by default.EMBED_MODEL: (Optional) Name of the embedding model to use. Default value of BAAI/bge-large-en-v1.5.INDEX_ROOT: The root directory for the index, used by the retriever. This is mandatory for MCP (Multi-Cloud Platform) querying.MCP_DESCRIPTION: The exposed name and description for the MCP server, used for MCP querying only. This is mandatory for MCP querying. For example: "RAG to my local personal documents"INDEX_ROOT: the root path of the index
in SSE mode it will listen to http://localhost:8001/ragnar
python server/sse.py
in stdio mode
install locally as an uv tool
uv tool install .
Claude Desktop:
Update the following:
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
Example :
{
"mcpServers": {
"mcp-ragnar": {
"command": "uvx",
"args": [
"mcp-ragnar"
],
"env": {
"OPENAI_API_KEY": "",
"EMBED_ENDPOINT": "https://api.openai.com/v1",
"EMBED_MODEL": "text-embedding-3-small",
"MCP_DESCRIPTION": "My local Rust documentation",
"INDEX_ROOT": "/tmp/index"
}
}
}
}
License
GNU General Public License v3.0
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
MCP Server AI extension
Provides AI extension capabilities via the Model Context Protocol.
Cloudflare Remote MCP Server
An example of deploying a customizable, remote MCP server on Cloudflare Workers without authentication.
Gurobi MCP
Solve optimization problems formulated by an LLM using the on-device Gurobi solver.
Osmosis Agent Toolkit
An MCP server for the Osmosis Agent Toolkit, enabling interactions with the Osmosis blockchain.
MCP Python REPL Server
An interactive Python REPL server with built-in support for the uv package manager and virtual environments.
CodebaseIQ Pro
Provides AI assistants with a comprehensive, one-time analysis for complete codebase context and understanding.
Web3 Assistant MCP
A secure, multi-chain toolkit for interacting with blockchain smart contracts.
JVM MCP Server
A server for monitoring and analyzing Java Virtual Machine (JVM) processes using Arthas, with a Python interface.
DreamFactory MCP
An MCP server for integrating with the DreamFactory API to manage and access data sources.
Civil 3D MCP
An MCP server for interacting with Autodesk Civil 3D, requiring a companion plugin and Node.js 18+.