A novel H2O2-responsive carbon monoxide nanogenerator was designed by effectively encapsulating a manganese carbonyl prodrug into porphyrinic covalent organic polymers for realizing the combined CO gas and photodynamic therapy under near infrared light irradiation.