Get the FREE Ultimate OpenClaw Setup Guide →

spring-ai

Sample Spring AI MCP Server project built for fun and experimentation. 🚀 It implements basic CRUD operations using an in-memory data store with dummy Person data. 🤖

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio cagritrk-spring-ai-mcp-server java -jar <YOUR_PATH>\\spring-ai-mcp\\target\\spring-ai-mcp-0.0.1-SNAPSHOT.jar

How to use

This MCP server hosts a Spring-based MCP server example that manages an in-memory dataset of Person entities. It exposes a set of CRUD and query operations implemented via Spring MCP Tools annotations, operating on an in-memory store for quick experimentation. The server provides commands to create, read, update, delete, and filter person records, including search by job title and filtering by attributes like sex and age. The tools are designed to be consumed by the MCP client tooling, allowing you to compose prompts that call these operations and receive structured responses from the in-memory data store.

Available tools include: ps_create_person to add a new person, ps_get_all_persons to list all records, ps_get_person_by_id to fetch a single record, ps_update_person to modify an existing record, ps_delete_person to remove a record, ps_search_by_job_title to find people by their job title, ps_filter_by_sex to filter by sex, and ps_filter_by_age to filter by age. Each tool accepts a defined set of inputs (e.g., id, personData, jobTitleQuery, sex, age) and returns the current state or result of the operation. Use these tools in combination to build flows like creating a person, listing all records, and then updating or deleting specific entries.

How to install

Prerequisites:

  • Java Development Kit (JDK) 24 or newer installed and added to PATH
  • Maven installed and available on PATH
  • A compatible JDK that can run Spring Boot 3.4.4 applications

Installation steps:

  1. Clone the repository or download the project source.
  2. Open a terminal and navigate to the project root.
  3. Build the project with Maven: mvn clean install This will compile the code and produce the MCP server jar at: target/spring-ai-mcp-0.0.1-SNAPSHOT.jar
  4. Run the MCP server: java -jar target/spring-ai-mcp-0.0.1-SNAPSHOT.jar The server will start and be ready to accept MCP tool invocations.

Note:

  • Adjust the jar path in the mcp_config to point to your built jar if you relocate the project directory. In Windows paths, the README example uses backslashes escaped for JSON compatibility.

Additional notes

Tips and considerations:

  • The in-memory data store is reset when the server restarts. For persistent data across restarts, integrate a real database implementation.
  • Ensure the path to the jar in mcp_config matches your environment. When running on non-Windows systems, adjust the path accordingly.
  • The tools assume a simple data model for Person with fields such as id, firstName, lastName, sex, email, phone, dateOfBirth, and jobTitle. Input objects should align with the server's expected schema.
  • If you encounter port or binding issues, check your Java process logs for startup messages and ensure the required resources are available.
  • You can extend or customize the example by replacing the in-memory service with a persistent store and adding additional CRUD endpoints as needed.

Related MCP Servers

Sponsor this space

Reach thousands of developers