File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
mcp/src/test/java/io/modelcontextprotocol/client Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,20 @@ class StdioMcpAsyncClientTests extends AbstractMcpAsyncClientTests {
23
23
@ Override
24
24
protected McpClientTransport createMcpTransport () {
25
25
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
+
26
30
if (System .getProperty ("os.name" ).toLowerCase ().contains ("win" )) {
27
31
stdioParams = ServerParameters .builder ("./node/npx.cmd" )
28
32
.args ("-y" , "@modelcontextprotocol/server-everything" , "stdio" )
33
+ .addEnvVar ("PATH" , newPath )
29
34
.build ();
30
35
}
31
36
else {
32
37
stdioParams = ServerParameters .builder ("./node/npx" )
33
38
.args ("-y" , "@modelcontextprotocol/server-everything" , "stdio" )
39
+ .addEnvVar ("PATH" , newPath )
34
40
.build ();
35
41
}
36
42
return new StdioClientTransport (stdioParams );
Original file line number Diff line number Diff line change @@ -31,14 +31,20 @@ class StdioMcpSyncClientTests extends AbstractMcpSyncClientTests {
31
31
@ Override
32
32
protected McpClientTransport createMcpTransport () {
33
33
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
+
34
38
if (System .getProperty ("os.name" ).toLowerCase ().contains ("win" )) {
35
39
stdioParams = ServerParameters .builder ("./node/npx.cmd" )
36
40
.args ("-y" , "@modelcontextprotocol/server-everything" , "stdio" )
41
+ .addEnvVar ("PATH" , newPath )
37
42
.build ();
38
43
}
39
44
else {
40
45
stdioParams = ServerParameters .builder ("./node/npx" )
41
46
.args ("-y" , "@modelcontextprotocol/server-everything" , "stdio" )
47
+ .addEnvVar ("PATH" , newPath )
42
48
.build ();
43
49
}
44
50
return new StdioClientTransport (stdioParams );
You can’t perform that action at this time.
0 commit comments