on main help sign in
fix(mcp): append to os.Environ() (#1242)
ce72a48Carlos Alexandro Becker
internal/llm/agent/mcp-tools.go+2−1
@@ -10,6 +10,7 @@ import (
10 "log/slog"
10 "log/slog"
11 "maps"
11 "maps"
12 "net/http"
12 "net/http"
13+ "os"
13 "os/exec"
14 "os/exec"
14 "strings"
15 "strings"
15 "sync"
16 "sync"
@@ -415,7 +416,7 @@ func createMCPTransport(ctx context.Context, m config.MCPConfig, resolver config
415 return nil, fmt.Errorf("mcp stdio config requires a non-empty 'command' field")
416 return nil, fmt.Errorf("mcp stdio config requires a non-empty 'command' field")
416 }
417 }
417 cmd := exec.CommandContext(ctx, home.Long(command), m.Args...)
418 cmd := exec.CommandContext(ctx, home.Long(command), m.Args...)
418− cmd.Env = m.ResolvedEnv()
419+ cmd.Env = append(os.Environ(), m.ResolvedEnv()...)
419 return &mcp.CommandTransport{
420 return &mcp.CommandTransport{
420 Command: cmd,
421 Command: cmd,
421 }, nil
422 }, nil