The magnetic connectivity between the Sun and the Earth is crucial to our understanding of the solar wind and space weather events. However, establishing this connectivity is challenging because of the lack of direct observations, which explains the need for reliable simulations. The method most often used to make such measurements over the last few years is the two-step ballistic method, but it has many free parameters that can affect the final result. Thus, we want to provide a connectivity method based on self-consistent magnetohydrodynamics (MHD) models. To this end, we combined the COCONUT coronal model with the EUHFORIA heliospheric model to compute the magnetic field lines from the Earth to the Sun. We then developed a way to quantify both the spatial and temporal uncertainty associated with this computation. To validate our method, we selected four cases already studied in the literature and associated with high-speed-stream events coming from unambiguous coronal holes visible on the disk. We always find a partial overlap with the assumed CH of origin. The extent of this overlap is 19<!PCT!> for event 1, 100<!PCT!> for event 2, 45<!PCT!> for event 3, and 100<!PCT!> for event 4. We looked at the polarity at Earth over the full Carrington rotation to better understand these results. We find that, on average, MHD simulations provide a very good polarity estimation, showing 69<!PCT!> agreement with real data for event 1, 36<!PCT!> for event 2, 68<!PCT!> for event 3, and 69<!PCT!> for event 4. For events 1 and 3, we can then explain the mixed results by the spatial and temporal uncertainty. An interesting result is that, for MHD models, minimum-activity cases appear to be more challenging because of the multiple recurrent crossings of the HCS, while maximum-activity cases appear easier because of the latitudinal extent of the HCS. A similar result was also found with Parker Solar Probe data in another study. We demonstrate that it is possible to use MHD models to compute magnetic connectivity and that this approach provides results of equal quality to those from the two-step ballistic method, with additional possibilities for improvements as the models integrate more critical physics.