MCP ExplorerExplorer

Spring Mcp Remote Sse

@esurovtsevon 10 months ago
1 MIT
FreeCommunity
AI Systems
Remote MCP (Model Context Protocol) server built with Spring Boot and SSE. Demonstrates how to register tools, configure endpoints, and stream results to connected LLM clients using the Spring AI MCP SDK.

Overview

What is Spring Mcp Remote Sse

spring-mcp-remote-sse is a remote Model Context Protocol (MCP) server built using Spring Boot and Server-Sent Events (SSE). It demonstrates how to register tools, configure endpoints, and stream results to connected LLM clients using the Spring AI MCP SDK.

Use cases

Use cases for spring-mcp-remote-sse include enhancing AI models with specific information sources through tools like the RAG search service, testing the MCP server with the MCP Inspector, and deploying the server in Docker for scalable applications.

How to use

To use spring-mcp-remote-sse, you can run it with Maven using the command ‘mvn spring-boot:run’ or build and run the JAR file with ‘mvn clean package’ followed by ‘java -jar target/mcpserver-0.0.1-SNAPSHOT.jar’. The server will be accessible at http://localhost:8080.

Key features

Key features include a complete MCP server implementation using Spring AI, tool registration and callback handling, a practical example tool (RAG search service), and Docker support for easy deployment.

Where to use

spring-mcp-remote-sse can be used in AI development environments where tools need to be registered and accessed by AI models through the Model Context Protocol, particularly in applications requiring real-time data streaming.

Content

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.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers