By combining x-ray excited Auger electron diffraction experiments and multiple scattering calculations we reveal a layer-resolved shift for the Mg KL23L23 Auger transition in MgO ultrathin films (4-6 Å) on Ag(001). This resolution is exploited to demonstrate the possibility of controlling Mg atom incorporation at the MgO/Ag(001) interface by exposing the MgO films to a Mg flux. A substantial reduction of the MgO/Ag(001) work function is observed during the exposition phase and reflects both band-offset variations at the interface and band bending effects in the oxide film.