A controller is designed for the tokamak safety factor profile that takes real-time-varying operational and physics limits into account. This so-called model predictive controller (MPC) employs a prediction model in order to compute optimal control inputs that satisfy the given limits. The use of linearized models around a reference trajectory results in a quadratic programming problem that can easily be solved online. The performance of the controller is analysed in a set of ITER L-mode scenarios simulated with the non-linear plasma transport code RAPTOR. It is shown that the controller can reduce the tracking error due to an overestimation or underestimation of the modelled transport, while making a trade-off between residual error and amount of controller action. It is also shown that the controller can account for a sudden decrease in the available actuator power, while providing warnings ahead of time about expected violations of operational and physics limits. This controller can be extended and implemented in existing tokamaks in the near future.