Files
ydoyun-report-mcp/README.md
2026-02-27 09:43:11 +08:00

96 lines
2.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ydoyun-report-mcp
一个基于 Spring Boot 和 MCP (Model Context Protocol) 的报表服务项目,用于将报表存储过程调用能力暴露给 AI 模型。
## 技术栈
- Java 17
- Spring Boot 3.2.6
- Spring AI MCP Server WebMVC 1.0.0
- Maven
## 项目结构
```
ydoyun-report-mcp/
├── pom.xml
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/junchi/app/mcp/
│ │ │ ├── YdoyunReportMcpApplication.java # 主应用类
│ │ │ ├── config/ # 配置类
│ │ │ │ ├── McpToolConfig.java # MCP 工具配置
│ │ │ │ └── RestTemplateConfig.java # RestTemplate 配置
│ │ │ ├── mcptool/ # MCP 工具服务
│ │ │ │ └── ReportMcpToolsService.java # 报表 MCP 工具服务
│ │ │ └── report/ # 报表服务
│ │ │ ├── ReportService.java # 报表服务实现
│ │ │ └── vo/ # 值对象
│ │ │ ├── ProcedureRequestVO.java # 存储过程请求 VO
│ │ │ └── ProcedureResponseVO.java # 存储过程响应 VO
│ │ └── resources/
│ │ └── application.yml # 应用配置文件
│ └── test/ # 测试代码目录
└── README.md
```
## 功能说明
### 核心功能
1. **MCP 工具服务**: 提供 `executeReportProcedure` 工具方法,供 AI 模型调用
2. **存储过程调用**: 通过 HTTP 调用远程存储过程 API
3. **日期处理**: 支持 `today``yesterday``tomorrow` 关键字或具体日期格式yyyy-MM-dd
### 配置说明
`application.yml` 中配置:
- **服务端口**: 48090
- **MCP 服务器**: 异步类型,仅启用 tools 能力
- **远程 API**: 配置存储过程执行接口地址和 API 密钥
## 构建和运行
### 构建项目
```bash
mvn clean package
```
### 运行项目
```bash
mvn spring-boot:run
```
或者运行打包后的 jar
```bash
java -jar target/ydoyun-report-mcp-1.0.0.jar
```
## API 说明
### MCP 工具
**executeReportProcedure**
根据存储过程名称、日期和仓库代码调用后端存储过程接口。
参数:
- `name` (String): 存储过程名称
- `rq` (String): 日期,支持 `today`/`yesterday`/`tomorrow``2025-12-01` 格式
- `ckdm` (String): 仓库代码
- `p` (String): 秘钥
返回:执行结果的字符串表示
## 注意事项
1. 确保远程 API 服务可访问
2. 配置正确的 API 密钥
3. 根据实际需求调整日志级别