mcpField
S
Spring MCP Server Demo

Spring MCP Server Demo

Local
github.com/esurovtsevDeveloper Tools1Updated 74w ago

About Spring MCP Server Demo

Spring MCP Server Demo is a Java and Spring Boot example for building a remote MCP server. It demonstrates tool registration and callback handling with a documentation search tool backed by RAG.

Key features

  1. 01Register MCP tools with Spring AI
  2. 02Handle tool callbacks
  3. 03Search documentation with a RAG tool
  4. 04Run with Maven or Docker

Use cases

  1. 01Explore a Spring-based MCP server implementation
  2. 02Test documentation search through an MCP tool
  3. 03Run the demo locally or in Docker

MCP support

It implements a remote MCP server using Spring AI and SSE, exposing a documentation search tool that MCP clients can discover and call.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"spring-mcp-remote-sse": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/inspector"
]
}
}
}
Run commandnpx -y @modelcontextprotocol/inspector

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@modelcontextprotocol/inspector

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Spring MCP Server Demo

A simple demonstration of how to build a remote Model Context Protocol (MCP) server using Spring Boot and Java. This project showcases how to implement and expose tools that can be called by AI models through the MCP protocol.

What's Inside

  • Complete MCP server implementation using Spring AI
  • Tool registration and callback handling
  • RAG search service as a practical example tool
  • Docker support for easy deployment

Quick Start

# Run with Maven
mvn spring-boot:run

# Or build and run the JAR
mvn clean package
java -jar target/mcpserver-0.0.1-SNAPSHOT.jar

The server will start at http://localhost:8080

🧪 Testing with MCP Inspector

The MCP Inspector is a tool that allows you to test your MCP server without needing to integrate with an LLM.

# Run the Inspector with your MCP server
npx @modelcontextprotocol/inspector

This will start the MCP Inspector web interface (typically at http://127.0.0.1:6274)

Docker Support

Want to run this in Docker? No problem!

# Build and package everything in one go
./docker-build.sh

# Run the container
docker run -p 8080:8080 mcp-server:latest

That's it! Your MCP server will be available at http://localhost:8080.

Available Tools

Search

Searches through documentation files in the RAG directory.

Parameters:

  • query: The search term

Returns: A list of relevant text snippets from the documentation

How It Works

This demo uses Spring AI's MCP server capabilities to expose tools that can be called by AI models. The server implements the Model Context Protocol, allowing AI models to discover and use the tools provided by this server.

The RAG search tool demonstrates how to implement a practical tool that can enhance an AI model's capabilities by providing access to specific information sources.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.