Skip to main content
Glama
bengaly

MCP Enterprise Demo - Gestion Commerciale

by bengaly

MCP Enterprise Demo - Gestion Commerciale avec IA

🎯 Présentation

Ce projet démontre l'intégration de MCP (Model Context Protocol) dans un Système d'Information d'entreprise pour la gestion commerciale (Commandes, Factures, Clients).

Objectif : CrΓ©er un assistant IA interne capable de :

  • RΓ©pondre Γ  des questions mΓ©tier en langage naturel

  • Analyser commandes et factures

  • RΓ©sumer l'activitΓ© d'un client

  • DΓ©clencher des actions contrΓ΄lΓ©es

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ UTILISATEUR β”‚ β”‚ (Support / Manager / Admin) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ ASSISTANT IA (LLM) β”‚ β”‚ (Spring AI + OpenAI/Claude) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ MCP SERVER β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ CAPACITΓ‰S MCP (Tools) β”‚ β”‚ β”‚ β”‚ β€’ findOrder β€’ analyzeInvoice β”‚ β”‚ β”‚ β”‚ β€’ summarizeCustomer β€’ createOrder β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ SΓ‰CURITΓ‰ & GOUVERNANCE β”‚ β”‚ β”‚ β”‚ β€’ ContrΓ΄le d'accΓ¨s (RBAC) β€’ Audit des appels β”‚ β”‚ β”‚ β”‚ β€’ Validation mΓ©tier β€’ TraΓ§abilitΓ© β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ SERVICES MΓ‰TIERS β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ OrderService β”‚ β”‚InvoiceService β”‚ β”‚CustomerServiceβ”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ BASE DE DONNΓ‰ES β”‚ β”‚ (H2 en mΓ©moire pour la dΓ©mo) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ” RΓ΄les et CapacitΓ©s

RΓ΄le

findOrder

analyzeInvoice

summarizeCustomer

createOrder

validateOrder

SUPPORT

βœ…

βœ…

βœ…

❌

❌

MANAGER

βœ…

βœ…

βœ…

βœ…

βœ…

ADMIN

βœ…

βœ…

βœ…

βœ…

βœ…

πŸš€ DΓ©marrage rapide

PrΓ©requis

  • Java 17+

  • Maven 3.8+

  • (Optionnel) ClΓ© API OpenAI pour le LLM

Installation

# Cloner le projet cd mcp-enterprise-demo # Compiler mvn clean install # Lancer l'application mvn spring-boot:run

Configuration OpenAI (optionnel)

export OPENAI_API_KEY=votre-clΓ©-api

πŸ“‘ Endpoints de test

Authentification

Utilisateurs de dΓ©monstration :

  • support / support123 (rΓ΄le SUPPORT)

  • manager / manager123 (rΓ΄le MANAGER)

  • admin / admin123 (rΓ΄le ADMIN)

Tester les capacitΓ©s MCP

# Rechercher une commande curl -u manager:manager123 http://localhost:8080/api/chat/test/find-order/CMD-20240115-TC001 # Analyser une facture curl -u support:support123 http://localhost:8080/api/chat/test/analyze-invoice/FAC-2024-000123 # RΓ©sumΓ© client curl -u support:support123 http://localhost:8080/api/chat/test/customer-summary/CLI-001 # Voir les capacitΓ©s disponibles curl -u manager:manager123 http://localhost:8080/api/chat/capabilities

Tester via LLM (OpenAI / Spring AI)

L'endpoint POST /api/chat/llm/message envoie le message au LLM (via Spring AI) et autorise l'appel des tools MCP selon le rΓ΄le courant.

Important : pour conserver le contexte (ex: workflow de confirmation), utilisez un conversationId et rΓ©utilisez-le Γ  chaque tour.

Sous PowerShell, utilisez curl.exe (car curl est un alias de Invoke-WebRequest).

