Simple MCP Server

April 22, 2025 · View on GitHub

English | 中文

Introduction

This is a simple server example project based on Model Context Protocol (MCP). The project implements a Double Color Ball number generator tool that can randomly generate a specified number of lottery numbers.

Tech Stack

  • Spring Boot 3.4.4
  • Java 17
  • MCP SDK 0.9.0
  • Lombok
  • Maven

Features

  • Supports generating 1-10 sets of Double Color Ball numbers
  • Each set includes 6 red balls (1-33) and 1 blue ball (1-16)
  • Provides services through MCP protocol, allowing interaction with MCP-compatible clients (such as LLMs)

Running the Project

Local Deployment

  1. Ensure you have the following installed:

    • JDK 17+
    • Maven 3.6+
  2. Clone the project:

git clone https://github.com/beilingai/simple-mcp-server.git
cd simple-mcp-server
  1. Build the project:
mvn clean package
  1. Run the project:
java -jar target/mcp-server-1.0-SNAPSHOT.jar
  1. The service will start on the default port 8080

How to Use

This service provides tools through MCP protocol, which can be called by MCP-compatible clients.

Example usage:

Cursor Example

In Cursor editor, you can call this service as follows:

  1. Add the local MCP server address in settings
{
   "mcpServers": {
      "double-color-ball-mcp-server": {
         "url": "http://localhost:8080/sse"
      }
   }
}
  1. Request to generate Double Color Ball numbers in the chat window:
    Please generate 3 sets of Double Color Ball numbers
    
  2. The AI assistant will call this MCP service and return the generated results, for example:
    Generated Double Color Ball numbers:
    
    Set 1: 05 11 16 22 30 33 + 08
    Set 2: 03 06 14 20 25 31 + 12
    Set 3: 02 09 17 25 29 32 + 06