Skip to main content
Glama

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

activated_rag

Outil maître pour l'indexation automatique

injection_rag, index_project, update_project, analyse_code

recherche_rag

Outil de recherche avancée

search_code

🎯 Avantages de v2.0

  1. Simplification radicale : 2 outils au lieu de 6

  2. Automatisation complète : Détection VS Code + file watcher intégrés

  3. Intelligence native : Chunking intelligent par type de contenu

  4. Rétrocompatibilité totale : Les anciens outils fonctionnent toujours (masqués)

  5. Pipeline automatisé : Phase 0 → scan → analyse → chunking → embeddings → injection

Related MCP server: Code Graph Knowledge System

🏗️ 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 RAG

Fonctionnalité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 test

Tests 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_rag

  • 9 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_projects

  • Accessibles : 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 automatique

  • logs/recherche-rag.log : Recherches avancées

  • logs/phase0-events.log : Événements Phase 0

  • logs/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

🤝 Contribution

  1. Fork le projet

  2. Créer une branche (git checkout -b feature/amazing-feature)

  3. Commit les changements (git commit -m 'Add amazing feature')

  4. Push vers la branche (git push origin feature/amazing-feature)

  5. 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 automatique

  • Nouveau : recherche_rag - Recherche avancée avec filtres

  • Nouveau : 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 Ollama

  • Nouveau : Cache LLM (LlmCache) pour optimisation des performances

  • Nouveau : Configuration LLM dans rag-config.json avec fournisseurs et préparation

  • Nouveau : 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.ts pour segmentation intelligente

  • Nouveau : Intégration dans indexer.ts avec cache LLM

  • Nouveau : 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

Available Tools

13 tools
add_observationsB

Add new observations to existing entities in the knowledge graph

Inputs: observations (required).

create_entitiesB

Create multiple new entities in the knowledge graph

Inputs: entities (required).

create_relationsB

Create multiple new relations between entities in the knowledge graph. Relations should be in active voice

Inputs: relations (required).

delete_entitiesA

Delete multiple entities and their associated relations from the knowledge graph

Inputs: entityNames (required).

delete_observationsB

Delete specific observations from entities in the knowledge graph

Inputs: deletions (required).

delete_relationsA

Delete multiple relations from the knowledge graph

Inputs: relations (required).

injection_ragC

Analyse du projet complet + prépare et injecte les données automatiquement (Phase 0 → RAG)

Inputs: project_path (required), file_patterns, recursive, log_level, +1 more.

manage_projectsC

Gérer et lister les projets indexés

Inputs: action, project_path.

open_nodesC

Open specific nodes in the knowledge graph by their names

Inputs: names (required).

read_graphC

Read the entire knowledge graph

Inputs: no named parameters.

search_codeC

Recherche sémantique dans le code indexé avec options RAG

Inputs: query (required), project_filter.

search_nodesC

Search for nodes in the knowledge graph based on a query

Inputs: query (required).

update_projectC

Mettre à jour l'indexation d'un projet (indexation incrémentale) avec options RAG

Inputs: project_path (required), file_patterns, recursive, embedding_provider, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 13 tools

    Disambiguation3/5

    Most tools have distinct purposes centered around knowledge graph operations, but there is some overlap between 'search_nodes' and 'search_code' that could cause confusion. Additionally, 'injection_rag' and 'update_project' both involve RAG indexing but differ in scope, which might lead to misselection if not carefully described.

    Naming Consistency2/5

    The naming is inconsistent with a mix of snake_case English verbs (e.g., 'add_observations', 'create_entities') and French terms (e.g., 'injection_rag', 'manage_projects'), and some tools use different verb styles like 'open_nodes' vs. 'read_graph'. This lack of a predictable pattern reduces clarity and usability.

    Tool Count4/5

    With 13 tools, the count is reasonable for a RAG and knowledge graph server, covering core operations like CRUD for entities, relations, and observations, as well as project management and search. It's slightly on the higher side but still well-scoped for the domain.

    Completeness4/5

    The tool set provides good coverage for knowledge graph management and RAG operations, including create, read, update, and delete functions for entities, relations, and observations. Minor gaps exist, such as no explicit tool for updating entities or relations, but agents can likely work around this using deletion and recreation.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables semantic code search across multiple repositories using AST-aware chunking and relationship tracking. Supports local LLM embeddings, real-time indexing, and cross-codebase dependency analysis through vector and graph databases.
      3
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Transforms code repositories and development documentation into a queryable Neo4j knowledge graph, enabling AI assistants to perform intelligent code analysis, dependency mapping, impact assessment, and automated documentation generation across 15+ programming languages.
      7
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides semantic code search and code insights via a knowledge graph, enabling AI to understand, navigate, and modify complex projects with deep dependency and architecture analysis.
      MIT