Skip to content

Commit 38fd0f9

Browse files
committed
sigh
1 parent 929c3e1 commit 38fd0f9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

mcp/src/test/java/io/modelcontextprotocol/client/StdioMcpAsyncClientTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,20 @@ class StdioMcpAsyncClientTests extends AbstractMcpAsyncClientTests {
2323
@Override
2424
protected McpClientTransport createMcpTransport() {
2525
ServerParameters stdioParams;
26+
String currentPath = System.getenv("PATH");
27+
String nodePath = System.getProperty("user.dir") + "/node";
28+
String newPath = nodePath + (currentPath != null ? System.getProperty("path.separator") + currentPath : "");
29+
2630
if (System.getProperty("os.name").toLowerCase().contains("win")) {
2731
stdioParams = ServerParameters.builder("./node/npx.cmd")
2832
.args("-y", "@modelcontextprotocol/server-everything", "stdio")
33+
.addEnvVar("PATH", newPath)
2934
.build();
3035
}
3136
else {
3237
stdioParams = ServerParameters.builder("./node/npx")
3338
.args("-y", "@modelcontextprotocol/server-everything", "stdio")
39+
.addEnvVar("PATH", newPath)
3440
.build();
3541
}
3642
return new StdioClientTransport(stdioParams);

mcp/src/test/java/io/modelcontextprotocol/client/StdioMcpSyncClientTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,20 @@ class StdioMcpSyncClientTests extends AbstractMcpSyncClientTests {
3131
@Override
3232
protected McpClientTransport createMcpTransport() {
3333
ServerParameters stdioParams;
34+
String currentPath = System.getenv("PATH");
35+
String nodePath = System.getProperty("user.dir") + "/node";
36+
String newPath = nodePath + (currentPath != null ? System.getProperty("path.separator") + currentPath : "");
37+
3438
if (System.getProperty("os.name").toLowerCase().contains("win")) {
3539
stdioParams = ServerParameters.builder("./node/npx.cmd")
3640
.args("-y", "@modelcontextprotocol/server-everything", "stdio")
41+
.addEnvVar("PATH", newPath)
3742
.build();
3843
}
3944
else {
4045
stdioParams = ServerParameters.builder("./node/npx")
4146
.args("-y", "@modelcontextprotocol/server-everything", "stdio")
47+
.addEnvVar("PATH", newPath)
4248
.build();
4349
}
4450
return new StdioClientTransport(stdioParams);

0 commit comments

Comments
 (0)