spring-ai-mcp-server-demo

Ramzus/spring-ai-mcp-server-demo

3.2

If you are the rightful owner of spring-ai-mcp-server-demo and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This document provides a structured summary of a Model Context Protocol (MCP) server example for an Agentic AI demo.

πŸš€ Agentic AI Demo - Smart Business Platform

Transform your business operations with AI-powered automation!

Welcome to a cutting-edge demonstration of how AI agents can seamlessly integrate with real business applications. This platform showcases a complete microservices ecosystem where AI assistants (like Claude or GitHub Copilot) can directly manage orders, process payments, and handle incidents through natural conversation.

✨ What Makes This Special?

πŸ€– Talk to Your Business System: Use natural language to manage orders, payments, and incidents
⚑ Real-Time Operations: AI agents perform actual business operations, not just mock data
πŸ”§ Production-Ready: Built with enterprise-grade technologies and best practices
🎯 Plug & Play: Easy setup with Docker - get running in minutes
🌐 Modern Stack: Vue.js frontends, Spring Boot APIs, and intelligent MCP servers

πŸ“‹ Quick Overview

ServiceWhat It DoesFrontendAPI
πŸ“¦ OrdersManage customer orders & lifecyclelocalhost:5173localhost:8081
πŸ’³ PaymentsProcess payments & transactionslocalhost:5174localhost:8082
🚨 IncidentsTrack issues & resolutionslocalhost:5175localhost:8083
🧠 AI AssistantSmart automation layer-localhost:8085

πŸ—οΈ System Architecture

    πŸ–₯️ Frontend Apps (Vue.js + TypeScript)
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚   Orders    β”‚  β”‚  Payments   β”‚  β”‚  Incidents  β”‚
    β”‚   :5173     β”‚  β”‚   :5174     β”‚  β”‚   :5175     β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚                β”‚               β”‚
    ⚑ REST APIs (Spring Boot + Java)
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ Order API   β”‚  β”‚Payment API  β”‚  β”‚Incident API β”‚
    β”‚   :8081     β”‚  β”‚   :8082     β”‚  β”‚   :8083     β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚                β”‚               β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
    πŸ€– AI Integration Layer
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚     MCP Servers         β”‚
           β”‚   (AI ↔ Business)       β”‚
           β”‚       :8085             β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
    πŸ’Ύ Data Layer
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚      MongoDB            β”‚
           β”‚   (Document Store)      β”‚
           β”‚       :27017            β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Get Started in 3 Minutes!

Prerequisites βœ…

  • Docker Desktop installed and running
  • Available ports: 5173-5175, 8081-8083, 8085, 27017

1️⃣ Launch Everything

# Navigate to project directory
cd agentic-ai-demo

# πŸš€ Start all services (this might take 2-3 minutes first time)
docker-compose up --build -d

# βœ… Check everything is running
docker-compose ps

2️⃣ Verify It's Working

Open these links to confirm services are up:

3️⃣ Explore Sample Data

The platform comes pre-loaded with realistic business data:

  • 8 sample orders in various stages (new β†’ processing β†’ shipped β†’ delivered)
  • 4 payment records with different statuses
  • 5 incident tickets with varying priorities

πŸŽ‰ You're ready! Your complete business platform is now running!

πŸ› οΈ Management Commands

Essential Operations

# πŸ›‘ Stop everything
docker-compose down

# πŸ”„ Restart a specific service  
docker-compose restart order-backend

# πŸ“œ View logs for debugging
docker-compose logs -f [service-name]

# 🧹 Clean slate (removes all data)
docker-compose down --volumes

# πŸ—‘οΈ Complete cleanup (removes images too)
docker-compose down --volumes --rmi all

Health Monitoring

All services include smart health checks:

  • βœ… Auto-healing: Unhealthy containers restart automatically
  • ⏱️ Quick detection: Issues detected within 30 seconds
  • πŸ”„ Retry logic: 3 attempts before marking as failed

Check health status: docker-compose ps

🧰 Technology Stack

πŸ–₯️ Frontend Technologies
  • Vue.js 3 - Modern reactive framework with Composition API
  • TypeScript - Type-safe development with excellent IDE support
  • Vite - Lightning-fast build tool and hot reload
  • CSS3 - Modern styling with responsive design
βš™οΈ Backend Technologies
  • Spring Boot - Enterprise Java framework with auto-configuration
  • H2 Database - Embedded SQL database for rapid development
  • MongoDB - Document database for flexible data structures
  • Gradle - Advanced build automation and dependency management
πŸš€ Infrastructure & DevOps
  • Docker - Containerization for consistent environments
  • Docker Compose - Multi-container orchestration
  • Health Checks - Built-in monitoring and auto-recovery
  • Multi-stage Builds - Optimized container images
πŸ€– AI Integration
  • Model Context Protocol (MCP) - Standard for AI-app integration
  • REST APIs - HTTP-based service communication
  • Spring Boot Actuator - Production monitoring endpoints

πŸ€– Connect Your AI Assistant

The real magic happens when you connect AI assistants to control your business operations through conversation!

πŸ”§ Quick Setup for VS Code

  1. Build the MCP servers (one-time setup):
# Build both MCP server JAR files
./gradlew :mcp-servers:oms-mcp-server:build
./gradlew :mcp-servers:incident-mcp-server:build
  1. Configure VS Code - Add to your settings.json:
{
  "mcp": {
    "servers": {
      "oms-mcp-server": {
        "type": "stdio",
        "command": "java",
        "args": ["-jar", "YOUR_PROJECT_PATH/mcp-servers/oms-mcp-server/build/libs/oms-mcp-server-0.0.1-SNAPSHOT.jar"]
      },
      "incident-mcp-server": {
        "type": "stdio", 
        "command": "java",
        "args": ["-jar", "YOUR_PROJECT_PATH/mcp-servers/incident-mcp-server/build/libs/incident-mcp-server-0.0.1-SNAPSHOT.jar"]
      }
    }
  },
  "chat.mcp.discovery.enabled": true
}
  1. Replace YOUR_PROJECT_PATH with your actual project path.

πŸ’¬ Talk to Your Business System

Once connected, try these natural language commands:

What You SayWhat Happens
"Show me all pending orders"πŸ“‹ Lists orders waiting to be processed
"Create a payment for order #1001 for $150"πŸ’³ Processes a new payment transaction
"What high-priority incidents are open?"🚨 Filters critical issues needing attention
"Move order #1001 to the next stage"⚑ Advances order through workflow
"Show me all failed payments"πŸ’Έ Displays transactions that need retry

πŸ’‘ Pro Tip: The AI maintains full business context and validates operations, so you can have natural conversations about complex business workflows!

❓ Troubleshooting

🚨 Services won't start

Problem: docker-compose up fails or services show as unhealthy

Solutions:

# Check if ports are already in use
lsof -i :5173 -i :8081 -i :8082 -i :8083 -i :8085 -i :27017

# Clean up any existing containers
docker-compose down --volumes
docker system prune -f

# Restart Docker Desktop and try again
docker-compose up --build -d
πŸ”Œ Can't connect to AI assistants

Problem: MCP servers not recognized by VS Code or Claude

Solutions:

  1. Verify JAR files exist:

    ls -la mcp-servers/*/build/libs/*.jar
    
  2. Rebuild if missing:

    ./gradlew :mcp-servers:oms-mcp-server:build
    ./gradlew :mcp-servers:incident-mcp-server:build
    
  3. Check VS Code settings path - Use absolute paths in settings.json

  4. Restart VS Code after configuration changes

πŸ’Ύ Data not persisting

Problem: Sample data disappears after restart

Solution: This is expected behavior. The H2 databases are in-memory for demo purposes. MongoDB data persists in Docker volumes.

🎯 What's Next?

Ready to extend this platform? Here are some ideas:

  • πŸ” Add Authentication - Implement user login and role-based access
  • πŸ“§ Email Notifications - Send alerts for order status changes
  • πŸ“Š Analytics Dashboard - Add business intelligence and reporting
  • πŸ”„ Event Streaming - Implement Apache Kafka for real-time events
  • πŸ§ͺ Testing Suite - Add comprehensive integration tests
  • 🌍 Multi-tenancy - Support multiple organizations

πŸ“ž Support & Contributing

  • πŸ› Found a bug? Open an issue with detailed reproduction steps
  • πŸ’‘ Have an idea? We'd love to hear your suggestions
  • 🀝 Want to contribute? Check out our contribution guidelines
  • πŸ“š Need help? Join our community discussions

🌟 Star this repo if you found it helpful!

Built with ❀️ for the AI development community