Get the FREE Ultimate OpenClaw Setup Guide →

ai-spring

Projeto de estudo que implementa um MCP Server com Spring AI, permitindo criar ferramentas personalizadas que interagem com LLMs por meio do protocolo MCP.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio moises-paschoalick-ai-spring-mcp-server java -jar target/courses-0.0.1-SNAPSHOT.jar \
  --env LOGGING_PATTERN_CONSOLE="" \
  --env SPRING_APPLICATION_NAME="courses" \
  --env SPRING_AI_MCP_SERVER_NAME="dan-vega-mcp" \
  --env SPRING_AI_MCP_SERVER_VERSION="0.0.1" \
  --env SPRING_MAIN_WEB_APPLICATION_TYPE="none"

How to use

This MCP server is a Spring AI-based implementation that exposes a couple of custom tools to manage courses via the Model Context Protocol (MCP). It runs without an HTTP interface and communicates through STDIO, making it suitable for use with local orchestrators or model agents that interact through MCP tools. The available tools let you list all courses and fetch a specific course by its title, enabling streamlined integration with AI workflows that need contextual course data.

To use the server, start the application in STDIO mode (as configured in the project). Once running, you can invoke the exposed MCP tools from your model or client by referencing the tool names (for example, dv_get_courses and dv_get_course) and passing the required parameters (like the course title). The server will respond with structured data representing the list of courses or a single course object if found. This setup is ideal for experimentation, demonstrations, and learning how to integrate a custom domain service into an MCP-enabled AI pipeline.

How to install

Prerequisites:

  • Java 17+ (Java 21 recommended) and Maven installed
  • Git to clone the repository (optional if you already have the sources)

Installation steps:

  1. Clone the repository git clone https://github.com/moises-paschoalick/spring-ai-mcp-server.git cd spring-ai-mcp-server

  2. Build the project (compile and package) mvn clean package

  3. Run the MCP server (STDIO transport) mvn spring-boot:run

  4. Alternative run using the packaged JAR java -jar target/courses-0.0.1-SNAPSHOT.jar

Notes:

  • The server is configured to disable the web server (STDIO transport only) via application.properties.
  • Ensure Java and Maven versions meet the project requirements described in the README.

Additional notes

Tips and caveats:

  • The server uses STDIO transport; ensure any orchestrator or agent you connect to can communicate via standard input/output.
  • The server exposes two tools: dv_get_courses (lists all courses) and dv_get_course (fetches a course by title). Use exact tool names when calling these MCP methods.
  • If you modify the application.properties, remember to restart the server for changes to take effect.
  • The project initializes with a small set of example courses; you can extend or replace these in the CourseService as needed.
  • If you encounter port or binding issues, verify that web application type is set to none and that the application is built with the correct profile or environment.
  • Logs to the console are suppressed for STDIO usage by setting logging.pattern.console empty in properties.

Related MCP Servers

Sponsor this space

Reach thousands of developers