With their abundant metal sites, ordered porous structure and great conductivity, conductive metal–organic frameworks display many excellent single-atom electrocatalytic activities, superior to those of conventional inorganic nanostructures. However, their electrochemical application is greatly limited by the fragility of coordinated frameworks. Here, we describe a metal-covalent organic framework (MCOF) strategy to construct a nitrate reduction (NRA) catalyst using M3·HATN as the subgroup. Assisted by a salt-template, M-HATN-COFs with abundant metal sites (M at% ≈ 12.5%) are achieved by a one-step coordination–condensation approach. More importantly, the M-HATN-COFs provide reasonable platforms for studying the metal-atom catalytic mechanism, surpassing that of current inorganic structures. The Mo-HATN-COFs exhibit outstanding electrocatalytic properties with a high ammonia yield rate (8.52 mg h−1 cm−2), FE (91.3%) and stability for the NRA reaction. As the first work on MCOFs for electrochemical NRA reactions, the M-HATN-COF strategy will innovate the design concept of next-generation catalysts and the catalytic mechanism of single-metal atoms.