Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

package org.springframework.ai.mcp.client.autoconfigure.properties;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi - no star imports

import java.util.stream.Collectors;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand All @@ -45,6 +43,10 @@ public class McpStdioClientProperties {

public static final String CONFIG_PREFIX = "spring.ai.mcp.client.stdio";

private static final List<String> WIN_COMMAND = List.of("npx");

private static final String OS_NAME = System.getProperty("os.name").toLowerCase();

/**
* Resource containing the MCP servers configuration.
* <p>
Expand Down Expand Up @@ -128,6 +130,11 @@ public record Parameters(
@JsonProperty("env") Map<String, String> env) {

public ServerParameters toServerParameters() {
if (OS_NAME.contains("win") && WIN_COMMAND.contains(command)) {
List<String> winArgs = new LinkedList<>(Arrays.asList("/c", this.command()));
winArgs.addAll(this.args);
return ServerParameters.builder("cmd.exe").args(winArgs).env(this.env()).build();
}
return ServerParameters.builder(this.command()).args(this.args()).env(this.env()).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public EvaluationResponse evaluate(EvaluationRequest evaluationRequest) {
.call()
.content();

boolean passing = evaluationResponse.equalsIgnoreCase("yes");
boolean passing = evaluationResponse.toLowerCase().contains("yes");
return new EvaluationResponse(passing, "", Collections.emptyMap());
}

Expand Down