  Starting from first principles, we show the formation and evolution of
superconducting gaps in MgB$_2$ at its ultrathin limit. Atomically thin MgB$_2$
is distinctly different from bulk MgB$_2$ in that surface states become
comparable in electronic density to the bulk-like $\sigma$- and $\pi$-bands.
Combining the ab initio electron-phonon coupling with the anisotropic
Eliashberg equations, we show that monolayer MgB$_2$ develops three distinct
superconducting gaps, on completely separate parts of the Fermi surface due to
the emergent surface contribution. These gaps hybridize nontrivially with every
extra monolayer added to the film, owing to the opening of additional coupling
channels. Furthermore, we reveal that the three-gap superconductivity in
monolayer MgB$_2$ is robust over the entire temperature range that stretches up
to a considerably high critical temperature of 20 K. The latter can be boosted
to $>$50 K under biaxial tensile strain of $\sim$ 4\%, which is an enhancement
stronger than in any other graphene-related superconductor known to date.
