From a4314dbbdefa806e923d1fd18016a7469804e0e2 Mon Sep 17 00:00:00 2001 From: ageer Date: Mon, 14 Apr 2025 23:10:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20mcp=E6=B5=8B=E8=AF=95=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-extend/call-mcp-server/pom.xml | 83 +++++ .../CallMcpServerApplication.java | 13 + .../callmcpserver/cofing/McpClientCfg.java | 22 ++ .../callmcpserver/view/ChatController.java | 74 ++++ .../callmcpserver/view/IndexController.java | 21 ++ .../src/main/resources/application.yaml | 16 + .../src/main/resources/mcp-server-bak.json | 40 +++ .../src/main/resources/mcp-server.json | 20 ++ .../src/main/resources/templates/index.html | 148 ++++++++ ruoyi-extend/ruoyi-mcp-server/pom.xml | 20 +- .../ruoyi/mcp/service/McpCustomService.java | 11 +- .../src/main/resources/application-dev.yml | 97 ----- .../src/main/resources/application-mcp.yml | 10 - .../src/main/resources/application.yml | 332 +----------------- 14 files changed, 455 insertions(+), 452 deletions(-) create mode 100644 ruoyi-extend/call-mcp-server/pom.xml create mode 100644 ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/CallMcpServerApplication.java create mode 100644 ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/cofing/McpClientCfg.java create mode 100644 ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/view/ChatController.java create mode 100644 ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/view/IndexController.java create mode 100644 ruoyi-extend/call-mcp-server/src/main/resources/application.yaml create mode 100644 ruoyi-extend/call-mcp-server/src/main/resources/mcp-server-bak.json create mode 100644 ruoyi-extend/call-mcp-server/src/main/resources/mcp-server.json create mode 100644 ruoyi-extend/call-mcp-server/src/main/resources/templates/index.html delete mode 100644 ruoyi-extend/ruoyi-mcp-server/src/main/resources/application-dev.yml delete mode 100644 ruoyi-extend/ruoyi-mcp-server/src/main/resources/application-mcp.yml diff --git a/ruoyi-extend/call-mcp-server/pom.xml b/ruoyi-extend/call-mcp-server/pom.xml new file mode 100644 index 00000000..3f061817 --- /dev/null +++ b/ruoyi-extend/call-mcp-server/pom.xml @@ -0,0 +1,83 @@ + + 4.0.0 + + org.ruoyi + ruoyi-ai + 1.0.0 + ../../pom.xml + + call-mcp-server + Archetype - call-mcp-server + http://maven.apache.org + + + 17 + + + + + + + org.springframework.ai + spring-ai-bom + 1.0.0-M6 + pom + import + + + + + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + + org.springframework.ai + spring-ai-mcp-client-spring-boot-starter + 1.0.0-M6 + + + + org.springframework.ai + spring-ai-openai-spring-boot-starter + + + + + org.springframework.ai + spring-ai-mcp + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/CallMcpServerApplication.java b/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/CallMcpServerApplication.java new file mode 100644 index 00000000..213df755 --- /dev/null +++ b/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/CallMcpServerApplication.java @@ -0,0 +1,13 @@ +package org.ruoyi.rocket.callmcpserver; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class CallMcpServerApplication { + + public static void main(String[] args) { + SpringApplication.run(CallMcpServerApplication.class, args); + } + +} diff --git a/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/cofing/McpClientCfg.java b/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/cofing/McpClientCfg.java new file mode 100644 index 00000000..26936890 --- /dev/null +++ b/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/cofing/McpClientCfg.java @@ -0,0 +1,22 @@ +package org.ruoyi.rocket.callmcpserver.cofing; + +import io.modelcontextprotocol.client.McpClient; +import org.springframework.ai.mcp.customizer.McpSyncClientCustomizer; +import org.springframework.context.annotation.Configuration; + +import java.time.Duration; + + +/** + * @author ageer + */ +@Configuration +public class McpClientCfg implements McpSyncClientCustomizer { + + + @Override + public void customize(String name, McpClient.SyncSpec spec) { + // do nothing + spec.requestTimeout(Duration.ofSeconds(30)); + } +} diff --git a/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/view/ChatController.java b/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/view/ChatController.java new file mode 100644 index 00000000..27c837e7 --- /dev/null +++ b/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/view/ChatController.java @@ -0,0 +1,74 @@ +package org.ruoyi.rocket.callmcpserver.view; + +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.ai.chat.client.ChatClient; +import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor; +import org.springframework.ai.chat.memory.ChatMemory; +import org.springframework.ai.chat.memory.InMemoryChatMemory; +import org.springframework.ai.chat.model.ChatResponse; +import org.springframework.ai.openai.OpenAiChatOptions; +import org.springframework.ai.tool.ToolCallbackProvider; +import org.springframework.web.bind.annotation.*; +import reactor.core.publisher.Flux; + + +/** + * @author jianzhang + * 2025/03/18/下午8:00 + */ +@RestController +@RequestMapping("/dashscope/chat-client") +public class ChatController { + + private final ChatClient chatClient; + + private final ChatMemory chatMemory = new InMemoryChatMemory(); + + public ChatController(ChatClient.Builder chatClientBuilder,ToolCallbackProvider tools) { + this.chatClient = chatClientBuilder + .defaultTools(tools) + .defaultOptions( + OpenAiChatOptions.builder().model("gpt-4o-mini").build()) + .build(); + } + + @RequestMapping(value = "/generate_stream", method = RequestMethod.GET) + public Flux generateStream(HttpServletResponse response, @RequestParam("id") String id, @RequestParam("prompt") String prompt) { + response.setCharacterEncoding("UTF-8"); + var messageChatMemoryAdvisor = new MessageChatMemoryAdvisor(chatMemory, id, 10); + + + Flux chatResponseFlux = this.chatClient.prompt(prompt) + .advisors(messageChatMemoryAdvisor) + .stream() + .chatResponse(); + + Flux content = this.chatClient.prompt(prompt) + .advisors(messageChatMemoryAdvisor) + .stream() + .content(); + + content.subscribe( + content1 -> System.out.println("chatResponse"+content1) + ); + return chatResponseFlux; + + + } + + + @GetMapping("/advisor/chat/{id}/{prompt}") + public Flux advisorChat( + HttpServletResponse response, + @PathVariable String id, + @PathVariable String prompt) { + + response.setCharacterEncoding("UTF-8"); + var messageChatMemoryAdvisor = new MessageChatMemoryAdvisor(chatMemory, id, 10); + return this.chatClient.prompt(prompt) + .advisors(messageChatMemoryAdvisor).stream().content(); + } + + + +} diff --git a/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/view/IndexController.java b/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/view/IndexController.java new file mode 100644 index 00000000..ed03e33a --- /dev/null +++ b/ruoyi-extend/call-mcp-server/src/main/java/org/ruoyi/rocket/callmcpserver/view/IndexController.java @@ -0,0 +1,21 @@ +package org.ruoyi.rocket.callmcpserver.view; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +/** + * @author jianzhang + * 2025/03/18/下午8:00 + */ +@Controller +public class IndexController { + + @GetMapping("/") + public String chat(Model model) { + //model.addAttribute("name", "User"); + // 返回视图名称,对应 templates/index.html + return "index"; + } + +} diff --git a/ruoyi-extend/call-mcp-server/src/main/resources/application.yaml b/ruoyi-extend/call-mcp-server/src/main/resources/application.yaml new file mode 100644 index 00000000..f4b4577f --- /dev/null +++ b/ruoyi-extend/call-mcp-server/src/main/resources/application.yaml @@ -0,0 +1,16 @@ +server: + port: 9999 +spring: + ai: + openai: + api-key: sk-xXe1WMPjhlVb1aiI1b4c6c8934D8463f9e4b67Ed8718B772 + base-url: https://api.pandarobot.chat/ + mcp: + client: + enabled: true + name: call-mcp-server + sse: + connections: + server1: + url: http://127.0.0.1:6040 + diff --git a/ruoyi-extend/call-mcp-server/src/main/resources/mcp-server-bak.json b/ruoyi-extend/call-mcp-server/src/main/resources/mcp-server-bak.json new file mode 100644 index 00000000..842d6955 --- /dev/null +++ b/ruoyi-extend/call-mcp-server/src/main/resources/mcp-server-bak.json @@ -0,0 +1,40 @@ +{ + "mcpServers": { + "fileSystem": { + "command": "D:\\software\\nodeJs\\npx.cmd", + "args": [ + "-y", + "@modelcontextprotocol/server-filesystem", + "D:\\software\\sqlite" + ] + }, + "sqlLite": { + "command": "D:\\Program Files\\python3.12.3\\Scripts\\uvx.exe", + "args": [ + "mcp-server-sqlite", + "--db-path", + "D:\\work-space-study\\spring-ai-mcp-demo\\mcp-client\\src\\main\\resources\\test.db" + ] + }, + "fetch": { + "command": "D:\\Program Files\\python3.12.3\\Scripts\\uvx.exe", + "args": [ + "mcp-server-fetch" + ] + }, + "baidu-map": { + "command": "D:\\Program Files\\python3.12.3\\Scripts\\uvx.exe", + "args": [ + "run", + "--with", + "mcp[cli]", + "mcp", + "run", + "D:\\work-space-python\\python-baidu-map\\baidu_map_mcp_server\\map.py" + ], + "env": { + "BAIDU_MAPS_API_KEY": "{百度地图API-KEY}" + } + } + } +} \ No newline at end of file diff --git a/ruoyi-extend/call-mcp-server/src/main/resources/mcp-server.json b/ruoyi-extend/call-mcp-server/src/main/resources/mcp-server.json new file mode 100644 index 00000000..a639d152 --- /dev/null +++ b/ruoyi-extend/call-mcp-server/src/main/resources/mcp-server.json @@ -0,0 +1,20 @@ +{ + "mcpServers": { + "fileSystem": { + "command": "D:\\software\\nodeJs\\npx.cmd", + "args": [ + "-y", + "@modelcontextprotocol/server-filesystem", + "D:\\software\\sqlite" + ] + }, + "sqlLite": { + "command": "D:\\Program Files\\python3.12.3\\Scripts\\uvx.exe", + "args": [ + "mcp-server-sqlite", + "--db-path", + "D:\\work-space-study\\spring-ai-mcp-demo\\mcp-client\\src\\main\\resources\\test.db" + ] + } + } +} diff --git a/ruoyi-extend/call-mcp-server/src/main/resources/templates/index.html b/ruoyi-extend/call-mcp-server/src/main/resources/templates/index.html new file mode 100644 index 00000000..be98e857 --- /dev/null +++ b/ruoyi-extend/call-mcp-server/src/main/resources/templates/index.html @@ -0,0 +1,148 @@ + + + + + + AI 对话助手 + + + +
+ +
+

