  We develop the general many-body perturbation theory for a superconducting
quantum dot represented by a single-impurity Anderson model attached to
superconducting leads. We build our approach on a thermodynamically consistent
mean-field approximation with a two-particle self-consistency of the parquet
type. The two-particle self-consistency leading to a screening of the bare
interaction proves substantial for suppressing the spurious transitions of the
Hartree-Fock solution. We demonstrate that the magnetic field plays a
fundamental role in the extension of the perturbation theory beyond the weakly
correlated $0$-phase. It controls the critical behavior of the $0-\pi$ quantum
transition, lifts the degeneracy in the $\pi$-phase, where the limits to zero
temperature and zero magnetic field do not commute. The response to the
magnetic field is quite different in $0$- and $\pi$-phases. While the magnetic
susceptibility vanishes in the $0$-phase it becomes of the Curie type and
diverges in the $\pi$-phase at zero temperature.
