We study the supercurrent in quasi-one-dimensional Josephson junctions with a weak link involving magnetism, either via magnetic impurities or via ferromagnetism. In the case of weak links longer than {color{black}the magnetic pair-breaking} length, the Josephson effect is dominated by mesoscopic fluctuations. We establish the supercurrent-phase dependence $I(varphi)$ along with statistics of its sample-dependent properties in junctions with transparent contacts between leads and link. High transparency gives rise to the inverse proximity effect, while the direct proximity effect is suppressed by magnetism in the link. We find that all harmonics are present in $I(varphi)$. Each harmonic has its own sample-dependent amplitude and phase shift with no correlation between different harmonics. Depending on the type of magnetic weak link, the system can realize a $varphi_0$ or $varphi$ junction in the fluctuational regime. Full supercurrent statistics is obtained at arbitrary relation between temperature, superconducting gap, and the Thouless energy of the weak link.