The earliest reference I can find to the universal property of the presheaf construction is Remark 2.29 of Ulmer's Properties of Dense and Relative Adjoint Functors (1968). However, the proof is only lightly sketched, and in the introduction Ulmer states:
As an application of relative adjoints we will show in a subsequent paper that every category $\mathbf M'$ admits a free right complete category.
As far as I can tell, this paper never appeared. Note that Ulmer actually considers the universal property for arbitrary (possibly large) categories, by taking small presheaves rather than arbitrary presheaves.
In the enriched context, the universal property first appears as Theorem 2.11 of Lindner's Morita equivalences of enriched categories (1974), where the Lindner attributes the unenriched result to Ulmer.