spring-mcp-server

daniellaera/spring-mcp-server

3.1

If you are the rightful owner of spring-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A lightweight MCP server built with Java and Spring Boot, serving a queryable in-memory book catalog to MCP-compatible AI tools.

Tools
9
Resources
0
Prompts
0

🚢 MCP Server with Spring Boot · dan-laera-mcpserver

A lightweight MCP (Model-Context Protocol) server built with Java and Spring Boot using the official spring-ai-starter-mcp-server dependency. This app serves a fully queryable in-memory book catalog to any MCP-compatible AI tool — like Claude, Cursor, Warp, or IntelliJ.

No persistence layer, no fluff. Just clean code, tool annotations, and boom — data served to your AI agent.


🧠 What Is MCP?

MCP (Model-Context Protocol) is an open standard (pioneered by Anthropic) that allows AI models and tools to interact with external data, APIs, tools, and memory — using a simple, structured protocol (usually JSON-RPC over STDIO).
This project acts as a self-contained MCP server, serving book data and recommendation logic to any host that supports MCP.


⚙️ Tech Stack

  • ☕ Java 21+
  • 🧰 Spring Boot
  • 📦 org.springframework.ai:spring-ai-starter-mcp-server
  • 🧠 MCP-compatible AI tools (Claude, Warp, Cursor, etc.)

📚 Features

Tool NameDescription
dl_get_booksGet all available books
dl_get_book_by_titleSearch for a book by title
dl_get_books_by_authorList all books by a specific author
dl_get_books_by_genreFilter books by genre
dl_get_books_by_ratingGet books rated above a given threshold
dl_get_best_rated_booksTop N rated books (default: 5)
dl_get_available_booksOnly return books currently marked available
dl_search_booksFull-text search over title, author, description, tags
dl_get_book_recommendationsSmart recommendations based on genre, rating, and tag similarity

All tools are exposed using @Tool annotations and are auto-registered via ToolCallbacks.


🛠️ How It Works

  • A list of preloaded Book records (Java record DTOs)
  • No JPA / database — fully in-memory
  • On app boot, the LibraryService registers all tool methods with the Spring AI MCP server
  • When the app prints {"type":"mcp","status":"ready"} to stderr, it's ready to serve
  • AI clients (e.g. Claude in Warp or Cursor) can call any of the tools

🚀 Running the Server

# Package the app
./mvnw clean package

# Run the MCP server
java -jar target/mcp-server-0.0.1-SNAPSHOT.jar