CS

cagritrk/spring-ai-mcp-server

Developer tools
6 stars 4 forks Quality 43 Trend 14

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. 🤖

Overview

This is a 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. The project demonstrates: - Implementation of a PersonService with CRUD operations - In-memory data storage for Person entities - Spring MCP Tools annotations and required code to create an MCP Server - : Delete a person record by ID from the in-memory store. : id (integer) - : Search for persons by job title in the in-memory store. : jobTitleQuery (string) - : Filter persons by sex (case-insensitive). : sex (string) - : Filter persons by age. : age (integer) - : Update an existing person record by ID in the in-memory store. : id (integer), updatedPersonData (object) - : Create a new person record in the in-memory store. : personData (object)

README

Spring AI MCP Server Example

This is a 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.

Project Overview

The project demonstrates:

  • Implementation of a PersonService with CRUD operations
  • In-memory data storage for Person entities
  • Spring MCP Tools annotations and required code to create an MCP Server

Technologies

  • Java 24
  • Spring Boot 3.4.4
  • Spring AI 1.0.0-M6

How to Run

  1. Build the project:
mvn clean install
  1. Start the MCP server:
java -jar target/spring-ai-mcp-0.0.1-SNAPSHOT.jar

MCP Server Configuration

{
  "mcpServers": {
    "cagritrk-inmemory-data-mcp-server": {
      "command": "java",
      "args": [
        "-jar",
        "\\spring-ai-mcp\\target\\spring-ai-mcp-0.0.1-SNAPSHOT.jar"
      ]
    }
  }
}

Tools of cagritrk-inmemory-data-mcp-server

  • ps_delete_person: Delete a person record by ID from the in-memory store.
    Input: id (integer)

  • ps_search_by_job_title: Search for persons by job title in the in-memory store.
    Input: jobTitleQuery (string)

  • ps_filter_by_sex: Filter persons by sex (case-insensitive).
    Input: sex (string)

  • ps_filter_by_age: Filter persons by age.
    Input: age (integer)

  • ps_update_person: Update an existing person record by ID in the in-memory store.
    Input: id (integer), updatedPersonData (object)

  • ps_create_person: Create a new person record in the in-memory store.
    Input: personData (object)

  • ps_get_all_persons: Retrieve all person records from the in-memory store.
    Input: None

  • ps_get_person_by_id: Retrieve a person record by ID from the in-memory store.
    Input: id (integer)

Demo Screenshots

Create new Person

Get the list of Persons

How many male person records are there?

CSV Data

The project uses the following sample CSV data:

View the full README on GitHub

Install

This server does not publish a one-line install command.

Open the repository installation guide New to MCP? Start with the mcpskill.org guide →

Configuration

{ "mcpServers": { "cagritrk-inmemory-data-mcp-server": { "command": "java", "args": [ "-jar", "<YOUR_PATH>\\spring-ai-mcp\\target\\spring-ai-mcp-0.0.1-SNAPSHOT.jar" ] } } }