Mechanical spectroscopy, i.e. cyclic deformations at varying frequencies, is used theoretically and numerically to measure dissipation in model glasses. From a normal mode analysis, we show that in the high-frequency THz regime where dissipation is harmonic, the quality factor (or loss angle) can be expressed analytically. This expression is validated through non-equilibrium molecular dynamics simulations applied to a model of amorphous silica (SiO$_2$). Dissipation is shown to arise from non-affine relaxations triggered by the applied strain through the excitation of vibrational eigenmodes that act as damped harmonic oscillators. We discuss an asymmetry vector field, which encodes the information about the structural origin of dissipation measured by mechanical spectroscopy. In the particular case of silica, we find that the motion of oxygen atoms, which induce a deformation of Si-O-Si bonds is the main contributor to harmonic energy dissipation.