Context. The dense Galactic environment is a large reservoir of interstellar dust. Therefore, this region represents a perfect laboratory to study the properties of cosmic dust grains. X-rays are the most direct way to detect the interaction of light with dust present in these dense environments. Aims. The interaction between the radiation and the interstellar matter imprints specific absorption features on the X-ray spectrum. We study them with the aim of defining the chemical composition, the crystallinity, and structure of the dust grains that populate the inner regions of the Galaxy. Methods. We investigated the magnesium and the silicon K-edges detected in the Chandra /HETG spectra of eight bright X-ray binaries, distributed in the neighbourhood of the Galactic centre. We modelled the two spectral features using accurate extinction cross-sections of silicates, which we measured at the synchrotron facility Soleil, France. Results. Near the Galactic centre, magnesium and silicon show abundances similar to the solar ones and they are highly depleted from the gas phase ( δMg> 0.90 and δSi> 0.96). We find that amorphous olivine with a composition of MgFeSiO 4 is the most representative compound along all lines of sight according to our fits. The contribution of Mg-rich silicates and quartz is low (less than 10%). On average we observe a percentage of crystalline dust equal to 11%. For the extragalactic source LMC X-1, we find a preference for forsterite, a magnesium-rich olivine. Along this line of sight we also observe an under-abundance of silicon ASi∕ ALMC = 0.5 ± 0.2.