AI 对话助手

+

基于 Spring AI 的流式对话系统 By AhuCodingBeast

+
+ + +
+ +
+
+ 您好!我是AI助手,有什么可以帮您? +
+
+
+ + +
+ + +
+
+ + + + \ No newline at end of file diff --git a/ruoyi-extend/ruoyi-mcp-server/pom.xml b/ruoyi-extend/ruoyi-mcp-server/pom.xml index 63ff2bcf..d35402c7 100644 --- a/ruoyi-extend/ruoyi-mcp-server/pom.xml +++ b/ruoyi-extend/ruoyi-mcp-server/pom.xml @@ -49,16 +49,16 @@ spring-ai-mcp - - org.ruoyi - ruoyi-system-api - - - org.ruoyi - ruoyi-common-translation - - - + + + + + + + + + + diff --git a/ruoyi-extend/ruoyi-mcp-server/src/main/java/org/ruoyi/mcp/service/McpCustomService.java b/ruoyi-extend/ruoyi-mcp-server/src/main/java/org/ruoyi/mcp/service/McpCustomService.java index 5757dc84..1e693762 100644 --- a/ruoyi-extend/ruoyi-mcp-server/src/main/java/org/ruoyi/mcp/service/McpCustomService.java +++ b/ruoyi-extend/ruoyi-mcp-server/src/main/java/org/ruoyi/mcp/service/McpCustomService.java @@ -1,8 +1,5 @@ package org.ruoyi.mcp.service; -import lombok.RequiredArgsConstructor; -import org.ruoyi.system.domain.vo.SysUserVo; -import org.ruoyi.system.mapper.SysUserMapper; import org.springframework.ai.tool.annotation.Tool; import org.springframework.stereotype.Service; @@ -10,18 +7,14 @@ import org.springframework.stereotype.Service; * @author ageer */ @Service -@RequiredArgsConstructor public class McpCustomService { - private final SysUserMapper userMapper; - - public record User(String userName, Double userBalance) { + public record User(String userName, String userBalance) { } @Tool(description = "根据用户名称查询用户信息") public User getUserBalance(String username) { - SysUserVo sysUserVo = userMapper.selectUserByUserName(username); - return new User(sysUserVo.getUserName(),sysUserVo.getUserBalance()); + return new User("admin","99.99"); } } diff --git a/ruoyi-extend/ruoyi-mcp-server/src/main/resources/application-dev.yml b/ruoyi-extend/ruoyi-mcp-server/src/main/resources/application-dev.yml deleted file mode 100644 index dbdc1f3e..00000000 --- a/ruoyi-extend/ruoyi-mcp-server/src/main/resources/application-dev.yml +++ /dev/null @@ -1,97 +0,0 @@ ---- # 监控中心配置 -spring.boot.admin.client: - # 增加客户端开关 - enabled: false - url: http://localhost:9090/admin - instance: - service-host-type: IP - username: ruoyi - password: 123456 - ---- # 数据源配置 -spring: - datasource: - type: com.zaxxer.hikari.HikariDataSource - # 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content - dynamic: - # 性能分析插件(有性能损耗 不建议生产环境使用) - p6spy: true - # 设置默认的数据源或者数据源组,默认值即为 master - primary: master - # 严格模式 匹配不到数据源则报错 - strict: true - datasource: - # 主库数据源 - master: - type: ${spring.datasource.type} - driverClassName: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://43.139.70.230:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true - username: ry-vue - password: xx - - hikari: - # 最大连接池数量 - maxPoolSize: 20 - # 最小空闲线程数量 - minIdle: 10 - # 配置获取连接等待超时的时间 - connectionTimeout: 30000 - # 校验超时时间 - validationTimeout: 5000 - # 空闲连接存活最大时间,默认10分钟 - idleTimeout: 600000 - # 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟 - maxLifetime: 1800000 - # 连接测试query(配置检测连接是否有效) - connectionTestQuery: SELECT 1 - # 多久检查一次连接的活性 - keepaliveTime: 30000 - ---- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉) -spring.data: - redis: - # 地址 - host: 127.0.0.1 - # 端口,默认为6379 - port: 6379 - # 数据库索引 - database: 0 - # 密码(如没有密码请注释掉) - # password: 123456 - # 连接超时时间 - timeout: 10S - -redisson: - # redis key前缀 - keyPrefix: - # 线程池数量 - threads: 4 - # Netty线程池数量 - nettyThreads: 8 - # 单节点配置 - singleServerConfig: - # 客户端名称 - clientName: ${ruoyi.name} - # 最小空闲连接数 - connectionMinimumIdleSize: 8 - # 连接池大小 - connectionPoolSize: 32 - # 连接空闲超时,单位:毫秒 - idleConnectionTimeout: 10000 - # 命令等待超时,单位:毫秒 - timeout: 3000 - # 发布和订阅连接池大小 - subscriptionConnectionPoolSize: 50 - ---- # sms 短信 -sms: - enabled: false - # 阿里云 dysmsapi.aliyuncs.com - # 腾讯云 sms.tencentcloudapi.com - endpoint: "dysmsapi.aliyuncs.com" - accessKeyId: xxxxxxx - accessKeySecret: xxxxxx - signName: 测试 - # 腾讯专用 - sdkAppId: - diff --git a/ruoyi-extend/ruoyi-mcp-server/src/main/resources/application-mcp.yml b/ruoyi-extend/ruoyi-mcp-server/src/main/resources/application-mcp.yml deleted file mode 100644 index 57f9979d..00000000 --- a/ruoyi-extend/ruoyi-mcp-server/src/main/resources/application-mcp.yml +++ /dev/null @@ -1,10 +0,0 @@ -spring: - application: - name: mcp-server - ai: - mcp: - server: - name: webmvc-mcp-server - version: 1.0.0 - type: SYNC - sse-message-endpoint: /mcp/messages diff --git a/ruoyi-extend/ruoyi-mcp-server/src/main/resources/application.yml b/ruoyi-extend/ruoyi-mcp-server/src/main/resources/application.yml index 7bad7a51..82b2bdd9 100644 --- a/ruoyi-extend/ruoyi-mcp-server/src/main/resources/application.yml +++ b/ruoyi-extend/ruoyi-mcp-server/src/main/resources/application.yml @@ -1,332 +1,12 @@ - -# 项目相关配置 -ruoyi: - # 名称 - name: "ruoyi" - # 版本 - version: ${revision} - # 版权年份 - copyrightYear: 2025 - # 实例演示开关 - demoEnabled: true - # 获取ip地址开关 - addressEnabled: false - -captcha: - enable: false - # 页面 <参数设置> 可开启关闭 验证码校验 - # 验证码类型 math 数组计算 char 字符验证 - type: MATH - # line 线段干扰 circle 圆圈干扰 shear 扭曲干扰 - category: CIRCLE - # 数字验证码位数 - numberLength: 1 - # 字符验证码长度 - charLength: 4 - -# 开发环境配置 server: - # 服务器的HTTP端口,默认为8080 port: 6040 - servlet: - # 应用的访问路径 - context-path: / - # undertow 配置 - undertow: - # HTTP post内容的最大大小。当值为-1时,默认值为大小是无限的 - max-http-post-size: -1 - # 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理 - # 每块buffer的空间大小,越小的空间被利用越充分 - buffer-size: 512 - # 是否分配的直接内存 - direct-buffers: true - threads: - # 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程 - io: 8 - # 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载 - worker: 256 -# 用户配置 -user: - password: - # 密码最大错误次数 - maxRetryCount: 5 - # 密码锁定时间(默认10分钟) - lockTime: 10 - -# Spring配置 spring: application: - name: ${ruoyi.name} - # 资源信息 - messages: - # 国际化资源文件路径 - basename: i18n/messages - profiles: - active: @profiles.active@ - # 文件上传 - servlet: - multipart: - # 单个文件大小 - max-file-size: 50MB - # 设置总上传的文件大小 - max-request-size: 200MB - mvc: - format: - date-time: yyyy-MM-dd HH:mm:ss - jackson: - # 日期格式化 - date-format: yyyy-MM-dd HH:mm:ss - serialization: - # 格式化输出 - indent_output: false - # 忽略无法转换的对象 - fail_on_empty_beans: false - deserialization: - # 允许对象忽略json中不存在的属性 - fail_on_unknown_properties: false - -# Sa-Token配置 -sa-token: - # token名称 (同时也是cookie名称) - token-name: Authorization - # token有效期 设为7天 (必定过期) 单位: 秒 - timeout: 604800 - # token临时有效期 (指定时间无操作就过期) 单位: 秒 - activity-timeout: 604800 - # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) - is-concurrent: true - # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) - is-share: false - # 是否尝试从header里读取token - is-read-header: true - # 是否尝试从cookie里读取token - is-read-cookie: false - # token前缀 - token-prefix: "Bearer" - # jwt秘钥 - jwt-secret-key: abcdefghijklmnopqrstuvwxyz - -# security配置 -security: - # 排除路径 - excludes: - # 支付回调 - - /pay/returnUrl - - /pay/notifyUrl - # 上传文件 - - /resource/oss/upload - # 重置密码 - - /auth/reset/password - # 聊天接口 - - /chat - # 静态资源 - - /*.html - - /**/*.html - - /**/*.css - - /**/*.js - # 公共路径 - - /favicon.ico - - /error - # swagger 文档配置 - - /*/api-docs - - /*/api-docs/** - # actuator 监控配置 - - /actuator - - /actuator/** -# 多租户配置 -tenant: - # 是否开启 - enable: false - # 排除表 - excludes: - - sys_menu - - sys_tenant - - sys_tenant_package - - sys_role_dept - - sys_role_menu - - sys_user_post - - sys_user_role - -# MyBatisPlus配置 -# https://baomidou.com/config/ -mybatis-plus: - # 不支持多包, 如有需要可在注解配置 或 提升扫包等级 - # 例如 com.**.**.mapper - mapperPackage: org.ruoyi.**.mapper - # 对应的 XML 文件位置 - mapperLocations: classpath*:mapper/**/*Mapper.xml - # 实体扫描,多个package用逗号或者分号分隔 - typeAliasesPackage: org.ruoyi.**.domain - # 启动时是否检查 MyBatis XML 文件的存在,默认不检查 - checkConfigLocation: false - configuration: - # 自动驼峰命名规则(camel case)映射 - mapUnderscoreToCamelCase: true - # MyBatis 自动映射策略 - # NONE:不启用 PARTIAL:只对非嵌套 resultMap 自动映射 FULL:对所有 resultMap 自动映射 - autoMappingBehavior: FULL - # MyBatis 自动映射时未知列或未知属性处理策 - # NONE:不做处理 WARNING:打印相关警告 FAILING:抛出异常和详细信息 - autoMappingUnknownColumnBehavior: NONE - # 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl - # 关闭日志记录 (可单纯使用 p6spy 分析) org.apache.ibatis.logging.nologging.NoLoggingImpl - # 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl - logImpl: org.apache.ibatis.logging.nologging.NoLoggingImpl - global-config: - # 是否打印 Logo banner - banner: true - dbConfig: - # 主键类型 - # AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID - idType: ASSIGN_ID - # 逻辑已删除值 - logicDeleteValue: 2 - # 逻辑未删除值 - logicNotDeleteValue: 0 - # 字段验证策略之 insert,在 insert 的时候的字段验证策略 - # IGNORED 忽略 NOT_NULL 非NULL NOT_EMPTY 非空 DEFAULT 默认 NEVER 不加入 SQL - insertStrategy: NOT_NULL - # 字段验证策略之 update,在 update 的时候的字段验证策略 - updateStrategy: NOT_NULL - # 字段验证策略之 select,在 select 的时候的字段验证策略既 wrapper 根据内部 entity 生成的 where 条件 - where-strategy: NOT_NULL - -# 数据加密 -mybatis-encryptor: - # 是否开启加密 - enable: false - # 默认加密算法 - algorithm: BASE64 - # 编码方式 BASE64/HEX。默认BASE64 - encode: BASE64 - # 安全秘钥 对称算法的秘钥 如:AES,SM4 - password: - # 公私钥 非对称算法的公私钥 如:SM2,RSA - publicKey: - privateKey: - -# Swagger配置 -swagger: - info: - # 标题 - title: '标题:${ruoyi.name}多租户管理系统_接口文档' - # 描述 - description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...' - # 版本 - version: '版本号: ${ruoyi.version}' - # 作者信息 - contact: - name: ageerle - email: ageerle@163.com - url: https://gitee.com/ageerle/ruoyi-ai - components: - # 鉴权方式配置 - security-schemes: - apiKey: - type: APIKEY - in: HEADER - name: ${sa-token.token-name} - -springdoc: - api-docs: - # 是否开启接口文档 - enabled: true - swagger-ui: - # 持久化认证数据 - persistAuthorization: true - #这里定义了两个分组,可定义多个,也可以不定义 - group-configs: - - group: 1.演示模块 - packages-to-scan: org.ruoyi.demo - - group: 2.通用模块 - packages-to-scan: org.ruoyi.web - - group: 3.系统模块 - packages-to-scan: org.ruoyi.system - - group: 4.代码生成模块 - packages-to-scan: org.ruoyi.generator - -# 防止XSS攻击 -xss: - # 过滤开关 - enabled: true - # 排除链接(多个用逗号分隔) - excludes: /system/notice - # 匹配链接 - urlPatterns: /system/*,/monitor/*,/tool/* - -# 全局线程池相关配置 -thread-pool: - # 是否开启线程池 - enabled: false - # 队列最大长度 - queueCapacity: 128 - # 线程池维护线程所允许的空闲时间 - keepAliveSeconds: 300 - ---- # 分布式锁 lock4j 全局配置 -lock4j: - # 获取分布式锁超时时间,默认为 3000 毫秒 - acquire-timeout: 3000 - # 分布式锁的超时时间,默认为 30 秒 - expire: 30000 - ---- # Actuator 监控端点的配置项 -management: - endpoints: - web: - exposure: - include: '*' - endpoint: - health: - show-details: ALWAYS - logfile: - external-file: ./logs/sys-console.log - -# websocket -websocket: - enabled: true - # 路径 - path: '/resource/websocket' - # 设置访问源地址 - allowedOrigins: '*' - -# 微信小程序配置信息 -wx: - miniapp: - configs: - - appid: # 你的appid - secret: # 你的secret - token: #微信小程序消息服务器配置的token - aesKey: #微信小程序消息服务器配置的EncodingAESKey - msgDataFormat: JSON - - # 企业微信应用 -wechat: - cp: - corpId: - appConfigs: - - agentId: - secret: '' - token: '' - aesKey: '' - -spring: + name: mcp-server ai: - openai: - api-key: sk-xX - base-url: https://api.pandarobot.chat - ollama: - base-url: http://localhost:11434 - init: - pull-model-strategy: always - timeout: 60s - max-retries: 1 mcp: - client: - enabled: true - name: call-mcp-server - sse: - connections: - server1: - url: http://127.0.0.1:8080 - + server: + name: webmvc-mcp-server + version: 1.0.0 + type: SYNC + sse-message-endpoint: /mcp/messages