The application of Magnesium alloys has drawn great attention in recent years. As the lightest structure metal on earth, the usage of Mg is attractive to the automotive, aerospace and electronics industries owing to its high weight-to strength ratio. Unfortunately, the poor corrosion resistance impedes the development of Mg alloys. To date, several methods have been proposed to improve the anti-corrosion ability, such as conventional anodizing, sol-gel coating, and micro arc oxidation (MAO). MAO is an innovative technique for generating surface oxide coatings on valve metals and alloys, which exhibits strong adhesion to the substrate, high thickness, hardness, corrosion and wear resistance, and provides an environmentally-friendly alternative to acid-based anodizing treatment. Despite all these advantages, the intrinsic structural imperfection of MAO coatings, including a loose structure featured by micro-pores and micro-cracks, facilitate quicker penetration of the corrosive ions into the base magnesium, and thus, increase the rate of corrosion. To overcome the problem of porous MAO film, composite coatings with self-healing ability that are capable to repair themselves when damage occurs have been utilized. In this study, the concept of self-healing is carried out by incorporating corrosion inhibitors, 2-aminobenzimidazole (2-ABI), loaded nanocontainers, halloysite nanotubes (HNT), to silicate-based electrolyte to obtain MAO coatings on AZ31 alloy in single step. The coatings are evaluated by SEM, EDX, and XRD. Corrosion performance is studied with EIS, PDP and salt spray test. The effects of various electrical parameters, including current density, frequency and working time, on the coating are also investigated. Experimental results indicate that the corrosion resistance of MAO films with the addition of 2-ABI loaded HNT is significantly improved, and thus confirms the feasibility of 2-ABI as corrosion inhibitor to Mg alloys.