The compounds (MnFe)2PGe and (MnFe)2PSi are known to exhibit giant magnetocaloric effects due to a first-order magnetic transition (FOMT) near room temperature. These materials are usually prepared by a solid-phase reaction method, so that they are porous and brittle. In this study, we have fabricated (MnFe)2PGe and (MnFe)2PSi compounds by melting as-sintered compounds and examined structural and magnetic properties. It is found that for both compounds, the crystal structure is unchanged by melting. As-sintered samples undergo a sharp FOMT, while the samples after melting exhibit a broad magnetic transition. On the other hand, a sharp FOMT recovers by post-annealing. The origins of disappearance and recovery of the FOMT will be discussed.