The dense Galactic environment is a large reservoir of interstellar dust. Therefore, this region represents a perfect laboratory to study the properties of the cosmic dust grains. X-rays are the most direct way to detect the interaction of light with dust present in these dense environments. The interaction between the radiation and the interstellar matter imprints specific absorption features in the X-ray spectrum. We study them with the aim of defining the chemical composition, the crystallinity and structure of the dust grains which populate the inner regions of the Galaxy. We investigate 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 model the two spectral features using accurate extinction cross sections of silicates, that we have measured at the synchrotron facility Soleil, France. Near the Galactic centre magnesium and silicon show abundances similar to the solar ones and they are highly depleted from the gas phase ($delta_{rm{Mg}}>0.90$ and $delta_{rm{Si}}>0.96$). We find that amorphous olivine with a composition of $rm 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 underabundance of silicon $A_{rm Si}/A_{rm LMC} = 0.5pm0.2$.