File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
examples/filesystem_stdio_client Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 6
6
"encoding/json"
7
7
"fmt"
8
8
"io"
9
+ "os"
9
10
"os/exec"
10
11
"sync"
11
12
"sync/atomic"
@@ -41,7 +42,10 @@ func NewStdioMCPClient(
41
42
) (* StdioMCPClient , error ) {
42
43
cmd := exec .Command (command , args ... )
43
44
44
- cmd .Env = env
45
+ mergedEnv := os .Environ ()
46
+ mergedEnv = append (mergedEnv , env ... )
47
+
48
+ cmd .Env = mergedEnv
45
49
46
50
stdin , err := cmd .StdinPipe ()
47
51
if err != nil {
Original file line number Diff line number Diff line change @@ -12,13 +12,11 @@ import (
12
12
)
13
13
14
14
func main () {
15
- // Create a new client instance
16
- // Using npx to run the filesystem server with /tmp as the only allowed directory
17
15
c , err := client .NewStdioMCPClient (
18
- "go " ,
16
+ "npx " ,
19
17
[]string {}, // Empty ENV
20
- "run " ,
21
- "github.com/mark3labs/mcp -filesystem-server@latest " ,
18
+ "-y " ,
19
+ "@modelcontextprotocol/server -filesystem" ,
22
20
"/tmp" ,
23
21
)
24
22
if err != nil {
You can’t perform that action at this time.
0 commit comments