fix: stdio mcp startups to match mark3labs upgrade (#742)

Tai Groot created

Change summary

internal/llm/agent/mcp-tools.go | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

Detailed changes

internal/llm/agent/mcp-tools.go 🔗

@@ -283,11 +283,14 @@ func doGetMCPTools(ctx context.Context, permissions permission.Service, cfg *con
 				slog.Error("error creating mcp client", "error", err, "name", name)
 				return
 			}
-			if err := c.Start(ctx); err != nil {
-				updateMCPState(name, MCPStateError, err, nil, 0)
-				slog.Error("error starting mcp client", "error", err, "name", name)
-				_ = c.Close()
-				return
+			// Only call Start() for non-stdio clients, as stdio clients auto-start
+			if m.Type != config.MCPStdio {
+				if err := c.Start(ctx); err != nil {
+					updateMCPState(name, MCPStateError, err, nil, 0)
+					slog.Error("error starting mcp client", "error", err, "name", name)
+					_ = c.Close()
+					return
+				}
 			}
 			if _, err := c.Initialize(ctx, mcpInitRequest); err != nil {
 				updateMCPState(name, MCPStateError, err, nil, 0)