• A minimum B field provides MHD stability, but a threat is the flux tube ellipticity, which is optimized in the study. • The magnetic shaping minimizes the flux tube ellipticity and neoclassical effects with MHD stability preserved. · • A controlled weak radial electric field restricts the guiding center motion to the immediate vicinity of a flux surface. · • Superconducting 3D coils have been computed which reproduce the derived magnetic field. · • In a minimum B vacuum field, a finite plasma beta may increase the mirror ratio to values exceeding 10. A mirror machine with a minimum B field for MHD stability is an option for a steady-state compact fusion neutron source design. A previous calculation of an idealized quadrupolar mirror field in Ref Ågren and Moiseenko (2017) is extended to a magnetic field which smoothly evolves to expander regions beyond the mirror throats. In a minimum B field, the projection of a flux surface on planes perpendicular to the magnetic axis evolves from a circular shape at the mid-plane to a highly elliptical shape as the mirror ratio is increased. Magnetic shaping is made to find the minimal ellipticity. The ellipticity depends sensitively on the gyro center magnetic drift in the confinement region, and the optimal result approaches a state where the magnetic drift is made as small as possible, which corresponds to the SFLM (Straight Field Line Mirror) field. In such a magnetic field, in combination with a weak radial electric field, each guiding center is forced to move close to its mean magnetic surface, thereby suppressing neoclassical transport effects. Biased end plates, placed at the end tank outside the confinement region, is a tool to control the radial electric field. The biased end plates could also assist to more precisely determine the positioning of drift surfaces in the confinement region. The reproduction of the optimized magnetic field with superconducting coils is a challenge due to the strong gradients in B . This is solved by a special arrangement with compact 3D superconducting coils, and the reproduction of the magnetic field is demonstrated with a mirror ratio of 4. Mirror ratios exceeding 10 may be reachable with finite β effects included. Analytical expressions in closed form are derived.