Metal-organic frameworks (MOFs) with integrated light responsiveness are highly desirable for advanced applications including sensors, gas storage and separation, and controlled delivery. Here, we report a photoresponsive MOF that can undergo sufficient pore opening and closing under irradiation of UV light (λ = 356 nm) and visible light (sunlight), respectively. The efficient gating properties are achieved by the reversible photocycloaddition of the styrylpyrene moieties attached to the MOFs, which allows for multiple cycles of loading and release of small molecules. We further demonstrate the applicability of the photoresponsive MOFs by the loading and release of an amine catalyst, tetramethylethylenediamine (TEMED), used in hydrogelation. The light-gated process enables spatial and temporal control over the release of the catalyst, producing hydrogels with various sizes and shapes. This work shows the potential of our photoresponsive MOFs in advanced materials design.