How to Use the SpringBoot MCP Server

Set up the SpringBoot MCP Server to integrate AI models with your data. This guide covers creating, running, and testing the server with Claude Desktop for course data access.

Ashley Goolam

Ashley Goolam

31 July 2025

How to Use the SpringBoot MCP Server

Ready to make your AI-powered apps even smarter? Today, we’re diving into the SpringBoot MCP Server, a fantastic tool that lets AI models like Claude or Cursor interact with your data through the Model Context Protocol (MCP). Imagine your AI pulling course information or searching for specific data with just a few commands—all powered by a lightweight Spring Boot app. In this conversational guide, we’ll walk you through setting up and using the SpringBoot MCP Server, complete with a test to see it in action. Let’s get coding!

💡
Want a great API Testing tool that generates beautiful API Documentation?

Want an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?

Apidog delivers all your demands, and replaces Postman at a much more affordable price!
button

What Is the SpringBoot MCP Server?

The SpringBoot MCP Server is a Spring Boot application that uses the Spring AI MCP framework to expose your data as tools for AI models. It’s like giving your AI a direct line to your app’s data, such as course details, through standardized MCP tools. In this tutorial, we’ll focus on a server that offers two main tools:

This setup is perfect for integrating external data with AI models or building your own MCP servers. Plus, it’s built with Spring Boot, so it’s developer-friendly and easy to extend. Excited? Let’s set it up!

spring boot

How to Use the SpringBoot MCP Server

Prerequisites

Before we start, make sure you have:

Step 1: Create a New Spring Boot Project

Visit Spring Initializr:

spring initializr

Open in IntelliJ IDEA:

Step 2: Understand the Project Structure

Your SpringBoot MCP Server includes key components:

project structure

Here’s a sample application.properties setup:

spring.application.name=test-mcp-server
spring.main.web-application-type=none
spring.ai.mcp.server.name=game-demo-mcp
spring.ai.mcp.server.version=0.0.1
spring.main.banner-mode=off
logging.pattern.console=

This configures the app as a non-web server using STDIO transport, perfect for MCP communication.

Step 3: Define the Data Model

Create a simple Game.java record to represent course data:

package com.example.testmcpserver;

public record Game(String title, String url){
}

This immutable record holds course details like title and URL, making it easy for AI models to process.

Step 4: Implement MCP Tools

In GameService.java, define tools using the @Tool annotation. Here’s an example:

package com.example.testmcpserver;

import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class GameService {

    private static final Logger log = LoggerFactory.getLogger(GameService.class);
    private List<Game> games = new ArrayList<>();

    @Tool(name = "get_games", description = "Get a list of games from the collection")
    public List<Game> getGames() {
        return games;
    }

    @Tool(name = "get_game", description = "Get a single game from from the collection by title")
    public Game getGame(String title) {
        return games.stream().filter(course -> course.title().equals(title)).findFirst().orElse(null);
    }

    @PostConstruct
    public void init() {
        games.addAll(List.of(
                new Game("GTA 6", "https://www.rockstargames.com/VI"),
                new Game("FC 26","https://www.ea.com/en/games/ea-sports-fc/fc-26"),
                new Game("Call of Duty: Black Ops 7","https://www.callofduty.com/blackops7")
        ));
    }

}

These tools let AI models retrieve all courses or find a specific course by title.

Step 5: Register Tools with the MCP Framework

In TestMcpServerApplication.java, register the tools:

package com.example.testmcpserver;

import org.springframework.ai.support.ToolCallbacks;
import org.springframework.ai.tool.ToolCallback;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import java.util.List;

@SpringBootApplication
public class TestMcpServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(TestMcpServerApplication.class, args);
    }

    @Bean
    public List<ToolCallback> danTools(GameService gameService) {
        return List.of(ToolCallbacks.from(gameService));
    }

}

The ToolCallbacks.from() method scans GameService for @Tool annotations and registers them with the SpringBoot MCP Server.

Step 6: Run the SpringBoot MCP Server

Build and Run:

mvn spring-boot:run

Verify Tools:

Step 7: Connect to Cursor or Claude Desktop

To use the SpringBoot MCP Server with Claude Desktop:

Compile the Project:

mvn clean package
target folder with jar file

A. Configure Claude Desktop:

{
  "mcpServers": {
    "game-demo-mcp": {
      "command": "java",
      "args": [
        "-jar",
        "path/to/test-mcp-server-0.0.1-SNAPSHOT.jar"
      ]
    }
  }
}
edit claude configuration

Restart Claude Desktop:

B. Configure Cursor:

  1. Navigate to Settings, then Cursor Settings
  2. Select Tools and Integrations
  3. Click New MCP server
edit cursor mcp configuration

Step 8: Test the SpringBoot MCP Server

Let’s test the server with Claude Desktop:

Open Claude Desktop or Cursor and Issue a Command:

Using the MCP server, get all available games.
Available games:
- Title: GTA 6, URL: https://www.rockstargames.com/VI
- Title: FC 26, URL: https://www.ea.com/en/games/ea-sports-fc/fc-26
testing the mcp server

Try a Specific Game:

Using the MCP server, get the game with title "FC 26".
Game: FC 26, URL: https://www.ea.com/en/games/ea-sports-fc/fc-26

This confirms your SpringBoot MCP Server is working!

Step 9: Extend the SpringBoot MCP Server

Want to make it even cooler? Here are some ideas:

@Tool(name = "search_games", description = "Search games containing a keyword")
public List<Game> searchGames(String keyword) {
    return games.stream()
        .filter(game -> game.title().toLowerCase().contains(keyword.toLowerCase()))
        .collect(Collectors.toList());
}

Troubleshooting Tips

Why Use the SpringBoot MCP Server?

The SpringBoot MCP Server is a dream for developers who love Spring Boot’s simplicity and want to integrate AI with their data. It’s lightweight, uses STDIO for secure communication, and lets AI models like Claude access your app’s data in real-time. Whether you’re building a course platform or another data-driven app, this server makes AI integration a breeze.

Our test with Claude Desktop and Cursor, showed how easy it is to fetch game data. Imagine scaling this to handle complex queries or connecting to a real database—endless possibilities!

Conclusion

And that’s it! You’ve learned how to set up and use the SpringBoot MCP Server to bring AI-powered data access to your apps. From creating a Spring Boot project to connecting it with Claude Desktop and testing course queries, you’re now ready to build smarter AI integrations. Try adding new tools or hooking up a database to take it further.

💡
Want a great API Testing tool that generates beautiful API Documentation?

Want an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?

Apidog delivers all your demands, and replaces Postman at a much more affordable price!
button

Explore more

Can Qwen3-Coder-Flash Actually Replace Your Senior Developer

Can Qwen3-Coder-Flash Actually Replace Your Senior Developer

Discover if Qwen3-Coder-Flash, the new Qwen3-Coder-30B-A3B-Instruct, is the ultimate coding tool. Explore its MoE architecture, 256K context, and agentic features, benchmarked against Claude and GPT-4.

1 August 2025

Why Should Developers Care About Stainless API SDK Generation in 2025

Why Should Developers Care About Stainless API SDK Generation in 2025

Discover how Stainless API revolutionizes SDK generation for modern developers in 2025. Learn about automated multi-language SDK creation, integration with Apidog MCP, and best practices for API development.

31 July 2025

Top 10 WhatsApp Business API Solutions in 2025

Top 10 WhatsApp Business API Solutions in 2025

Explore the top 10 WhatsApp Business API solutions for small businesses in 2025, including Apidog, Evolution-API, and WAHA. Compare features, pricing, and integration to boost engagement. Learn about new API limits to optimize your strategy.

31 July 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs