This paper proposes a control framework for optimizing both ground reaction forces and new footholds in real-time through a model predictive control technique by parameterizing the foot position while constructing dynamics of a 3-dimensional single rigid body model. The method could substitute the conventional foothold controller based on linear inverted pendulum model such as capture point and be applied to balance dynamic locomotion of a robot on non-flat terrains. Furthermore, the controller is verified in various simulation environments, where foothold optimization is crucial