spring-ai-mcp-test

This repository demonstrates Spring AI's integration with the Model Context Protocol (MCP) using Spring Boot, showcasing both server and client implementations for services like geocoding and timezone retrieval, enabling LLM interaction.

2
0

MCP Host Project

Description

This project demonstrates the integration of Spring AI's Model Context Protocol (MCP) support within Spring Boot applications, showcasing both server and client implementations.

MCP

MCP standardizes contextual interaction management in AI models, enabling consistent integration with external data sources. Spring AI MCP extends the MCP Java SDK, providing Spring Boot starters for clients and servers. The MCP client manages communication with MCP servers. This project builds MCP servers using Spring AI, exposing their capabilities to LLMs, specifically Llama3.2 via Ollama, which supports TOOLS.

Modules

This project includes three modules:

Geocoder Service

  • Port: 8081
  • Description: Provides latitude and longitude for a given city.

Timezone Service

  • Port: 8082
  • Description: Provides timezone information for a given latitude and longitude.

MCP Host

  • Description: Uses the Geocoder and Timezone services via MCP clients. It offers a console interface to interact with an LLM, querying geographical information based on user input.

Running the Project

  1. Start Geocoder Service.
  2. Start Timezone Service.
  3. Start MCP Host.

Usage

  1. Interact with MCP Host by entering city names in the console. The system returns latitude, longitude, and timezone information.

Repository

OA
oalles

oalles/spring-ai-mcp-test

Created

March 18, 2025

Updated

March 25, 2025

Language

Java

Category

AI