The Church of St Mary on the Rock or St Mary's Collegiate Church, was a secular college of priests based on the seaward side of St Andrews Cathedral, St Andrews, just beyond the precinct walls. It is known by a variety of other names, such as St Mary of the Culdees, Kirkheugh and Church of St Mary of Kilrymont.
Although not founded as a collegiate church until the 1240s, Scotland's first, it represented a corporate continuation of the association of clergy known as the Culdees or Céli Dé, "vassals of God". The church lasted for several centuries, but did not long outlast the Scottish Reformation, and today little of the original structure has survived.
St Mary's Collegiate Church has its origins in Kilrymont monastery and its group of canons called "Culdees" or Céli Dé ("Vassals of God"). These priests served a side altar in the Cathedral throughout the twelfth-century and into the thirteenth-century. The Céli Dé were headed by an abbot. The only abbot whose name is recorded is Gille Críst, the "abbot of the Céli Dé" recorded 1172 x 1178 feuing out lands to the steward of the Bishop of St Andrews, though an unnamed abbot is recorded again in the 1180s.
Until the foundation of the Augustinian priory in 1140, the Céli Dé and the seven clerics known as the personae (parsons) are the only known clerics of the cathedral. The new Augustinian monastic canons were intended to become the main clergymen of the cathedral, serving its main altar, and Pope Eugenius III in 1147 confirmed the rights of the Augustinian canons and their prior to elect the Bishop of St Andrews.
It is likely on a number of grounds that Bishop Robert, an Augustinian himself from Nostell, intended that the Céli Dé would become Augustinians, bringing their property into the new Cathedral Priory. This is not what happened, and although another papal bull of 1147 ordered that upon the death of each Céle Dé an Augustinian should take his place, they were still there in 1199 when the priory recognised their holdings to be permanent.