We demonstrate the capability of coupled-cluster theory to compute the Coulomb sum rule for the $^4$He and $^{16}$O nuclei using interactions from chiral effective field theory. We perform several checks, including a few-body benchmark for $^4$He. We provide an analysis of the center-of-mass contaminations, which we are able to safely remove. We then compare with other theoretical results and experimental data available in the literature, obtaining a fair agreement. This is a first and necessary step towards initiating a program for computing neutrino-nucleus interactions from first principles and supporting the experimental long-baseline neutrino program with a state-of-the-art theory that can reach medium-mass nuclei.