Develop a Spring boot based MCP Server and integrate with Claude desktop
MCP (Model Communication Protocol) is an open standard that defines how AI models communicate with each other. Using Spring Boot, we can build an MCP Server with minimal configuration and seamlessly integrate it with AI tools like Claude desktop.
Step 1: Bootstrap the Project
Use Spring Initializr to create a new Spring Boot project. Add the following dependency to your pom.xml:
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-mcp-server</artifactId>
</dependency>
Step 2: Create Tools Based on a Book Model
We’ll define a simple service class with two tools using the @Tool annotation. Each Book contains a title and an author.
public class BookService {
@Tool(description = "Get Books by their title")
Book getBooksByTitle(String articleTitle) {
return new Book("Refactoring", "Martin Fowler");
}
@Tool(description = "Get top rated Books with authors")
List<Book> getTopBooks() {
return List.of(
new Book("Clean Code", "Bob Martin"),
new Book("Micro Services patterns", "Chris Richardson")
);
}
record Book(String title, String author) {
}
}
Step 3: Register Tools with the MCP Server
Now, register the tool methods with the Spring Boot MCP server using a ToolCallbackProvider.
@SpringBootApplication
public class McpServerApplication {
public static void main(String[] args) {
SpringApplication.run(McpServerApplication.class, args);
}
@Bean
ToolCallbackProvider authorTools(BookService bookService) {
return MethodToolCallbackProvider
.builder()
.toolObjects(bookService)
.build();
}
}
Step 4: application.properties
Make sure logging and banner mode are off to make STDIO transport work.
spring.application.name=mcp-server
spring.main.web-application-type=none
spring.ai.mcp.server.name=java2practice-mcp-server
spring.ai.mcp.server.version=0.0.1
# NOTE: You must disable the banner and the console logging
# to allow the STDIO transport to work !!!
spring.main.banner-mode=off
logging.pattern.console=
Step 4: Package the Application
Use Maven to build the JAR: mvn clean install
Step 5: Verify logs and check for Registered tools.

Step 6: Integrate with Claude Desktop
To connect your MCP Server with Claude, open the Claude Developer Settings and add your server configuration as shown:
{
"mcpServers": {
"booksearch": {
"command": "C:\\Users\\rames\\Downloads\\openjdk-24_windows-x64_bin\\jdk-24\\bin\\java.exe",
"args": [
"-jar",
"C:\\Users\\rames\\IdeaProjects\\spring_boot_mcp_server\\target\\mcp-server-0.0.1-SNAPSHOT.jar"
]
}
}
}
Step 7: Test your MCP Server

Code is available @ https://github.com/rameshcharykotha/spring_boot_mcp_server
Leave a comment