The isotope shift parameters for the atomic transitions 1S0-1P1 and 1S0-3P1 of Mg are calculated by the relativistic multiconfiguration Dirac-Hartree-Fock (MCDHF) method, including the normal mass shift (NMS) coefficients, the specific mass shift (SMS) coefficients and the field shift (FS) factors. The detailed calculations of the isotope shifts for the three stable isotopes 24Mg, 25Mg and 26Mg are also carried out, in which the GRASP2K package is used together with another modified relativistic isotope shift computation code package RIS3. The two-parameter Fermi model is used here to describe the nuclear charge distribution in order to calculate the field shift by the first-order perturbation. A restricted double excitation mode is used in our calculations, one electron is excited from the two electrons in the 3s shell (3s2), another electron is excited from the eight electrons in the 2s or 2p shells (2s22p6), and the two electrons in the 1s shell (1s2) are not excited. The active configurations are expanded from the occupied orbitals to some active sets layer by layer, each correlation layer is numbered by the principal quantum numbers n (n= 3, 4, 5, …) and contains the corresponding orbitals s, p, d, …. The active configurations with the mixing coefficients in the added layer can be optimized by the MCDHF calculations. In this work, the atomic state functions are optimized simultaneously by the self-consistent field method and the relativistic configuration interaction approach in which the Breit interaction is taken into account perturbatively as well. The maximum principal quantum number n equals 10 and the largest orbital quantum number lmax is g. In our calculations, the NMS coefficients are -576.8 and -359.9 GHz·u, the SMS coefficients are 133.9 and -479.6 GHz·u, and the FS factors are -62.7 and -78.0 MHz·fm-2 for the 1S0-1P1 and 1S0-3P1 transitions of Mg, respectively. The difference between our isotope shift calculations and the previous experimental measurements is in a range from 6 MHz to 20 MHz with the relative error range from 0.6% to 1.3%, which shows that our results are in good agreement with experimental values. Our calculations are also coincident with other theoretical results. The isotope shift parameters provided here can be applied to the quick calculations of isotope shifts for the short-lived Mg isotopes, including 20-23Mg and 27-40Mg, and can be referred to for the corresponding isotope shift experiments. The methods used here canbe applied to calculating the isotope shifts and the atomic spectroscopic structures for other Mg-like ions with twelve extranuclear electrons.