Get the FREE Ultimate OpenClaw Setup Guide →

spring-ai -test

Showcases how to integrate Spring AI's support for MCP (Model Context Protocol) within Spring Boot applications, covering both server-side and client-side implementations.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio oalles-spring-ai-mcp-test docker run -i oalles/spring-ai-mcp-test:latest \
  --env MCP_LOG_LEVEL="info" \
  --env MCP_SERVER_PORT="8080"

How to use

This MCP server implementation exposes three components built with Spring AI: a Geocoder service (port 8081), a Timezone service (port 8082), and an MCP Host that coordinates tools and renders responses from an LLM via a console interface. The MCP Host uses the Geocoder and Timezone services to answer questions about city locations and their time zones, leveraging an LLM with TOOL support (in this project, a model like Llama3.2 via Ollama).

To use, run the provided services, then interact with the MCP Host to input city names. The host will use the Geocoder to fetch latitude/longitude, then the Timezone service to derive timezone information, presenting the results in a structured manner through the LLM-driven console interface. This setup demonstrates how to compose an MCP-enabled server that coordinates multiple data sources and provides a cohesive tool-assisted answer flow.

How to install

Prerequisites:

  • Java JDK 17+ and Maven
  • Ollama or equivalent model provider configured to run a model compatible with TOOL usage
  • Git to clone repository (or download the modules separately)

Installation steps:

  1. Clone the repository or download the modules: git clone <repository-url> cd your-repo-root

  2. Build and run the Geocoder service: cd geocoder mvn spring-boot:run

  3. Build and run the Timezone service: cd ../timezone mvn spring-boot:run

  4. Build and run the MCP Host: cd ../mcp-host mvn spring-boot:run

If you prefer containerized execution, ensure Docker is installed and pull the prebuilt image for the MCP test setup, then run: docker run -i oalles/spring-ai-mcp-test:latest

Note: Ensure your environment variables for model hosting (like Ollama) are configured as described in the project documentation.

Additional notes

Tips and considerations:

  • Ensure the Geocoder and Timezone services are reachable by the MCP Host (the default ports are 8081 and 8082, respectively).
  • The MCP Host console expects to interact with a model that supports TOOLS; verify your model provider (e.g., Ollama) is configured and running.
  • If you encounter connectivity issues, check that Docker networking allows the MCP Host to reach the Geocoder and Timezone services.
  • Adjust MCP logging via MCP_LOG_LEVEL to debug issues during development.
  • The npm_package field is null because this is a Java-based MCP server (Maven/Spring Boot) rather than an npm-based Node.js server.

Related MCP Servers

Sponsor this space

Reach thousands of developers