The MAST (Mega Ampere Spherical Tokamak) real time plasma position controller is based on an optical linear camera placed on the mid plane of the vessel. This solution has the advantage of being a direct observation of the D emissions coming from the interaction between the boundary of the plasma and neutral gas, but, on the other hand, it restricts the control to the outer radius of the plasma only. A complete chain of tools has been set up to implement, test and simulate a new real time magnetic plasma shape controller based on the rtEFIT code. The complete working path consists of three elements: a linear static relationship between control parameters and current demands, a linear state space model needed to represent the plasma dynamic response in closed loop simulations, and the possibility to run simulations inside the Plasma Control System (PCS). The linear relationship has been calculated using the FIESTA code, which is developed using Matlab at CCFE. The linear state space model was generated using the CREATE-L code developed by the CREATE Consortium. It has already been successfully used to model JET, FTU and TCV tokamaks. Using this working path many simulations have been carried out allowing fine tuning of the control gains before the real experiment. The simulation testing includes the plasma shape control law as implemented in PCS itself, so intensive debugging has been possible prior to operation. Successful control using rtEFIT was established in the second dedicated experiment during the MAST 2011-12 campaign. This work is a stepping stone towards divertor control which is ultimately intended for application to the super-X divertor in the MAST Upgrade experiment.