diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..81fb0805027e94c7c24bd4ab4cd1e33011fdf197 --- /dev/null +++ b/README.en.md @@ -0,0 +1,123 @@ +# SpringAI MCP RAG Project Documentation + +## Project Overview + +This project is an implementation of a Model Control Protocol (MCP) service based on SpringAI, featuring Retrieval-Augmented Generation (RAG) functionality. The project is divided into three main modules: + +1. **business-server** - Product information management service +2. **mcp-client** - MCP client service with chat, search, and RAG capabilities +3. **mcp-server** - MCP server service providing date and email tools + +## Features + +- Product information management (create, delete, query, update) +- Chat functionality (supports streaming responses) +- Web search functionality (integrated with SearXNG) +- RAG functionality (supports document upload and retrieval) +- Server-Sent Events (SSE) support +- Email sending functionality +- Date handling functionality + +## Technology Stack + +- Spring Boot 3.5.0 +- Spring AI +- Model Context Protocol (MCP) +- Redis (for chat memory storage) +- PostgreSQL (for product information storage) +- Reactor Netty (for reactive programming) +- Lombok (to simplify Java code) +- MapStruct (for object mapping) + +## Module Details + +### business-server + +Provides product information management services with the following core components: + +- `Product` entity class (JPA entity) +- `ProductRepository` (JPA repository) +- `ProductService` (business logic layer) +- `ProductTool` (MCP tool implementation) + +### mcp-client + +MCP client service implementing the following features: + +- Chat functionality (Chat) +- Web search (Internet Search) +- RAG functionality (document upload and retrieval) +- SSE (Server-Sent Events) +- Frontend interface (built with Vue.js) + +### mcp-server + +MCP server service providing the following tools: + +- `DateTool` (retrieve current time) +- `EmailTool` (email sending functionality) + +## Usage Instructions + +### Environment Preparation + +1. Java 17+ +2. Maven 3.x +3. PostgreSQL database +4. Redis server +5. Python environment (for SearXNG search) + +### Configuration Instructions + +1. Modify `mcp-client/src/main/resources/application.yml` to set the SearXNG search service URL and result count +2. Modify `mcp-server/src/main/resources/application.yml` to configure email server settings + +### Startup Steps + +1. Start the PostgreSQL database and create the required tables +2. Start the Redis server +3. Start the `mcp-server` module +4. Start the `business-server` module +5. Start the `mcp-client` module + +### API Documentation + +#### Product Management API + +- Create product: `POST /product` +- Delete product: `DELETE /product/{productId}` +- Query products: `GET /product` +- Update product: `PUT /product` + +#### Chat API + +- Streaming chat: `GET /chat` +- Regular chat: `POST /doChat` + +#### Web Search API + +- Search: `POST /internet/search` + +#### RAG API + +- Upload document: `POST /rag/uploadRagDoc` +- Search: `POST /rag/search` + +#### SSE API + +- Connect: `GET /sse/connect` +- Send message: `GET /sse/sendMsg` +- Broadcast message: `GET /sse/sendMsgAll` + +## Contribution Guidelines + +Contributions are welcome! Please follow these steps: + +1. Fork the repository +2. Create a new branch +3. Commit your changes +4. Open a Pull Request + +## License + +This project is licensed under the Apache 2.0 License. See the LICENSE file in the project root directory for details. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..dcc743c033c446fcf0be5cf019aa29155b7ce701 --- /dev/null +++ b/README.md @@ -0,0 +1,123 @@ +# SpringAI MCP RAG 项目文档 + +## 项目概述 + +本项目是一个基于SpringAI的Model Control Protocol (MCP) 服务实现,包含RAG(Retrieval-Augmented Generation)功能。项目分为三个主要模块: + +1. **business-server** - 商品信息管理服务 +2. **mcp-client** - MCP客户端服务,包含聊天、搜索和RAG功能 +3. **mcp-server** - MCP服务器服务,提供日期工具和邮件工具 + +## 功能特性 + +- 商品信息管理(创建、删除、查询、更新) +- 聊天功能(支持流式响应) +- 网络搜索功能(集成SearXNG) +- RAG功能(支持文档上传和检索) +- 服务器发送事件(SSE)支持 +- 邮件发送功能 +- 日期处理功能 + +## 技术栈 + +- Spring Boot 3.5.0 +- Spring AI +- Model Context Protocol (MCP) +- Redis(用于聊天记忆存储) +- PostgreSQL(用于商品信息存储) +- Reactor Netty(用于响应式编程) +- Lombok(简化Java代码) +- MapStruct(对象映射) + +## 模块说明 + +### business-server + +提供商品信息管理服务,包含以下核心组件: + +- `Product` 实体类(JPA实体) +- `ProductRepository`(JPA仓库) +- `ProductService`(业务逻辑层) +- `ProductTool`(MCP工具实现) + +### mcp-client + +MCP客户端服务,主要实现以下功能: + +- 聊天功能(Chat) +- 网络搜索(Internet Search) +- RAG功能(文档上传和检索) +- SSE(服务器发送事件) +- 前端界面(基于Vue.js) + +### mcp-server + +MCP服务器服务,提供以下工具: + +- `DateTool`(获取当前时间) +- `EmailTool`(邮件发送功能) + +## 使用说明 + +### 环境准备 + +1. Java 17+ +2. Maven 3.x +3. PostgreSQL数据库 +4. Redis服务器 +5. Python环境(用于SearXNG搜索) + +### 配置说明 + +1. 修改`mcp-client/src/main/resources/application.yml`配置文件,设置SSEXNG搜索服务地址和数量 +2. 修改`mcp-server/src/main/resources/application.yml`配置文件,设置邮件服务器信息 + +### 启动步骤 + +1. 启动PostgreSQL数据库并创建相应表 +2. 启动Redis服务器 +3. 启动`mcp-server`模块 +4. 启动`business-server`模块 +5. 启动`mcp-client`模块 + +### 接口文档 + +#### 商品管理接口 + +- 创建商品:`POST /product` +- 删除商品:`DELETE /product/{productId}` +- 查询商品:`GET /product` +- 更新商品:`PUT /product` + +#### 聊天接口 + +- 流式聊天:`GET /chat` +- 普通聊天:`POST /doChat` + +#### 网络搜索接口 + +- 搜索:`POST /internet/search` + +#### RAG接口 + +- 上传文档:`POST /rag/uploadRagDoc` +- 搜索:`POST /rag/search` + +#### SSE接口 + +- 连接:`GET /sse/connect` +- 发送消息:`GET /sse/sendMsg` +- 群发消息:`GET /sse/sendMsgAll` + +## 贡献指南 + +欢迎贡献代码,请遵循以下步骤: + +1. Fork仓库 +2. 创建新分支 +3. 提交代码更改 +4. 创建Pull Request + +## 许可证 + +本项目采用Apache 2.0许可证。详情请查看项目根目录下的LICENSE文件。 \ No newline at end of file