daniellaera/spring-mcp-server
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.
🚢 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 Name | Description |
|---|---|
dl_get_books | Get all available books |
dl_get_book_by_title | Search for a book by title |
dl_get_books_by_author | List all books by a specific author |
dl_get_books_by_genre | Filter books by genre |
dl_get_books_by_rating | Get books rated above a given threshold |
dl_get_best_rated_books | Top N rated books (default: 5) |
dl_get_available_books | Only return books currently marked available |
dl_search_books | Full-text search over title, author, description, tags |
dl_get_book_recommendations | Smart 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
Bookrecords (JavarecordDTOs) - No JPA / database — fully in-memory
- On app boot, the
LibraryServiceregisters all tool methods with the Spring AI MCP server - When the app prints
{"type":"mcp","status":"ready"}tostderr, 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