MESA (Mainz Energy recovery Superconducting Accelerator) is an energy recovery linac (ERL) which is under construction at Johannes Gutenberg University in Mainz. It will be operated in external beam (EB) mode with 150 $mu$A electron beam at 155 MeV and energy recovery (ER) mode with 1 mA (first stage) and later 10 mA (second stage) electron beam at 105 MeV. An important factor which may limit performance of the machine is a beam breakup (BBU) instability which may occur due to excitation of higher-order modes (HOMs) in superconducting RF cavities. This effect occurs only when the injected beam current exceeds a threshold value. The aim of the present work is to develop a software for reliable determination of the threshold current in MESA, find main factors which may change its value and finally make a decision concerning capability of MESA operation at 10 mA and need for additional measures for suppressing BBU instability.