About Demo
Demo is an MCP server published by liqingdong in the AI category: 一个基于Spring Boot 的MCP(Model Control Protocol)服务示例项目.
The repository has 5 stars and 4 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.
Install
git clone https://github.com/liqingdong/mcp-server-demoThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Demo
Powered by Claude · Grounded in docs
Security checks
Static checks derived from the repository 3 days ago. Heuristics on the source, not an audit.
- ✓README presentThe repository ships documentation.
- !License declaredNo license file. Legally you have no right to use it in a product.
- ✓Tests presentA test suite exists in the repository.
- !Dependencies pinnedNo lockfile. Installs can pull different code over time.
- ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
1 check has not been run yet.
README
MCP Server Demo 项目文档
项目简介
这是一个基于Spring Boot 3.4.4的MCP(Model Control Protocol)服务示例项目,集成Spring AI工具链实现智能服务功能。项目包含基础数值运算、天气查询等服务的实现模板。
核心功能
1. 数字服务(NumberService)
- 奇偶数判断
- 素数检测(已实现)
- 扩展建议:可添加质因数分解、斐波那契计算等
2. 天气服务(WeatherService)
- 天气数据接口(当前使用随机数伪代码。真实需对接第三方API实现,可参考OpenWeatherMap API)
3. MCP工具支持
- 通过
@Tool注解暴露服务为标准化工具 - 通过
@ToolParam注解定义服务参数
项目结构
src
|-- main
| |-- java
| | `-- cn
| | `-- liqingdong
| | `-- mcp
| | `-- server
| | |-- McpApplication.java
| | `-- service
| | |-- NumberService.java
| | `-- WeatherService.java
| `-- resources
| `-- application.yml
`-- test
`-- java
`-- cn
`-- liqingdong
`-- mcp
`-- server
|-- McpApplicationTest.java
`-- SSEMcpTest.java
`-- STDIOMcpTest.java
快速开始
环境要求
- JDK 17
- Maven 3.8+
- IDE(推荐IntelliJ IDEA)
运行步骤
1. 克隆仓库
git clone https://github.com/liqingdong/mcp-server-demo.git
2. 构建项目
mvn clean install
3. 使用服务
3.1 使用STDIO模式
3.1.1 配置启动命令
java -jar -Dspring.ai.mcp.server.stdio=true target/mcp-server-demo-0.0.1-SNAPSHOT.jar
3.1.2 使用支持MCP工具的客户端,例如:Cherry Studio 进行测试
3.2 使用SSE模式
3.2.1 配置启动命令(默认访问地址为:http://localhost:8081/sse)
java -jar target/mcp-server-demo-0.0.1-SNAPSHOT.jar
核心测试类
| 测试类名 | 测试内容 |
|---|---|
McpApplicationTest |
应用上下文加载验证 |
SSEMcpTest/StdioMcpTest |
不同协议的MCP服务测试 |
开发规范
- 代码风格:遵循Spring官方编码规范
- 工具注解:所有服务方法需用
@Tool标注,参数需用@ToolParam标注 - 测试覆盖率:核心功能需达到80%+单元测试覆盖
贡献指南
- Fork仓库 → 创建功能分支
- 实现新功能/修复问题
- 添加对应单元测试
- 提交Pull Request至
main分支
项目状态
README fetched from the repository 3 days ago. The original is authoritative.