Metal−organic frameworks (MOFs) have emerged as a promising platform for protein delivery due to their high loading capacity and tunable functionality. However, spatiotemporally-controlled release of loaded proteins from MOFs-based nanocarriers remains an outstanding challenge. Herein, we report a MOFs-based protein delivery system that is capable of precisely controlling protein release with deep tissue penetrable near-infrared (NIR) light. The responsive system was constructed by encapsulating a protein of interest and upconversion nanoparticles (UCNPs) within zeolitic imidazolate framework-8 (ZIF-8) MOFs and further trapping a photoacid generator (PAG) in the pores of ZIF-8. Upon NIR light irradiation, UCNPs emit ultraviolet light that activates PAG to produce protons, which enables local pH acidification and thus degradation of ZIF-8 for spatiotemporally-controlled protein release. By employing insulin as a model protein, we demonstrate that the system allows for on-demand control over its therapeutic efficacy against diabetes with NIR light. This work illustrates a general strategy to regulate MOFs-based nanocarriers for controlled drug delivery.