The occurrence of bacterial keratitis (BK) presents a significant threat to ocular health, often leading to visual impairment. Currently, conventional antibiotic therapies tend to promote bacterial resistance and lack biocompatibility. Therefore, it is of great significance to develop an alternative product with safe and efficient antimicrobial properties. In this study, we developed a novel smart pH-responsive nano-antibacterial system (PM/Ag-Ce6@ZIF-8) based on a metal-organic framework (MOF), enabling specific bacterial targeting and photodynamic therapy. By utilizing bacteria-specific maltodextrin transport pathway, the intelligent nano-antibacterial modified with maltotriose can accurately discriminate between bacterial infection and normal tissue, specifically target the site of infection, and efficiently accumulate at the infection site to enhance safety and efficacy. Furthermore, the incorporation of silver nanoparticles enhances the effectiveness of MOF photodynamic therapy by effectively eradicating bacteria. The nano-antibacterial system exhibits potent inhibition of biofilm formation as well as antibacterial activity while demonstrating excellent in vitro and in vivo biocompatibility. In an animal model of bacterial keratitis, PM/Ag-Ce6@ZIF-8 exhibits superior antibacterial activity compared to Levofloxacin (LVFX) eye drops, significantly improving therapeutic outcomes for bacterial keratitis in mice. Hence, this intelligent nano-antibacterial platform holds promising potential for clinical applications in treating keratitis.