diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..325013c --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..8b8aad9 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..ee01d94 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..67e1e61 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..af5cbac --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1751008087769 + + + + + + \ No newline at end of file diff --git a/crm-mcp/src/main/java/net/rzdata/mcp/server/crm/CrmMcpService.java b/crm-mcp/src/main/java/net/rzdata/mcp/server/crm/CrmMcpService.java index b3a5661..60a824c 100644 --- a/crm-mcp/src/main/java/net/rzdata/mcp/server/crm/CrmMcpService.java +++ b/crm-mcp/src/main/java/net/rzdata/mcp/server/crm/CrmMcpService.java @@ -31,7 +31,7 @@ public class CrmMcpService { } - @Tool(description = "根据客户名称或客户编码查询客户负责人。clientCode和clientName必须二选一。如果都提取不到则输出:请提供需要查询的客户。如果提取到多个值则输出:目前只能查询单个客户数据") + @Tool(description = "根据客户名称或客户编码查询客户负责人。并返回相关的信息") public String getClientResponsible( @ToolParam(description = "客户编码,一般类似于'XX.XX.XXXX.XXX'格式,例如:01.01.0023.024。与clientName必须二选一", required = false) String clientCode, @ToolParam(description = "客户名称,一般类似于'某某课题组'或'某某公司'或'某某实验室'或'某某经营部'或'某某研究院'或'某某研究所'或'某某测试'等组织,例如:张三课题组,广州小懒科技有限公司,金域测试、金域课题组111、玉尘测试A01、睿展小组3号。与clientCode必须二选一", required = false) String clientName @@ -47,7 +47,7 @@ public class CrmMcpService { return executeRequest("ai/query/getClientResponsible", requestBody); } - @Tool(description = "根据订单编码(即订单号)查询订单负责人。orderCode是必填项,如果提取不到则输出:请告知需要查询的订单号") + @Tool(description = "根据订单编码(即订单号)查询订单负责人。并返回相关的信息") public String getOrderSaller( @ToolParam(description = "订单编码(即订单号),值一般是由字母、数字和'-'组成,特征一般类似于'NJ00027202506090001',或'NJ00027202506090001-G'或'NJ00027202506090001-T-1',或'dev-NJ00027202506090001'") String orderCode ) { @@ -59,12 +59,12 @@ public class CrmMcpService { return executeRequest("ai/query/getOrderSaller", requestBody); } - @Tool(description = "根据客户名称或客户编码查询某个时间段内的订单销售额。clientCode和clientName必须二选一。如果都提取不到则输出:请提供需要查询的客户。如果提取到多个值则输出:目前只能查询单个客户数据。对于'去年'、'今年'这种时间词,需要结合当前系统时间来判断") + @Tool(description = "根据客户名称或客户编码查询某个时间段内的订单销售额。并返回相关的信息") public String sumOrderTotalForClientInTime( @ToolParam(description = "客户编码,一般类似于'XX.XX.XXXX.XXX'格式,例如:01.01.0023.024。与clientName必须二选一", required = false) String clientCode, @ToolParam(description = "客户名称,一般类似于'某某课题组'或'某某公司'或'某某实验室'或'某某经营部'或'某某研究院'或'某某研究所'或'某某测试'等组织,例如:张三课题组,广州小懒科技有限公司,金域测试、金域课题组111、玉尘测试A01、睿展小组3号。与clientCode必须二选一", required = false) String clientName, @ToolParam(description = "开始时间,一般类似于'yyyy-MM-dd HH:mm:ss'格式,例如:2024-01-01 00:00:00。非必填", required = false) String startTime, - @ToolParam(description = "结束时间,一般类似于'yyyy-MM-dd HH:mm:ss'格式,例如:2024-01-01 00:00:00。非必填", required = false) String endTime + @ToolParam(description = "结束时间,一般类似于'yyyy-MM-dd HH:mm:ss'格式,例如:2024-12-31 00:00:00。非必填", required = false) String endTime ) { JSONObject requestBody = new JSONObject(); @@ -76,13 +76,13 @@ public class CrmMcpService { return executeRequest("ai/query/sumOrderTotalForClientInTime", requestBody); } - @Tool(description = "根据客户名称或客户编码查询某个时间段内购买的某个产品货号的数量。clientCode和clientName必须二选一。如果都提取不到则输出:请提供需要查询的客户。productnum必填,如果提取不到则输出:请提供需要查询的货号。startTime和endTime必填,如果提取不到则输出:请提供需要查询的采购时间范围") + @Tool(description = "根据客户名称或客户编码查询某个时间段内购买的某个产品货号的数量。并返回相关的信息") public String sumProductNumForClientInTime( @ToolParam(description = "客户编码,一般类似于'XX.XX.XXXX.XXX'格式,例如:01.01.0023.024。与clientName必须二选一", required = false) String clientCode, @ToolParam(description = "客户名称,一般类似于'某某课题组'或'某某公司'或'某某实验室'或'某某经营部'或'某某研究院'或'某某研究所'等组织,例如:张三课题组,广州小懒科技有限公司。与clientCode必须二选一", required = false) String clientName, - @ToolParam(description = "产品货号,一般类似于'XXXX-XX'格式,例如:C112-01。必填参数", required = false) String productnum, - @ToolParam(description = "采购开始时间,一般类似于'yyyy-MM-dd HH:mm:ss'格式,例如:2024-01-01 00:00:00。必填参数", required = false) String startTime, - @ToolParam(description = "采购结束时间,一般类似于'yyyy-MM-dd HH:mm:ss'格式,例如:2024-01-01 00:00:00。必填参数", required = false) String endTime + @ToolParam(description = "产品货号,一般类似于'XXXX-XX'格式,例如:C112-01。", required = false) String productnum, + @ToolParam(description = "开始时间,一般类似于'yyyy-MM-dd HH:mm:ss'格式,例如:2024-01-01 00:00:00。", required = false) String startTime, + @ToolParam(description = "结束时间,一般类似于'yyyy-MM-dd HH:mm:ss'格式,例如:2024-12-31 00:00:00。", required = false) String endTime ) { JSONObject requestBody = new JSONObject(); requestBody.put("clientCode", clientCode); @@ -94,7 +94,7 @@ public class CrmMcpService { return executeRequest("ai/query/sumProductNumForClientInTime", requestBody); } - @Tool(description = "根据订单编码(即订单号)查询订单购买的产品明细。orderCode是必填项,如果提取不到则输出:请告知需要查询的订单号") + @Tool(description = "根据订单编码(即订单号)查询订单购买的产品明细,订单编码(即订单号),值一般是由字母、数字和'-'组成,特征一般类似于'NJ00027202506090001',或'NJ00027202506090001-G'或'NJ00027202506090001-T-1',或'dev-NJ00027202506090001'。并返回相关的信息") public String detailOrderProduct( @ToolParam(description = "订单编码(即订单号),值一般是由字母、数字和'-'组成,特征一般类似于'NJ00027202506090001',或'NJ00027202506090001-G'或'NJ00027202506090001-T-1',或'dev-NJ00027202506090001'") String orderCode ) { @@ -106,7 +106,7 @@ public class CrmMcpService { return executeRequest("ai/query/detailOrderProduct", requestBody); } - @Tool(description = "根据客户名称或客户编码查询某个时间段内购买的产品主货号列表") + @Tool(description = "根据客户名称或客户编码查询某个时间段内购买的产品主货号列表。并返回相关的信息") public String listProductForClientInTime( @ToolParam(description = "客户编码,一般类似于'XX.XX.XXXX.XXX'格式,例如:01.01.0023.024。与clientName必须二选一", required = false) String clientCode, @ToolParam(description = "客户名称,一般类似于'某某课题组'或'某某公司'或'某某实验室'或'某某经营部'或'某某研究院'或'某某研究所'或'某某测试'等组织,例如:张三课题组,广州小懒科技有限公司,金域测试、金域课题组111、玉尘测试A01、睿展小组3号。与clientCode必须二选一", required = false) String clientName, @@ -122,7 +122,7 @@ public class CrmMcpService { return executeRequest("ai/query/listProductForClientInTime", requestBody); } - @Tool(description = "查询客户在某个时间段内的欠款额") + @Tool(description = "查询客户在某个时间段内的欠款额。并返回相关的信息") public String getUnpaidAmountForClient( @ToolParam(description = "客户编码,一般类似于'XX.XX.XXXX.XXX'格式,例如:01.01.0023.024。与clientName必须二选一", required = false) String clientCode, @ToolParam(description = "客户名称,一般类似于'某某课题组'或'某某公司'或'某某实验室'或'某某经营部'或'某某研究院'或'某某研究所'或'某某测试'等组织,例如:张三课题组,广州小懒科技有限公司,金域测试、金域课题组111、玉尘测试A01、睿展小组3号。与clientCode必须二选一", required = false) String clientName, @@ -138,7 +138,7 @@ public class CrmMcpService { return executeRequest("ai/query/getUnpaidAmountForClient", requestBody); } - @Tool(description = "根据主货号查询某个时间段内购买过该产品的客户名称列表") + @Tool(description = "根据主货号查询某个时间段内购买过该产品的客户名称列表。并返回相关的信息") public String listClientsByMainNumInTime( @ToolParam(description = "主货号,一般类似于'XXXX-XXXX'格式,例如:1234-5678", required = false) String mainNum, @ToolParam(description = "开始时间,一般类似于'yyyy-MM-dd HH:mm:ss'格式,例如:2024-01-01 00:00:00。非必填", required = false) String startTime, @@ -152,7 +152,7 @@ public class CrmMcpService { return executeRequest("ai/query/listClientsByMainNumInTime", requestBody); } - @Tool(description = "根据客户编码或客户名称查询时间区间内的订单列表") + @Tool(description = "根据客户编码或客户名称查询时间区间内的订单列表。并返回相关的信息") public String listOrdersByClientInTime( @ToolParam(description = "客户编码,一般类似于'XX.XX.XXXX.XXX'格式,例如:01.01.0023.024。与clientName必须二选一", required = false) String clientCode, @ToolParam(description = "客户名称,一般类似于'某某课题组'或'某某公司'或'某某实验室'或'某某经营部'或'某某研究院'或'某某研究所'或'某某测试'等组织,例如:张三课题组,广州小懒科技有限公司,金域测试、金域课题组111、玉尘测试A01、睿展小组3号。与clientCode必须二选一", required = false) String clientName, @@ -168,7 +168,7 @@ public class CrmMcpService { return executeRequest("ai/query/listOrdersByClientInTime", requestBody); } - @Tool(description = "根据订单编码查询订单信息。orderCode是必填项,如果提取不到则输出:请告知需要查询的订单号") + @Tool(description = "根据订单编码(即订单号)查询订单信息。并返回相关的信息") public JSONObject getOrderInfoByCode( @ToolParam(description = "订单编码(即订单号),值一般是由字母、数字和'-'组成,特征一般类似于'NJ00027202506090001',或'NJ00027202506090001-G'或'NJ00027202506090001-T-1',或'dev-NJ00027202506090001'") String orderCode ) { @@ -181,7 +181,7 @@ public class CrmMcpService { return JSONObject.parseObject(executed); } - @Tool(description = "根据合同编码查询下游订单编码列表。contractCode是必填项,如果提取不到则输出:请告知需要查询的合同编码") + @Tool(description = "根据合同编码查询下游订单编码列表。并返回相关的信息") public String listOrdersByContractCode( @ToolParam(description = "合同编码,值一般是由字母、数字和'-'组成的合同标识符") String contractCode ) { @@ -197,6 +197,4 @@ public class CrmMcpService { public String getCurrentTime() { return DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"); } - - -} +} \ No newline at end of file diff --git a/crm-mcp/target/classes/application-dev.yml b/crm-mcp/target/classes/application-dev.yml new file mode 100644 index 0000000..d9109d3 --- /dev/null +++ b/crm-mcp/target/classes/application-dev.yml @@ -0,0 +1,20 @@ +crm: + url: https://www.rzdata.net/bcrm-statis-jwt/ + tenantId: BIO + token: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJJUXdrczhuUWc4NnJPQkpuenJDUThtbjl1N3FEQ2lWZyJ9.91GO7OMhVbc0tLBRZ7HYiFDEA92PXE7H1gHduwxWu2I + +spring: + webflux: + base-path: /crm-mcp + ai: + mcp: + server: + name: crm-mcp-server + version: 0.0.1 + type: ASYNC + # 配置 URL 前缀 + base-url: /crm-mcp + # 配置 sse 的根路径,默认值为 /sse + sse-endpoint: /sse + sse-message-endpoint: /mcp + diff --git a/crm-mcp/target/classes/application.yml b/crm-mcp/target/classes/application.yml new file mode 100644 index 0000000..a93a38f --- /dev/null +++ b/crm-mcp/target/classes/application.yml @@ -0,0 +1,43 @@ +# +# Copyright 2025-2026 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# spring.main.web-application-type=none + +# NOTE: You must disable the banner and the console logging +# to allow the STDIO transport to work !!! +# Config reference: https://docs.spring.io/spring-ai/reference/api/mcp/mcp-server-boot-starter-docs.html#_webflux_server_configuration +spring: + main: + banner-mode: off + profiles: + active: dev + ai: + mcp: + server: + name: crm-mcp-server + version: 0.0.1 + type: ASYNC # Recommended for reactive applications + # 配置 sse 的根路径,包含前缀 /crm-mcp + # 下面的最终路径为 ip:port/crm-mcp/sse/mcp + sse-endpoint: /crm-mcp/sse + sse-message-endpoint: /mcp + capabilities: + tool: true + resource: true + prompt: true + completion: true + +# logging.pattern.console= diff --git a/crm-mcp/target/classes/net/rzdata/mcp/server/crm/CrmMcpService.class b/crm-mcp/target/classes/net/rzdata/mcp/server/crm/CrmMcpService.class new file mode 100644 index 0000000..8a533b6 Binary files /dev/null and b/crm-mcp/target/classes/net/rzdata/mcp/server/crm/CrmMcpService.class differ diff --git a/crm-mcp/target/classes/net/rzdata/mcp/server/crm/McpServerApplication.class b/crm-mcp/target/classes/net/rzdata/mcp/server/crm/McpServerApplication.class new file mode 100644 index 0000000..510c824 Binary files /dev/null and b/crm-mcp/target/classes/net/rzdata/mcp/server/crm/McpServerApplication.class differ diff --git a/crm-mcp/target/classes/net/rzdata/mcp/server/crm/config/CrmProperties.class b/crm-mcp/target/classes/net/rzdata/mcp/server/crm/config/CrmProperties.class new file mode 100644 index 0000000..b0cea58 Binary files /dev/null and b/crm-mcp/target/classes/net/rzdata/mcp/server/crm/config/CrmProperties.class differ