As the refrigeration technology consumes more than 15% of worldwide consumption of electricity, the development of technologies with improved efficiency remains an important challenge. In this context, magnetic refrigeration is an interesting solution and this paper proposes an original magnetic refrigerator. The aim -and also the originality -of this new device is to integrate the magnetocaloric regenerator in the air gap of a Permanent Magnet Synchronous Machine (PMSM). The conventional design of PMSM stator and rotor is presented and the results lead to the construction of a prototype that enables the validation of the proposed concept. Finally, thanks to the coupling of an optimization algorithm and a 2D FEM simulation, the rotor is optimized and the airgap flux density is greatly improved (from 0.9 T to 1.35 T).