carsmcpserver

carsmcpserver

0

The Cars MCP Server is a Model Context Protocol server using Spring AI to handle interactions with a car wishlist, incorporating features like the ToolCallback API for customizable tool exposure. It includes functional elements like car retrieval by name or year and is configured using standard properties files.

Cars MCP Server

This project is an MCP (Model Context Protocol) server built using Spring AI. It features integration with Spring AI's ToolCallback API to provide methods for interacting with a car wishlist, represented by Amarpreet. The server includes components such as CarsmcpserverApplication, Car, and CarService, which encapsulate the structural and functional aspects of the application. The tool registration in the server enables methods like getCars(), getCar(), and getCarByYear() to be exposed as customizable tool callbacks, facilitating interaction through programmable or AI-driven interfaces. Configuration can be managed via an application.properties file, and the project is run using Maven and Java commands.

Project Structure

  • Organized with main Java and resource directories, featuring entry point and service tests.

ToolCallback API

  • Exposes methods from CarService class.
  • Tools are registered in CarsmcpserverApplication class.

CarService Methods

  • getCars(): Retrieves Amarpreet's wishlist of cars.
  • getCar(String name): Finds a car by model name.
  • getCarByYear(Integer year): Finds a car by build year.

Initialization

  • Preloads a list of cars using @PostConstruct.

How to Run

  • Build with Maven: mvn clean install.
  • Run the application: java -jar command.