It has recently been observed that certain nonassociative algebras (called 'weakly nonassociative', WNA) determine, via a universal hierarchy of ordinary differential equations, solutions of the KP hierarchy with dependent variable in an associative subalgebra (the middle nucleus). We recall central results and consider a class of WNA algebras for which the hierarchy of ODEs reduces to a matrix Riccati hierarchy, which can be easily solved. The resulting solutions of a matrix KP hierarchy determine, under a 'rank one condition', solutions of the scalar KP hierarchy. We extend these results to the discrete KP hierarchy. Moreover, we build a bridge from the WNA framework to the Gelfand-Dickey formulation of the KP hierarchy.