How piomin/spring-ai-apps works
Project type and purpose
• This is a Spring Boot multi-module application demonstrating the Model Context Protocol (MCP) pattern via Spring AI.
• It consists of two MCP “server” microservices (account-mcp-service, person-mcp-service) exposing AI-powered Tools, and one MCP “client” application (sample-client) that calls them.
File structure
• Top level: pom.xml (parent POM), CI config, README.
• spring-ai-mcp/ subfolder with three Maven modules:
• account-mcp-service/
• person-mcp-service/
• sample-client/
• Each service module follows standard Maven layout (src/main/java, src/main/resources, src/test).
• Packages: pl.piomin.services with subpackages for model, repository, and tools.
• import.sql seeds an embedded H2 database.
• application.yml configures server ports and Spring AI credentials.
• sample-client contains REST controllers (AccountController, PersonController) that invoke the MCP servers via Spring AI’s client APIs.
README for additional insights
• Confirms use of Spring AI and MCP concept.
• Indicates you must export an OpenAI API key before running.
Essential details
• Where @Tool beans live (AccountTools.java, PersonTools.java) and how they invoke the AI.
• Ports and config files (application.yml) that bind services to endpoints.
• MCP protocol flow: sample client assembles request → service’s Tool method → Spring AI client sends to model → response flows back the same path.