Java and Spring Boot sample MCP server

Java and Spring Boot sample MCP server

mcp-server-demo-oneinstepgo•byoneinstepgo

A sample Model Context Protocol server built with Java, Spring Boot and Spring AI that communicates over SSE and exposes weather, utility and JSON tools.

License: Not specified•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Serves MCP tools from a Spring Boot application over SSE.
  • •Provides weather forecast and weather alert tools by location.
  • •Provides simple utility tools for echo, addition of two numbers and current timestamp.
  • •Provides a JSON tool that converts JSON into Java class code and generates sample JSON from a Java class definition.

BEST FOR

  • •Java developers learning how to build an MCP server with Spring Boot and Spring AI.
  • •Querying weather forecasts and state weather alerts from an MCP-capable client such as the Cursor editor.
  • •Generating sample JSON from a supplied Java class definition through an MCP client.

ABOUT MCP-SERVER-DEMO-ONEINSTEPGO

Java and Spring Boot sample MCP server is cataloged as an MCP server attributed to oneinstepgo. A sample Model Context Protocol server built with Java, Spring Boot and Spring AI that communicates over SSE and exposes weather, utility and JSON tools. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Java and Spring Boot sample MCP server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What transport does this MCP server use?

The server communicates using SSE and connects through an SSE root endpoint.

Which tools does the server expose?

It exposes weather forecast and alert tools, echo, addition and timestamp tools, and a JSON-to-Java and sample-JSON tool.

Upstream README

View this exact version on GitHub

README.md · 8655b8c51f4e · Fetched 2026-11-13 13:30:52 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

简单 MCP Server 示例 (Java + Spring Boot + Spring AI)

项目目标

本项目旨在开发一个简单的模型上下文协议 (MCP) 服务器。此服务器将作为如何在 Java 和 Spring Boot 环境下构建 MCP 服务器的示例,使用 sse 进行通信。

技术栈

  • Java: JDK 21
  • Spring Boot: 3.3.12
  • Spring AI: spring-ai-starter-mcp-server-webflux 用于 MCP 服务器功能
  • 构建工具: Maven
  • 通信协议: sse

核心依赖

<dependencyManagement>
   <dependencies>
      <dependency>
         <groupId>io.modelcontextprotocol.sdk</groupId>
         <artifactId>mcp-bom</artifactId>
         <version>0.10.0</version>
         <type>pom</type>
         <scope>import</scope>
      </dependency>
   </dependencies>
</dependencyManagement>

<dependencies>
<!-- Spring Boot Starter -->
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter</artifactId>
</dependency>

<!-- Spring Boot Web Starter for SSE -->
<dependency>
      <groupId>org.springframework.ai</groupId>
      <artifactId>spring-ai-starter-mcp-server-webflux</artifactId>
      <version>${spring-ai.version}</version>
</dependency>

</dependencies>

关键组件

  1. MCP 服务器配置:

    • 设置 FastMCP 或等效的 Spring AI 组件来初始化 MCP 服务器。
    • 服务器通过 sse 进行通信。
  2. 示例工具 (Tools):

    • 实现了以下工具:
      • WeatherTool: 查询天气预报和天气警报
      • SimpleTool: 提供回声、简单数学和时间戳功能
      • JsonTool: 将 JSON 字符串转换为 Java 类代码,并根据 Java 类定义输出一个类型规范的示例 JSON 字符串
    • 工具的定义遵循 MCP 规范,使用 Java 类型提示和注解来自动生成工具定义。

项目结构

cem_mcp_server
  ├── src/main/java/com/example/mcpserver
  │   ├── config/                          # 配置类
  │   ├── McpServerApplication.java        # 主应用程序类
  │   └── tools/                           # 工具实现
  │       ├── WeatherTool.java             # 天气工具
  │       └── SimpleTool.java              # 简单工具
  │       ├── JsonTool.java                # JSON 工具
  ├── src/main/resources
  │   └── application.yml                  # 应用配置
  └── pom.xml                              # Maven 配置

编译和运行

使用 Maven 命令

mvn clean package spring-boot:run

测试和调试

服务器端点

  • 连接根端点: http://localhost:8080/sse - 连接MCP服务器

测试工具

可以使用支持 MCP 协议的客户端(如 Cursor 编辑器)连接到 MCP 服务器。服务器提供以下工具:

  1. 天气工具:

    • getWeatherForecastByLocation: 获取指定经纬度的天气预报
    • getAlerts: 获取指定州的天气警报
  2. 简单工具:

    • echoTool: 回声工具,返回输入的消息
    • simpleMathTool: 计算两个数字的和
    • timestampTool: 返回当前时间

与 Cursor 集成

在 Cursor 编辑器中,可以通过以下步骤连接到此 MCP 服务器:

  1. 项目下新增文件 .cursor/mcp.json。
    {
      "mcpServers": {
        "mcp-serve-demo": {
          "name": "本地 MCP 服务器",
          "url": "http://localhost:8080/sse",
          "enabled": true
        }
      }
    }
    
  2. 打开 Cursor 设置
  3. 找到 MCP 相关配置,刷新本MCP工具。
  4. 现在可以在 Cursor 中使用本服务器提供的工具
  5. 提问:
    • 纽约今天天气怎么样?
    • 请根据我给出的java类定义,输出一个示例json

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Java and Spring Boot sample MCP server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-server-demo-oneinstepgo)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools