Skip to content

Latest commit

 

History

History
163 lines (111 loc) · 5.52 KB

File metadata and controls

163 lines (111 loc) · 5.52 KB

Event Recommendation Chatbot

Status Github Action CI Workflow Status

A chatbot application that recommends events based on user preferences and location, using Spring Boot, LangGraph, Model Context Protocol (MCP), and Angular.

Architecture Diagram

Overview

This application demonstrates the use of the Tanzu Platform for Cloud Foundry's GenAI capabilities to create an intelligent event recommendation chatbot. It leverages the following technologies:

  • Backend: Java 17, Spring Boot 3.2, Spring AI
  • Agent Orchestration: LangGraph4j
  • External Integration: Model Context Protocol (MCP), API Ninjas Cities API
  • Frontend: Angular 17
  • Deployment: Tanzu Platform for Cloud Foundry

Features

  • Conversational Interface: Natural language chat interface for users to inquire about events
  • City Information: Integration with Cities API to provide information about cities
  • Event Recommendations: Integration with Ticketmaster API via MCP to provide relevant event recommendations
  • Intelligent Agent: LangGraph-powered agent that maintains conversation context and provides coherent responses

Repository Structure

java-spring-langgraph-mcp-angular/
├── backend/                      # Spring Boot backend application
│   ├── src/                      # Source code
│   │   ├── main/
│   │   │   ├── java/...          # Java code
│   │   │   └── resources/        # Configuration files
│   │   └── test/                 # Test code
│   └── README.md                 # Backend documentation
├── frontend/                     # Angular frontend application
│   ├── src/                      # Source code
│   │   ├── app/                  # Angular components, services, etc.
│   │   ├── assets/               # Static assets
│   │   └── environments/         # Environment configurations
│   └── README.md                 # Frontend documentation
├── scripts/                      # Utility scripts
│   └── deploy-to-tanzu.sh        # Deployment script
├── IMPLEMENTATION.md             # Implementation details
├── manifest.yml                  # Cloud Foundry manifest
└── pom.xml                       # Maven project configuration

Prerequisites

  • Java 17 or later
  • Node.js 20 or later and npm
  • Maven 3.8 or later
  • Cloud Foundry CLI for deployment
  • Ticketmaster API key
  • API Ninjas API key

Quick Start

Local Development

  1. Clone the repository:
git clone <repository-url>
cd java-spring-langgraph-mcp-angular
  1. Set up environment variables:
export TICKETMASTER_API_KEY=your-api-key
export CITIES_API_KEY=your-api-key
  1. Build and run the application:
mvn clean install
cd backend
mvn spring-boot:run
  1. Access the application:

Open your browser and navigate to http://localhost:8080

Deployment to Tanzu Platform for Cloud Foundry

  1. Log in to your Tanzu Platform for Cloud Foundry environment:
cf login -a <api-endpoint> --sso
  1. Run the deployment script:
./scripts/deploy-to-tanzu.sh

Implementation Details

The application is built using Spring Boot for the backend and Angular for the frontend. It integrates with the Ticketmaster API using the Model Context Protocol (MCP) and the API Ninjas Cities API to provide event recommendations and city information.

The chatbot agent is built using LangGraph4j, which provides a framework for creating stateful, multi-step conversation flows. The agent understands user intent, fetches city information, searches for events, and generates natural language responses.

For more details, see the IMPLEMENTATION.md file.

Configuration

Backend Configuration

Backend configuration is managed through application.properties and environment-specific properties files. Key configuration properties include:

  • spring.ai.mcp.client.stdio.connections.ticketmaster: Ticketmaster MCP configuration
  • cities.api.url, cities.api.key: Cities API configuration
  • spring.ai.openai: OpenAI configuration for direct LLM usage (optional)

See the backend README for more details.

Frontend Configuration

Frontend configuration is managed through Angular environment files. Key configuration includes:

  • apiUrl: Backend API URL

See the frontend README for more details.

Developer Guide

Adding New Features

  1. Backend: Extend the relevant Spring components and update the LangGraph agent as needed.
  2. Frontend: Add new Angular components and update the services to interact with the backend.

Testing

Run backend tests with Maven:

mvn test

Run frontend tests with Angular CLI:

cd frontend
npm test

License

This project is licensed under the MIT License.

Acknowledgments