Ordered mesoporous MgO/carbon composites have been synthesized for the first time via a “one-pot” assembly strategy associated with a direct carbonization process by using phenolic resol as a carbon source, inorganic salt magnesium nitrate as a precursor and amphiphilic triblock copolymer Pluronic F127 as a template. The obtained mesoporous MgO/carbon composites exhibit uniform pore sizes (3.9–4.9 nm), high specific surface areas (510–780 m2 g−1), and high pore volumes (0.30– 0.53 cm3 g−1). In addition, a phase transformation from hexagonal (p6m) to body-centred cubic mesostructure (Imm) occurs as the magnesium content increases. To the best of our knowledge, this is the first time the synthesis of ordered mesoporous carbon nanocomposites with cubic symmetry has been reported. With this facile “one-pot” assembly approach, one can incorporate as high as 37 wt % of MgO in the composites. Especially, the increased magnesium content induces the enlarged particle sizes of the MgO nanocrystals, which can be tuned in the size range from more than 4 nm to around 13 nm, together with a high dispersion in the amorphous carbon framework. When the MgO particles have sizes larger than the mesopore wall thickness, they can extend from the carbon walls into mesopore channels, and hence bring a rougher pore surface and a lower degree of mesostructure regularity. For the application test, such mesoporous MgO/carbon nanocomposites show excellent solid base property as proved by CO2 adsorption.