Established a model of lipopolysaccharide (LPS)-induced mastitis in mice, pathological sections and myeloperoxidase were used to detect the degree of tissue damage, enzyme-linked immunosorbent assay (ELISA) was performed to detect the expression of pro-inflammatory cytokines, meanwhile fluorescence quantitative PCR experiments were performed to detect the mRNA expression of CD14/TLR4/NF-κB/MAPK signalling pathway, and the faeces of mice were collected for 16S measurement of flora. The results showed that Abrus cantoniensis total flavonoids (ATF) could significantly reduce the damage of LPS on mammary tissue in mice and inhibit the secretion of inflammatory factors such as TNF-α, IL-1β and IL-6. At the mRNA level, ATF inhibited the expression of CD14/TLR4/NF-κB/MAPK pathway and enhanced the expression of tight junction proteins in the blood-milk barrier. In the results of the intestinal flora assay, ATF were found to be able to regulate the relative abundance of the dominant flora from the phylum level to the genus level, restoring LPS-induced gut microbial dysbiosis. In summary, ATF attenuated the inflammatory response of LPS on mouse mammary gland by inhibiting the expression of CD14/TLR4/NF-κB/MAPK pathway, enhancing the expression of tight junction proteins and restoring LPS-induced gut microbial dysbiosis. This suggests that ATF could be a potential herbal remedy for mastitis.