RAG MCP Server
The RAG MCP Server is a Model Context Protocol server that combines knowledge graphs with Retrieval-Augmented Generation for intelligent code indexing, semantic search, and project management.
Core Capabilities:
Automated RAG Pipeline - Complete project analysis and injection into both knowledge graph (Phase 0) and RAG system with automatic LLM-powered intelligent analysis
Knowledge Graph Management - Create, read, update, and delete entities, relations, and observations with automatic knowledge enrichment during indexing
Semantic Code Search - Advanced semantic searches across indexed codebases with configurable similarity thresholds and project filtering
Incremental Updates - Re-index projects with configurable chunking and embeddings without full reprocessing
Project Management - List and view statistics for indexed projects
Advanced Features:
Intelligent LLM Analysis - Leverage Ollama for content summarization, keyword extraction, structure suggestion, entity detection, and complexity classification
Optimized Performance - Batch processing for LLM calls with intelligent caching (configurable TTL) for improved efficiency
Centralized Configuration - Unified configuration system (
rag-config.json) with validation, limits, and support for multiple embedding providers (fake, ollama, sentence-transformers) and LLM providersFlexible File Filtering - Exclude files from indexing using
.ragignorepatterns and customizable file patternsExtensible Architecture - Tool Registry system for automatic discovery, centralized management, and unified execution with backward compatibility
MCP Integration - Works with Model Context Protocol clients like Cline through standardized configuration
Supports Ollama as an embedding provider for semantic search and code indexing, allowing the use of models like nomic-embed-text for RAG functionality.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@RAG MCP Serversearch for authentication middleware in our user service project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
RAG MCP Server v2.0
Un serveur MCP (Model Context Protocol) avec architecture v2.0 simplifiée : 2 outils principaux pour l'indexation automatique et la recherche sémantique de code.
🚀 Nouvelle Architecture v2.0
📋 Outils Principaux (Simplifiés)
Outil | Description | Remplace |
| Outil maître pour l'indexation automatique |
|
| Outil de recherche avancée |
|
🎯 Avantages de v2.0
Simplification radicale : 2 outils au lieu de 6
Automatisation complète : Détection VS Code + file watcher intégrés
Intelligence native : Chunking intelligent par type de contenu
Rétrocompatibilité totale : Les anciens outils fonctionnent toujours (masqués)
Pipeline automatisé : Phase 0 → scan → analyse → chunking → embeddings → injection
🏗️ Architecture Technique
Pipeline activated_rag
activated_rag
├── Phase 0 : Détection projet VS Code
├── Scan fichiers & changements
├── Analyse statique multi-langage
├── Chunking intelligent
│ ├── Code : 1 fonction = 1 chunk
│ ├── Classes : N chunks
│ └── Documentation : par paragraphes
├── Calcul embeddings
│ ├── Code : nomic-embed-code
│ └── Texte : nomic-embed-text
└── Injection RAGFonctionnalités recherche_rag
Recherche hybride : Combinaison similarité sémantique + recherche textuelle
Filtres avancés : Par type de contenu, langage, extension, score
Re-ranking : Classement basé sur métadonnées (fraîcheur, taille, type)
Seuil dynamique : Adaptation automatique du seuil de similarité
📦 Installation
# Cloner le dépôt
git clone <repository-url>
cd rag-mcp-server
# Installer les dépendances
npm install
# Construire le projet
npm run build🚀 Utilisation Rapide
Indexation Automatique
// Utilisation simple avec activated_rag
const result = await toolRegistry.execute('activated_rag', {
project_path: '/chemin/vers/mon/projet',
enable_phase0: true // Détection automatique VS Code
});Recherche Avancée
// Recherche avec filtres
const results = await toolRegistry.execute('recherche_rag', {
query: 'comment implémenter l\'authentification',
scope: 'project',
top_k: 5,
filters: {
content_type: ['code', 'doc'],
language: ['typescript', 'javascript']
}
});🔧 Configuration v2.0
Configuration Principale
{
"version": "2.0.0",
"description": "Configuration RAG v2.0",
"system": {
"legacy_mode": true,
"exposed_tools": ["activated_rag", "recherche_rag"],
"legacy_tools": ["injection_rag", "index_project", "update_project", "search_code", "manage_projects"]
},
"defaults": {
"embedding_provider": "ollama",
"embedding_model": "nomic-embed-text",
"chunk_size": 1000,
"chunk_overlap": 200
},
"providers": {
"ollama": {
"description": "Ollama embeddings",
"models": {
"code": "nomic-embed-code",
"text": "nomic-embed-text"
}
}
}
}Migration depuis v1.0
# Migration automatique
npm run migrate-v2
# Vérification
npm run test-retrocompatibility🧪 Tests
Tests v2.0
# Tests de rétrocompatibilité
npm run test:retrocompatibility
# Tests de performance
npm run test:performance
# Tous les tests
npm testTests Spécifiques
Tests de migration : Vérification de la rétrocompatibilité
Tests de performance : Benchmark nouveau vs ancien système
Tests d'intégration : Validation du pipeline complet
Tests de qualité : Validation des embeddings séparés
🛠️ Structure du Projet v2.0
rag-mcp-server/
├── src/
│ ├── config/
│ │ └── rag-config.ts # Gestionnaire de configuration v2.0
│ ├── core/
│ │ ├── tool-registry.ts # Système central d'enregistrement
│ │ ├── registry.ts # Enregistrement automatique v1.0
│ │ └── registry-v2.ts # Enregistrement automatique v2.0
│ ├── tools/
│ │ ├── graph/ # Outils de graphe de connaissances (9 outils)
│ │ └── rag/ # Outils RAG v2.0
│ │ ├── activated-rag.ts # Outil maître v2.0
│ │ ├── recherche-rag.ts # Recherche avancée v2.0
│ │ └── legacy/ # Outils legacy (masqués)
│ │ ├── injection-rag.ts
│ │ ├── index-project.ts
│ │ ├── update-project.ts
│ │ ├── search-code.ts
│ │ └── manage-projects.ts
│ ├── rag/ # Composants RAG avancés
│ │ ├── indexer.ts # Indexation avec chunking intelligent
│ │ ├── searcher.ts # Recherche sémantique avancée
│ │ ├── vector-store.ts # Stockage vectoriel v2.0
│ │ ├── vector-store-refactored.ts # Refactorisation embeddings par type
│ │ ├── phase0/ # Phase 0 : Détection automatique
│ │ │ ├── workspace-detector.ts
│ │ │ ├── file-watcher.ts
│ │ │ ├── event-logger.ts
│ │ │ ├── chunker-integration.ts
│ │ │ └── llm-enrichment/ # Enrichissement LLM
│ │ └── ai-segmenter.ts # Segmentation intelligente
│ └── index.ts # Point d'entrée principal
├── config/
│ ├── rag-config.json # Configuration v1.0 (rétrocompatible)
│ └── rag-config-v2.json # Configuration v2.0
├── docs/
│ ├── CONFIGURATION.md # Guide de configuration
│ ├── PHASE0_3_README.md # Documentation Phase 0
│ └── API_REFERENCE.md # Référence API
├── test/
│ ├── retrocompatibility-v2.test.ts # Tests rétrocompatibilité
│ └── phase0-llm-enrichment/ # Tests Phase 0
├── scripts/
│ ├── migrate-config-v2.js # Migration v1.0 → v2.0
│ └── migrate-rag-store.js # Migration données
└── package.json📊 Métriques v2.0
Outils Visibles
2 outils principaux :
activated_rag,recherche_rag9 outils graph : Graphe de connaissances (inchangés)
Total visible : 11 outils
Outils Masqués (Rétrocompatibilité)
5 outils legacy :
injection_rag,index_project,update_project,search_code,manage_projectsAccessibles : Via appel direct (rétrocompatibilité)
Performances
Initialisation : < 500ms
Indexation : 30-50% plus rapide avec chunking intelligent
Recherche : 20-40% plus précise avec embeddings séparés
Mémoire : Réduction de 25% avec cache optimisé
🔍 Dépannage
Problèmes Courants
Q : Les anciens outils ne fonctionnent plus ?
R : Activez legacy_mode: true dans la configuration.
Q : activated_rag ne détecte pas les changements ?
R : Vérifiez enable_phase0: true et les permissions du file watcher.
Q : Recherche avec scores bas ?
R : Ajustez filters.min_score ou utilisez le modèle approprié pour le type de contenu.
Q : Performances lentes ?
R : Réduisez chunk_size, utilisez embedding_provider: 'fake' pour les tests, désactivez enable_watcher.
📈 Monitoring
Logs Disponibles
logs/activated-rag.log: Indexation automatiquelogs/recherche-rag.log: Recherches avancéeslogs/phase0-events.log: Événements Phase 0logs/performance.log: Métriques de performance
Métriques Clés
const metrics = {
indexation: {
files_processed: number,
chunks_created: number,
embedding_time_ms: number,
total_time_ms: number
},
recherche: {
query_time_ms: number,
results_count: number,
avg_score: number,
cache_hit_rate: number
},
phase0: {
files_watched: number,
change_events: number,
auto_index_count: number
}
};🔮 Roadmap
v2.1 (Prochainement)
Intégration Tree-sitter : Analyse AST native
Cache distribué : Partage d'embeddings entre projets
API REST : Interface HTTP pour les outils
Plugins : Extensions personnalisables
v3.0 (Future)
Apprentissage automatique : Adaptation des paramètres
Collaboration : Partage d'index entre utilisateurs
Intégration CI/CD : Pipeline d'indexation automatisé
Dashboard : Interface web de monitoring
📚 Documentation Complète
GUIDE-NOUVEAUX-OUTILS-V2.md : Guide détaillé v2.0
CONFIGURATION.md : Guide de configuration
PHASE0_3_README.md : Documentation Phase 0
API_REFERENCE.md : Référence API
🤝 Contribution
Fork le projet
Créer une branche (
git checkout -b feature/amazing-feature)Commit les changements (
git commit -m 'Add amazing feature')Push vers la branche (
git push origin feature/amazing-feature)Ouvrir une Pull Request
📄 Licence
Ce projet est sous licence MIT. Voir le fichier LICENSE pour plus de détails.
🙏 Remerciements
Model Context Protocol pour le framework MCP
L'équipe de développement pour les contributions
La communauté open source pour les outils et bibliothèques utilisés
Dernière mise à jour : 13/01/2026
Version : 2.0.0
Statut : Production Ready avec Architecture Simplifiée 🚀
Compatibilité : Rétrocompatible avec v1.0.0
Changelog v2.0.0
Nouveau : Architecture simplifiée avec 2 outils principaux
Nouveau :
activated_rag- Outil maître pour indexation automatiqueNouveau :
recherche_rag- Recherche avancée avec filtresNouveau : Phase 0 intégrée (détection VS Code + file watcher)
Nouveau : Chunking intelligent par type de contenu
Nouveau : Embeddings séparés (code vs texte)
Nouveau : Système de registre v2.0 avec outils masqués
Nouveau : Tests de rétrocompatibilité complets
Nouveau : Scripts de migration v1.0 → v2.0
Nouveau : Documentation v2.0 complète
Amélioration : Performances 30-50% plus rapides
Amélioration : Précision de recherche 20-40% meilleure
Amélioration : Réduction mémoire de 25%
Rétrocompatibilité : Tous les outils v1.0 fonctionnent (masqués)
Changelog v1.5.0
Nouveau : Analyse LLM intelligente avec intégration Ollama
Nouveau : Service LLM (
LlmService) pour appels à l'API OllamaNouveau : Cache LLM (
LlmCache) pour optimisation des performancesNouveau : Configuration LLM dans
rag-config.jsonavec fournisseurs et préparationNouveau : Tâches intelligentes : résumé, extraction de mots-clés, suggestion de structure, détection d'entités, classification de complexité
Nouveau : Intégration dans
ai-segmenter.tspour segmentation intelligenteNouveau : Intégration dans
indexer.tsavec cache LLMNouveau : Tests de configuration LLM (
test-llm-config.js)Nouveau : Tests d'intégration Ollama (
test-ollama-integration.js)Amélioration : Support de multiples modèles Ollama configurables
Amélioration : Batch processing pour optimisation des appels LLM
Amélioration : Cache intelligent avec TTL configurable
Amélioration : Documentation complète des fonctionnalités LLM
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/ali-48/rag-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server