In this study, covalent organic frameworks (COFs) were grown in situ on magnetic nitrogen-doped graphene foam (MNGF), and the resulting composite of COFs-modified MNGF (MNC) was wrapped by molecularly imprinted polymers (MNC@MIPs) for specifically capturing SAs. A magnetic solid phase extraction (MSPE) method for SAs was established using MNC@MIPs with good magnetic responsiveness. The adsorption performance of MNC@MIPs was superior to that of non-molecularly imprinted polymers (MNC@NIPs), with shorter adsorption/desorption time and higher imprinting factors. A high-efficiency SAs analytical method was developed by fusing HPLC and MNC@MIPs-based MSPE. This approach provides excellent precision, a low detection limit, and wide linearity. By analyzing fish samples, the feasibility of the approach was confirmed, with SAs recoveries and relative standard deviations in spiked samples in the ranges of 77.2–112.7 % and 2.0–7.2 %, respectively. This study demonstrated the potential use of MNC@MIPs-based MSPE for efficient extraction and quantitation of trace hazards in food.