File tree Expand file tree Collapse file tree 3 files changed +5
-1
lines changed
examples/filesystem_stdio_client Expand file tree Collapse file tree 3 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,13 @@ type StdioMCPClient struct {
3636// Returns an error if the subprocess cannot be started or the pipes cannot be created.
3737func NewStdioMCPClient (
3838 command string ,
39+ env []string ,
3940 args ... string ,
4041) (* StdioMCPClient , error ) {
4142 cmd := exec .Command (command , args ... )
4243
44+ cmd .Env = env
45+
4346 stdin , err := cmd .StdinPipe ()
4447 if err != nil {
4548 return nil , fmt .Errorf ("failed to create stdin pipe: %w" , err )
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ func TestStdioMCPClient(t *testing.T) {
3434 }
3535 defer os .Remove (mockServerPath )
3636
37- client , err := NewStdioMCPClient (mockServerPath )
37+ client , err := NewStdioMCPClient (mockServerPath , [] string {} )
3838 if err != nil {
3939 t .Fatalf ("Failed to create client: %v" , err )
4040 }
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ func main() {
1616 // Using npx to run the filesystem server with /tmp as the only allowed directory
1717 c , err := client .NewStdioMCPClient (
1818 "go" ,
19+ []string {}, // Empty ENV
1920 "run" ,
2021 "github.com/mark3labs/mcp-filesystem-server@latest" ,
2122 "/tmp" ,
You can’t perform that action at this time.
0 commit comments