Introducing porous material into optical cavities is a critical step toward the utilization of quantum-electrodynamical (QED) effects for advanced technologies, e.g. in the context of sensing. We demonstrate that crystalline, porous metal–organic frameworks (MOFs) are well suited for the fabrication of optical cavities. In going beyond functionalities offered by other materials, they allow for the reversible loading and release of guest species into and out of optical resonators. For an all-metal mirror-based Fabry–Perot cavity we yield strong coupling (∼21% Rabi splitting). This value is remarkably large, considering that the high porosity of the framework reduces the density of optically active moieties relative to the corresponding bulk structure by ∼60%. Such a strong response of a porous chromophoric scaffold could only be realized by employing silicon-phthalocyanine (SiPc) dyes designed to undergo strong J-aggregation when assembled into a MOF. Integration of the SiPc MOF as active component into the optical microcavity was realized by employing a layer-by-layer method. The new functionality opens up the possibility to reversibly and continuously tune QED devices and to use them as optical sensors.