Solutions of recursive program schemes over a given signature were characterized by Bruno Courcelle as precisely the context-free (or algebraic) -trees. These are the finite and infinite -trees yielding, via labelling of paths, context-free languages. Our aim is to generalize this to finitary endofunctors H of general categories: we construct a monad CH "generated" by solutions of recursive program schemes of type H, and prove that this monad is ideal. In case of polynomial endofunctors of Set our construction precisely yields the monad of context-free -trees of Courcelle. Our result builds on a result by N. Ghani et al on solutions of algebraic systems.