New infrared absorption measurements of oxygen isotope ratios in CO gas from individual young stellar objects confirm that the solar system is anomalously high in its 18O/17O ratio compared with extra-solar oxygen in the Galaxy. We show that this difference in oxygen isotope ratios is best explained by 1 per cent enrichment of the proto-solar molecular cloud by ejecta from type II supernovae from a cluster having of order a few hundred stars that predated the Sun by at least 10 to 20 Myr. The likely source of exogenous oxygen was the explosion of one or more B stars during a process of propagating star formation.