Magnetic γ-cyclodextrin polymer with compatible cavity promote the magnetic solid-phase extraction of microcystins in water samples.