diff --git a/internal/llm/agent/mcp-tools.go b/internal/llm/agent/mcp-tools.go index 3b35a0224645ef25e93504b64705f5166ca6f241..0d130d04f84daa5b407097d837ef6e05c8204422 100644 --- a/internal/llm/agent/mcp-tools.go +++ b/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)