  We prove the existence of piecewise smooth MHD equilibria in
three-dimensional toroidal domains of $\mathbf{R}^3$ where the pressure is
constant on the boundary but not in the interior. The pressure is piecewise
constant and the plasma current exhibits an arbitrary number of current sheets.
The toroidal domains where these equilibria are shown to exist do not need to
be small perturbations of an axisymmetric domain, and in fact they can have any
knotted topology. The building blocks we use in our construction are analytic
toroidal domains satisfying a certain nondegeneracy condition, which roughly
states that there exists a force-free field that is ergodic on the surface of
the domain. The proof involves three main ingredients: a gluing construction of
piecewise smooth MHD equilibria, a Hamilton-Jacobi equation on the
two-dimensional torus that can be understood as a nonlinear deformation of the
cohomological equation (so the nondegeneracy assumption plays a major role in
the corresponding analysis), and a new KAM theorem tailored for the study of
divergence-free fields in three dimensions whose Poincar\'e map cannot be
computed explicitly.
