Magnesium hydroxide is a promising green flame retardant, but the amount of added material affects the mechanical properties of the matrix. Therefore, finding a proper ratio of the inorganic and organic flame retardants is still challenging. In this paper, a novel inorganic curing agent containing Mg, P, and N was synthesized and used in epoxy resin. Besides the curing function, it also exhibited excellent flame-retardant properties. When the addition amount was 20 wt%, the peak heat release and peak smoke generation were reduced by 75.7 and 64.1%, respectively, while its flexural strength and flexural modulus were increased by 79.9 and 61.22%, respectively. Scanning electron microscopy and Raman spectroscopy were used to study the carbon residue after combustion systematically, and the flame-retardant mechanism was discussed. The phosphorus-nitrogen inorganic flame-retardant curing agent reduced fire hazards and showed excellent comprehensive performance, having broad application prospects in the field of flame-retardant epoxy resins.