Skip to main content
Glama
mamq144

KoboldCpp RAG MCP Server

by mamq144

# KoboldCpp RAG MCP Server | خادم استرجاع المعرفة لـ KoboldCpp عبر بروتوكول MCP

An enterprise-grade, privacy-first Retrieval-Augmented Generation (RAG) server designed specifically for KoboldCpp. It leverages the Model Context Protocol (MCP) and ChromaDB to grant local Large Language Models direct semantic access to private documents with zero data leaks.

خادم استرجاع معرفة وتوليد معزز (RAG) عالي الأداء ومحلي بالكامل، مصمم لربط نماذج الذكاء الاصطناعي داخل KoboldCpp بمستنداتك وملفاتك الخاصة عبر بروتوكول MCP وقاعدة ChromaDB المتجهة بأمان وخصوصية تامة 100%.

---

## Key Highlights | أبرز المزايا التقنية

- Multi-Format Ingestion: Full text and tabular parsing for PDF, DOCX, XLSX, XLS, CSV, TXT, and Markdown files.

  (دعم شامل لمختلف الصيغ: قراءة واستخراج النصوص والجداول من ملفات الـ PDF، الوورد، الإكسل، ملفات القيم المفصولة بفواصل، والنصوص الخام).

- Local Embedding Engine: Employs sentence-transformers/all-MiniLM-L6-v2 locally via Hugging Face and ONNX runtimes.

  (معالجة متجهات محلية سريعة بالاعتماد على نموذج التضمين القياسي دون الحاجة لطلب واجهات سحابية).

- Persistent Vector Storage: Powered by ChromaDB with persistent disk serialization in a dedicated vector space.

  (تخزين متجهي دائم ومفهرس دلالياً يضمن حفظ المقاطع وقراءتها فورياً من القرص الصلب).

- Autonomous Tool Calling: Directly integrated into KoboldCpp's tool system, allowing models to index files or query context autonomously during conversations.

  (استدعاء ذاتي للأدوات: يستطيع النموذج استكشاف قاعدة المعرفة وفهرسة الملفات الجديدة استجابة لطلب المستخدم داخل المحادثة).

- Zero Data Leakage: All processing, chunking, embedding, and vector querying are confined to the host machine.

  (أمان مطلق وخصوصية كاملة: لا يتم إرسال أي ملف أو متجه إلى الإنترنت).

---

## Architecture & MCP Tools | بنية السيرفر والأدوات المتاحة

The server implements two primary MCP functions executed via standard I/O (stdio):

1. index_documents:

  - Scans the documents/ directory.

  - Cleans and extracts text depending on file extensions.

  - Chunks text into 500-token windows with 50-token overlap to maintain coherence.

  - Generates vector embeddings and upserts data into data_db/.

  - (مسح مجلد المستندات، استخراج المحتوى، تقسيمه إلى مقاطع متداخلة لضمان الترابط الدلالي، ثم تحديث قاعدة المتجهات).

2. query_knowledge_base:

  - Takes a search query string and a top_k retrieval parameter.

  - Computes query embeddings and executes semantic similarity searches.

  - Returns matched chunks enriched with source document metadata.

  - (استقبال استفسارات المستخدم، مطابقتها دلالياً مع المقاطع المخزنة، وإرجاع أدق الفقرات مع الإشارة لاسم المصدر).

---

## Directory Structure | هيكلية المشروع

RAG_KoboldCpp/

├── documents/ # Drop your PDFs, Word, and Excel files here

├── data_db/ # Persistent ChromaDB vector storage (Git-ignored)

├── server.py # Core MCP RAG server implementation

├── test_rag.py # Standalone verification and indexing utility

├── run_mcp.bat # Automated environment launcher for KoboldCpp

├── mcp_config.json # MCP client configuration schema for KoboldCpp

├── requirements.txt # Pinned dependency manifest

└── .gitignore # Security exclusions (guards data_db and private files)

---

## Installation & Setup | خطوات التثبيت والتشغيل

1. Clone the Repository | استنساخ المستودع:

  git clone https://github.com/mamq144/KoboldCpp-RAG-MCP.git

  cd KoboldCpp-RAG-MCP

2. Prepare Virtual Environment | إعداد البيئة الافتراضية:

  python -m venv venv

  venv\Scripts\activate

3. Install Dependencies | تثبيت المكتبات:

  pip install -r requirements.txt

4. Index Your Knowledge Base | إضافة المستندات وفهرستها:

  - Place any documents (.pdf, .docx, .xlsx, .txt, etc.) inside the documents folder.

  - Run the manual indexing check:

  python test_rag.py

---

## KoboldCpp Integration | الربط مع KoboldCpp

Option A: Via Command Line (CLI)

Run your KoboldCpp instance with the --mcp flag pointing directly to your JSON configuration:

koboldcpp.exe --model your_model.gguf --gpulayers -1 --mcp "E:\RAG_KoboldCpp\mcp_config.json"

Option B: Via Web GUI (Settings)

1. Launch KoboldCpp and open http://localhost:5001.

2. Navigate to Settings -> Tools -> MCP Tool Calling.

3. Ensure "Enable Toolcalling" and "Automatically Execute Tools" are checked.

4. Verify that "index_documents" and "query_knowledge_base" are listed and enabled.

---

## License | الترخيص

Distributed under the MIT License. See LICENSE for more information.

مرخص تحت مظلة رخصة MIT المفتوحة.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    An MCP server that enables AI assistants to perform semantic searches over local document collections using multi-context organization and automatic OCR. It supports various file formats including PDF, DOCX, and images, ensuring all data processing remains local and private.
    7
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Provides local Retrieval-Augmented Generation (RAG) capabilities using Ollama for embeddings and ChromaDB for vector storage. It enables users to ingest and perform semantic searches across PDF, Markdown, and TXT documents within MCP-compatible clients.
    4
    48
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Local-first RAG indexing and semantic search MCP server. Enables document retrieval and context-aware queries using local embedding models.
    3
    16
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    A local-first document retrieval MCP server that enables AI coding tools like Codex to search private local documents via semantic search and keyword boost, supporting ingestion of PDF, DOCX, TXT, Markdown, and HTML files.
    7
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mamq144/KoboldCpp-RAG-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server