Modeling the optical response of monolayer molybenum disulfide in a cavity