In this paper a model predictive controller (MPC) for dc microgrids (MGs) with constant power loads (CPLs) is provided. In order to, a simple dc microgrid with nonlinear model to define an optimal tracking control problem based on minimization of a cost function with the finite-prediction horizon is utilized. This proposed control strategy guarantees the stability of the closed-loop system and can tracks the output voltage to reference voltage value. The performance of the MPC controller is investigated and effectiveness of it compared with State-Dependent Riccati Equation (SDRE) controller, in Matlab/Simpower.