This paper proposes a new class of arbitrarily high-order conservative numerical schemes for the generalized Korteweg--de Vries (KdV) equation. This approach is based on the scalar auxiliary variable method. The equation is reformulated into an equivalent system by introducing a scalar auxiliary variable, and the energy is reformulated into a sum of two quadratic terms. Therefore, the quadratic preserving Runge--Kutta method will preserve all the three invariants (momentum, mass, and the reformulated energy) in the discrete time flow (assuming the spatial variable is continuous). With the Fourier pseudospectral spatial discretization, the scheme conserves the first and third invariant quantities (momentum and energy) exactly in the space-time full discrete sense. The discrete mass possesses the precision of the spectral accuracy. Our numerical experiment shows the great efficiency of this scheme in simulating the breathers for the modified KdV equation.