Pathogens causing major infectious diseases primarily invade through mucosal tissues. Promptly killing these pathogens at the mucosal site and constructing mucosal vaccines in situ can prevent further infections and induce robust mucosal immune responses and memory to prevent reinfection. In this study, we utilized chemotherapy, sonodynamic therapy, and gas therapy to eliminate Streptococcus pneumoniae (S. pneumoniae) colonizing the nasal mucosa. Simultaneously, an in situ pneumococcal vaccine was constructed to elicit specific immune responses and memory. Poly-l-arginine (PArg)-modified ZIF-8 metal-organic frameworks (MOFs) loaded with the ultrasonic sensitizer protoporphyrin IX (PpIX) killed S. pneumoniae in the nasal cavity by multiple mechanisms in the presence of ultrasound. When stimulated by ultrasound, PpIX not only generates reactive oxygen species (ROS) for antimicrobial effect, but these ROS also catalyze the release of nitric oxide (NO) from PArg. NO exerts a motor-like effect that facilitates more efficient passage of nanoparticles through the mucus layer of the alveoli. The immunogenic bacterial debris formed a vaccine formulation by complexing with PArg, which adhered electrostatically to the mucosal surface, facilitating in situ vaccination and inducing mucosal immune responses and memory. This cascade-based combination therapy enabled rapid bacterial eradication and long-term immune prevention. It shortens the traditional vaccine development process, eliminates the spatial distance from pathogen invasion to vaccine development, significantly cuts costs, and addresses vaccine failure due to pathogen mutations. This approach offers a groundbreaking strategy for mucosal vaccine development and the prevention of major infectious diseases.