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 {
36
36
// Returns an error if the subprocess cannot be started or the pipes cannot be created.
37
37
func NewStdioMCPClient (
38
38
command string ,
39
+ env []string ,
39
40
args ... string ,
40
41
) (* StdioMCPClient , error ) {
41
42
cmd := exec .Command (command , args ... )
42
43
44
+ cmd .Env = env
45
+
43
46
stdin , err := cmd .StdinPipe ()
44
47
if err != nil {
45
48
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) {
34
34
}
35
35
defer os .Remove (mockServerPath )
36
36
37
- client , err := NewStdioMCPClient (mockServerPath )
37
+ client , err := NewStdioMCPClient (mockServerPath , [] string {} )
38
38
if err != nil {
39
39
t .Fatalf ("Failed to create client: %v" , err )
40
40
}
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ func main() {
16
16
// Using npx to run the filesystem server with /tmp as the only allowed directory
17
17
c , err := client .NewStdioMCPClient (
18
18
"go" ,
19
+ []string {}, // Empty ENV
19
20
"run" ,
20
21
"github.com/mark3labs/mcp-filesystem-server@latest" ,
21
22
"/tmp" ,
You can’t perform that action at this time.
0 commit comments