A generic search is presented for the associated production of a Z boson or a photon with an additional unspecified massive particle X, pp $\to$ pp + Z/$\gamma$ + X, in proton-tagged events from proton-proton collisions at $\sqrt{s}$ = 13 TeV, recorded in 2017 with the CMS detector and the CMS-TOTEM precision proton spectrometer. The missing mass spectrum is analysed in the 600-1600 GeV range and a fit is performed to search for possible deviations from the background expectation. No significant excess in data with respect to the background predictions has been observed. Model-independent upper limits on the visible production cross section of pp $\to$ pp + Z/$\gamma$ + X are set.