We present spectroscopic observations of the massive multiple system HD 167971, located in the open cluster NGC 6604. The brighter component of the triple system is the overcontact eclipsing binary MY Ser with an orbital period of 3.32 d. The radial velocities and the previously published UBV data obtained by Mayer et al. and the UBVRI light curves by Davidge & Forbes are analysed for the physical properties of the components. We determine the following absolute parameters: for the primary star Mp = 32.23±0.54M☉, Rp = 14.23±0.75 R☉; and for the secondary star Ms = 30.59±0.53M☉, Rs = 13.89±0.75 R☉. Photoelectric times of minimum light are analysed under the consideration of the light-time orbit. The centre-of-mass of the eclipsing binary is orbiting around the common centre-of-gravity of the triple system with a period of 21.2±0.7 yr and with a projected semi-major axis of 5.5±0.7 au. The mass function for the third star was calculated as 0.370±0.036M☉. The light contributions of the third star to the triple system in the UBV passbands were derived and the intrinsic magnitudes and colours were calculated individually for the three stars. The components of the eclipsing pair were classified as O7.5III and O9.5III. The intrinsic colour indices for the third star yield a spectral type of (O9.5-B0)III-I. This classification leads to constrain the inclination of the third-body orbit, which should be about 30°, and therefore its mass should be about 29M☉. MY Ser is one of the rare massive O-type triple system at a distance of 1.65±0.13 kpc, the same as for the NGC 6604 embedded in the Ser OB2 association.