The invention provides a compact electric servo mechanism for linear displacement. The compact electric servo mechanism comprises a support saddle, a sliding bearing, a motor connector, a motor, a motor shell, a self-aligning roller bearing, a screw support shell, a ball screw, a ball screw nut, a screw roller, a guide element, an output shaft and a sliding bearing end cover. According to the compact electric servo mechanism, the integrity of the motor structure is ensured by a combined design of the screw and the motor; the motor does not need to be independently designed; the design difficulty of the motor is reduced; the motor is directly connected with the ball screw to achieve direct drive, and the screw nut moves forwards and backwards when the motor rotates, so that the screw nut does not need to adopt the structure of a long thread hole, and a guide groove is designed on the screw nut to be used along with the guide element. Therefore, the accurate servo control of linear displacement is achieved, and the linear output of the mechanism does not need the assistance of an external structure.