fix(tests): Failed to start process with command npx on Windows (#85)
* fix(tests): Failed to start process with command npx on Windows platform while running mvn test
This commit is contained in:
parent
e401e9e848
commit
79ec5b5ed1
2 changed files with 22 additions and 7 deletions
|
|
@ -22,9 +22,17 @@ class StdioMcpAsyncClientTests extends AbstractMcpAsyncClientTests {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected McpClientTransport createMcpTransport() {
|
protected McpClientTransport createMcpTransport() {
|
||||||
ServerParameters stdioParams = ServerParameters.builder("npx")
|
ServerParameters stdioParams;
|
||||||
.args("-y", "@modelcontextprotocol/server-everything", "dir")
|
if (System.getProperty("os.name").toLowerCase().contains("win")) {
|
||||||
.build();
|
stdioParams = ServerParameters.builder("cmd.exe")
|
||||||
|
.args("/c", "npx.cmd", "-y", "@modelcontextprotocol/server-everything", "dir")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stdioParams = ServerParameters.builder("npx")
|
||||||
|
.args("-y", "@modelcontextprotocol/server-everything", "dir")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
return new StdioClientTransport(stdioParams);
|
return new StdioClientTransport(stdioParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,17 @@ class StdioMcpSyncClientTests extends AbstractMcpSyncClientTests {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected McpClientTransport createMcpTransport() {
|
protected McpClientTransport createMcpTransport() {
|
||||||
ServerParameters stdioParams = ServerParameters.builder("npx")
|
ServerParameters stdioParams;
|
||||||
.args("-y", "@modelcontextprotocol/server-everything", "dir")
|
if (System.getProperty("os.name").toLowerCase().contains("win")) {
|
||||||
.build();
|
stdioParams = ServerParameters.builder("cmd.exe")
|
||||||
|
.args("/c", "npx.cmd", "-y", "@modelcontextprotocol/server-everything", "dir")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stdioParams = ServerParameters.builder("npx")
|
||||||
|
.args("-y", "@modelcontextprotocol/server-everything", "dir")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
return new StdioClientTransport(stdioParams);
|
return new StdioClientTransport(stdioParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue