  Using wide spectral range in situ spectroscopic ellipsometry with systematic
ultra high vacuum annealing and in situ exposure to oxygen, we report the
complex dielectric function of MoS$_2$ isolating the environmental effects and
revealing the crucial role of unpassivated and passivated sulphur vacancies.
The spectral weights of the A ($1.92$ eV) and B ($2.02$ eV) exciton peaks in
the dielectric function reduce significantly upon annealing, accompanied by
spectral weight transfer in a broad energy range. Interestingly, the original
spectral weights are recovered upon controlled oxygen exposure. This tunability
of the excitonic effects is likely due to passivation and reemergence of the
gap states in the bandstructure during oxygen adsorption and desorption,
respectively, as indicated by ab initio density functional theory calculation
results. This work unravels and emphasizes the important role of adsorbed
oxygen in the optical spectra and many-body interactions of MoS$_2$.
