2025-07-18 16:52:25 +00:00
|
|
|
package com.example.springaidemo;
|
|
|
|
|
2025-07-26 09:54:35 +00:00
|
|
|
import com.example.springaidemo.tool.McpDemoTool;
|
|
|
|
import org.springframework.ai.tool.ToolCallbackProvider;
|
|
|
|
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
|
2025-07-18 16:52:25 +00:00
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
2025-07-26 09:54:35 +00:00
|
|
|
import org.springframework.context.annotation.Bean;
|
2025-07-18 16:52:25 +00:00
|
|
|
|
|
|
|
@SpringBootApplication
|
|
|
|
public class SpringAiDemoApplication {
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
String proxy = "127.0.0.1";
|
|
|
|
int port = 7897;
|
|
|
|
System.setProperty("proxyType", "4");
|
|
|
|
System.setProperty("proxyPort", String.valueOf(port));
|
|
|
|
System.setProperty("proxyHost", proxy);
|
|
|
|
System.setProperty("proxySet", "true");
|
|
|
|
SpringApplication.run(SpringAiDemoApplication.class, args);
|
|
|
|
}
|
2025-07-26 09:54:35 +00:00
|
|
|
|
|
|
|
@Bean
|
|
|
|
public ToolCallbackProvider heroInfoTool(McpDemoTool mcpDemoTool) {
|
|
|
|
return MethodToolCallbackProvider.builder().toolObjects(mcpDemoTool).build();
|
|
|
|
}
|
2025-07-18 16:52:25 +00:00
|
|
|
}
|