# spring-ai-client-demo
**Repository Path**: whitebones/spring-ai-client-demo
## Basic Information
- **Project Name**: spring-ai-client-demo
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2025-04-07
- **Last Updated**: 2025-04-07
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
以SpringAI 1.0.0-SNAPSHOT为例
依赖:
- JDK17以上
- SpringBoot3.3
加入POM依赖:
由于是快照版,因此需要额外引入依赖管理:
```xml
org.springframework.ai
spring-ai-bom
1.0.0-SNAPSHOT
pom
import
```
加入SpringBoot依赖:
```xml
org.springframework.boot
spring-boot-starter-parent
3.4.4
org.springframework.boot
spring-boot-starter
```
加入AI模型依赖:
```xml
org.springframework.ai
spring-ai-starter-model-openai
```
如果使用MCP工具,则需要加入依赖
```xml
org.springframework.ai
spring-ai-starter-mcp-client
```
如果使用工具,不能使用OpenRouter的API,否则会抛不支持工具。 可以换成DeepSeek的API和Token。
下面是配置了一个文件系统操作的工具配置:
```json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/lhg/Desktop",
"/Users/lhg/Downloads"
]
}
}
}
```
该工具是由ts开发,需要先安装node环境,然后执行npx -y @modelcontextprotocol/server-filesystem /Users/lhg/Desktop /Users/lhg/Downloads
测试成功后再配置到配置文件中(因为终端测试出错方便调试,直接配置到该项目上出错不太容易看)。
- command是服务器的启动命令
- args是启动参数,没个参数占一个元素。其中/Users/lhg/Desktop和/Users/lhg/Downloads,是这个工具需要的参数,含义是定义允许操作的文件夹,可以增加更多。
如果是windows系统,需要调整下command和args参数,因为winodws下使用cmd来执行命令的,要改为下面配置:
```json
{
"mcpServers": {
"filesystem": {
"command": "cmd", <--这里改为cmd
"args": [
"/c", <--注意这里多个/c参数
"npx",
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/lhg/Desktop",
"/Users/lhg/Downloads"
]
}
}
}
```
更多工具参考https://github.com/modelcontextprotocol/servers,多是typescript或python开发的。