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 the magnetic pair-breaking length, the Josephson effect is dominated by mesoscopic fluctuations. We establish the supercurrent-phase dependence I(ϕ) 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(ϕ). 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 ϕ0 or ϕ 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. arXiv:1808.07095v2 [cond-mat.mes-hall]