Molecular metal compounds have demonstrated excellent catalytic activity and product selectivity in the H2 evolution reaction (HER) and the CO2 reduction reaction (CO2RR). The heterogenization of molecular catalysts is regarded as an effective approach to improve their applicability. In this work, the molecular catalytic units [Cp*Ir(Bpy)Cl]+ and [Ru(Bpy)(CO)2Cl2] are constructed in situ on the bipyridine sites of the covalent organic framework for photocatalytic HER and CO2RR, respectively. Inheriting the impressive performance of molecular catalysts, the functionalized TpBpy–M exhibits excellent catalytic activity and product selectivity. Under visible light irradiation, the H2 production rate of TpBpy–Ir is about 760 μmol g–1 h–1, which is 6.7 times higher than that of TpBpy without built-in catalytic sites. Also, the HCOOH production rate of TpBpy–Ru is 271 μmol g–1 h–1, with an impressive selectivity of 88%. Control experiments validated that this improvement is attributed to the incorporation of molecular catalytic units into the framework. Photoluminescence spectroscopy measurements and theoretical calculation consistently demonstrate that, under illumination, the photosensitizer [Ru(Bpy)3]Cl2 is excited and transfers electrons to the catalytic sites in TpBpy–M, which then catalyzes the reduction of H+ and CO2.