align with last auto-conf changes
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
package org.springframework.ai.mcp.samples.brave;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
import org.springframework.ai.autoconfigure.mcp.client.stdio.McpClientDefinitions;
|
||||
import org.springframework.ai.chat.client.ChatClient;
|
||||
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
|
||||
import org.springframework.ai.chat.memory.InMemoryChatMemory;
|
||||
import org.springframework.ai.mcp.McpToolUtils;
|
||||
import org.springframework.ai.tool.ToolCallback;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -20,15 +20,13 @@ public class Application {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandLineRunner chatbot(ChatClient.Builder chatClientBuilder, McpClientDefinitions mcpClientDefinitions) {
|
||||
public CommandLineRunner chatbot(ChatClient.Builder chatClientBuilder, List<ToolCallback> tools) {
|
||||
|
||||
return args -> {
|
||||
|
||||
var mcpClients = mcpClientDefinitions.toMcpSyncClients();
|
||||
|
||||
var chatClient = chatClientBuilder
|
||||
.defaultSystem("You are useful assistant, expert in AI and Java.")
|
||||
.defaultTools(McpToolUtils.getToolCallbacks(mcpClients))
|
||||
.defaultTools(tools)
|
||||
.defaultAdvisors(new MessageChatMemoryAdvisor(new InMemoryChatMemory()))
|
||||
.build();
|
||||
|
||||
|
||||
@@ -41,14 +41,14 @@
|
||||
<artifactId>spring-ai-mcp-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
|
||||
</dependency> -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-anthropic-spring-boot-starter</artifactId>
|
||||
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-anthropic-spring-boot-starter</artifactId>
|
||||
</dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
spring.application.name=mcp
|
||||
spring.main.web-application-type=none
|
||||
|
||||
# spring.ai.openai.api-key=${OPENAI_API_KEY}
|
||||
spring.ai.openai.api-key=${OPENAI_API_KEY}
|
||||
spring.ai.anthropic.api-key=${ANTHROPIC_API_KEY}
|
||||
|
||||
spring.ai.mcp.client.stdio.enabled=true
|
||||
|
||||
@@ -7,7 +7,7 @@ logging.pattern.console=
|
||||
|
||||
spring.ai.mcp.server.enabled=true
|
||||
|
||||
spring.ai.mcp.server.name=my-wather-server
|
||||
spring.ai.mcp.server.name=my-weather-server
|
||||
spring.ai.mcp.server.version=0.0.1
|
||||
|
||||
logging.file.name=./model-context-protocol/mcp-weather-server-quickstart/target/mcp.weather-quickstart.log
|
||||
|
||||
Reference in New Issue
Block a user