Developing efficient, available, and low-cost electrocatalysts for the hydrogen evolution reaction (HER) is important for clean energy systems. Non-noble transition metals are the most promising candidates for the replacement of conventional Pt group catalysts for the HER. Herein, we constructed two isostructural Ni/Co(II) MOFs based on nitrogen heterocyclic ligands, that is, 4-(4-(5-(pyridin-4-yl)-4H-1,2,4-triazol-3-yl)phenyl)pyridine (PPPT), pyromellitic dianhydride (PMDA), and nickel nitrate or cobalt nitrate. After high-temperature calcination in a nitrogen atmosphere, Ni-MOF/NC-T (NC is nitrogen-doped carbon) and Co-MOF/NC-T were obtained. Ni-MOF/NC-800 shows a good HER performance. The overpotential of Ni-MOF/NC-800 was 369 mV at 10 mA·cm−2 current density. The Tafel slope was 127.1 mV dec−1 for Ni-MOF/NC-800, Meanwhile, the HER performance of Co-MOF/NC-700 is slightly worse than that of Ni-MOF/NC-800. This work provides an idea for the simple synthesis of HER catalysts with better performance.