Ultrafine dispersion of flame retardants in polymer matrices favors improving the performance of flame‐retardant polymers, but is still a challenge on most occasions. In the present research, an efficient method was employed to realize satisfactory dispersion of a nitrogen flame retardant, melamine cyanurate (MCA), in epoxy resin (EP) composites, and meanwhile integrated the synthesis of MCA with the preparation of the flame‐retardant composites. In the conventional technology, EP pre‐polymer glue with added MCA powder (synthesized in water, then dried and pulverized) is used to coat glass fabrics, which are compressed into laminated boards. Here, MCA was synthesized in a good solvent for EP, and then EP pre‐polymer was directly dissolved in the MCA suspension to obtain the in situ synthesized flame‐retardant glue. In this way, MCA could keep perfect dispersion whether in the glue or cured resin. Compared with the conventional addition system easily resulting in the aggregation of MCA particles, the in situ synthesized MCA flame‐retardant system exhibited much better stability of the coating glue, and markedly improved flame retardancy and mechanical properties. © 2016 Society of Chemical Industry