# 1) Premier message (le serveur renvoie un conversationId) curl.exe -u manager:manager123 -H "Content-Type: application/json" -d "{\"message\":\"CrΓ©e une commande pour CLI-001 avec 2 articles (P-001 x2, P-002 x1)\"}" http://localhost:8080/api/chat/llm/message # 2) Confirmer (rΓ©utiliser le conversationId reΓ§u Γ  l'Γ©tape 1) curl.exe -u manager:manager123 -H "Content-Type: application/json" -d "{\"message\":\"Oui je confirme\",\"conversationId\":\"<COLLER_ICI>\"}" http://localhost:8080/api/chat/llm/message

Si l'utilisateur n'a pas les droits (ex: rΓ΄le SUPPORT), le LLM est informΓ© des capacitΓ©s autorisΓ©es et doit refuser l'action au lieu d'appeler un tool non autorisΓ©.

Console H2

AccΓ©dez Γ  http://localhost:8080/h2-console pour explorer la base de donnΓ©es.

  • JDBC URL: jdbc:h2:mem:enterprisedb

  • User: sa

  • Password: (vide)

πŸ“ Structure du projet

src/main/java/com/enterprise/mcp/ β”œβ”€β”€ McpEnterpriseApplication.java # Point d'entrΓ©e β”œβ”€β”€ domain/ β”‚ β”œβ”€β”€ entity/ # EntitΓ©s JPA β”‚ β”‚ β”œβ”€β”€ Customer.java β”‚ β”‚ β”œβ”€β”€ Order.java β”‚ β”‚ β”œβ”€β”€ OrderLine.java β”‚ β”‚ β”œβ”€β”€ Invoice.java β”‚ β”‚ └── InvoiceLine.java β”‚ └── repository/ # Repositories Spring Data β”œβ”€β”€ service/ β”‚ β”œβ”€β”€ CustomerService.java # Service mΓ©tier clients β”‚ β”œβ”€β”€ OrderService.java # Service mΓ©tier commandes β”‚ β”œβ”€β”€ InvoiceService.java # Service mΓ©tier factures β”‚ └── dto/ # Objets de transfert β”œβ”€β”€ mcp/ β”‚ β”œβ”€β”€ McpCapabilityHandler.java # Gestionnaire des capacitΓ©s β”‚ β”œβ”€β”€ McpResponse.java # RΓ©ponse standardisΓ©e β”‚ └── McpToolsConfiguration.java # Configuration Spring AI β”œβ”€β”€ security/ β”‚ β”œβ”€β”€ McpRole.java # DΓ©finition des rΓ΄les β”‚ β”œβ”€β”€ McpCapability.java # Enum des capacitΓ©s β”‚ β”œβ”€β”€ McpSecurityContext.java # Contexte de sΓ©curitΓ© β”‚ └── McpAccessDeniedException.java # Exception accΓ¨s refusΓ© β”œβ”€β”€ audit/ β”‚ └── McpAuditService.java # Service d'audit β”œβ”€β”€ config/ β”‚ β”œβ”€β”€ SecurityConfig.java # Configuration Spring Security β”‚ └── DataInitializer.java # DonnΓ©es de dΓ©monstration └── controller/ └── ChatController.java # API REST

πŸŽ“ Formation associΓ©e

Ce projet est accompagné d'une formation complète en Markdown : → Voir le dossier docs/formation/

⚠️ Points clés MCP

Ce que MCP fait

  • βœ… Expose des capacitΓ©s mΓ©tier contrΓ΄lΓ©es Γ  l'IA

  • βœ… Applique la sΓ©curitΓ© par rΓ΄le (RBAC)

  • βœ… Audite toutes les interactions IA

  • βœ… Valide les donnΓ©es cΓ΄tΓ© serveur

  • βœ… Demande confirmation pour les actions sensibles

Ce que MCP ne fait pas

  • ❌ L'IA n'accΓ¨de jamais directement Γ  la base de donnΓ©es

  • ❌ Pas d'exΓ©cution de code arbitraire

  • ❌ Pas de contournement des rΓ¨gles mΓ©tier

πŸ“œ Licence

Projet de dΓ©monstration Γ  usage pΓ©dagogique.

πŸ‘€ Auteur

Projet créé pour la formation "MCP pour ingénieurs Java".

-
security - not tested
F
license - not found
-
quality - not tested

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/bengaly/mcp-gestion-commerciale-demo'

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