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 {
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 );
Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments