  Observations of anomalies in the electron-positron angular correlations in
high-energy decays in $^4$He, $^8$Be, and $^{12}$C have been reported recently
by the ATOMKI collaboration. These could be explained by the creation and
subsequent decay of a new boson with a mass of ${\sim}17$ MeV. Theoretical
understanding of pair creation in the proton capture reactions used in these
experiments is important for the interpretation of the anomalies. We apply the
ab initio No-Core Shell Model with Continuum (NCSMC) to the proton capture on
$^7$Li. The NCSMC describes both bound and unbound states in light nuclei in a
unified way with chiral two- and three-nucleon interactions as the only input.
We investigate the structure of $^8$Be, the $p+^7$Li elastic scattering, the
$^7$Li($p,\gamma$)$^8$Be cross section and the internal pair creation
$^7$Li($p,e^+ e^-$)$^8$Be. We discuss the impact of a proper treatment of the
initial scattering state on the electron-positron angular correlation spectrum
and compare our results to available ATOMKI data sets. Finally, we calculate
$^7$Li($p,X$)$^8$Be cross sections for several proposed models of the
hypothetical X17 particle.
