Two-dimensional (2D) superconductors are a class of materials with unique properties that can potentially exhibit novel superconductivity at a reduced dimensionality, as well as pave the way for miniaturizing superconducting devices at the atomic limit. However, such materials are highly sensitive to interaction with their substrates and the environment, and therefore it is necessary to find potential methods for chemically isolating them. We address this problem by examining the possibility of isolating the medium-temperature 2D MgB2-based superconductors. We examine two possible structures: the monolayer stoichiometric MgB2 and the B-caged Mg3B8 structure. By solving the anisotropic Eliashberg equations, we predict that the latter possesses K upon application of a small lateral (3% tensile) strain, with an electron–phonon coupling of 0.88. To investigate protecting the superconductivity of these two layers, we apply density functional theory calculations to examine their encapsulation in a graphene bilayer or a hexagonal boron nitride bilayer. We find that both have high potential as encapsulation systems to protect the superconductivity of the 2D MgB2-based superconductors, in particular B-caged (B–Mg) n systems.