A well-known ansatz (`trace method') for soliton solutions turns the
equations of the (noncommutative) KP hierarchy, and those of certain
extensions, into families of algebraic sum identities. We develop an algebraic
formalism, in particular involving a (mixable) shuffle product, to explore
their structure. More precisely, we show that the equations of the
noncommutative KP hierarchy and its extension (xncKP) in the case of a
Moyal-deformed product, as derived in previous work, correspond to identities
in this algebra. Furthermore, the Moyal product is replaced by a more general
associative product. This leads to a new even more general extension of the
noncommutative KP hierarchy. Relations with Rota-Baxter algebras are
established.