Files
spring-ai-skill/pom.xml
T
hughhuangandClaude Sonnet 4.5 581f731de3 feat: 集成 MCP 工具支持
- 添加 spring-ai-starter-mcp-client 依赖
- 创建 Node.js MCP 服务器(risk-cost-server)
- 在 Application.java 中配置 MCP 工具回调
- 添加 get_customer_risk_cost 工具(返回 1.2%-2.5% 的风险成本率)
- 支持通过 FunctionToolCallback 调用 MCP 工具
- 更新系统提示,指导 AI 使用 MCP 工具
- 降级 Spring AI 到 1.1.2 版本

技术实现:
- 使用 FunctionToolCallback 包装 MCP 工具
- 通过 Stdio 方式与 MCP 服务器通信
- JSON-RPC 协议调用工具

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-29 20:58:16 +08:00

127 lines
3.4 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.0.1</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>org.springaicommunity</groupId>
<artifactId>skills-demo</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>skills-demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
<maven.deploy.skip>true</maven.deploy.skip>
<spring-ai.version>1.1.2</spring-ai.version>
</properties>
<dependencies>
<!-- Spring Web for RestClient -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springaicommunity</groupId>
<artifactId>spring-ai-agent-utils</artifactId>
<version>0.4.2</version>
</dependency>
<!-- <dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-model-anthropic</artifactId>
</dependency> -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-model-openai-sdk</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-model-google-genai</artifactId>
</dependency> -->
<!-- MCP Client Support -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-mcp-client</artifactId>
</dependency>
<!-- Netty DNS resolver for macOS -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<classifier>osx-aarch_64</classifier>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-bom</artifactId>
<version>${spring-ai.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<name>Central Portal Snapshots</name>
<id>central-portal-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>