The Gospel of Mary is found in the Berlin Gnostic Codex (or Papyrus Berolinensis 8502, as this ancient collection of Gnostic texts is labeled for archival reasons). This very important and well-preserved codex was apparently discovered in the late-nineteenth century somewhere near Akhmim in upper Egypt. It was purchased in 1896 by a German scholar, Dr. Carl Reinhardt, in Cairo and then taken to Berlin.
The book (or "codex", as these ancient books are called) was probably copied and bound in the late fourth or early fifth century. It contains Coptic translations of three very important early Christian Gnostic texts: the Gospel of Mary, the Apocryphon of John, and the Sophia of Jesus Christ. The texts themselves date to the second century and were originally authored in Greek. (In academic writing over the last century, this codex is variably and confusingly referenced by scholars as the "Berlin Gnostic Codex", the "Akhmim Codex", PB 8502, and BG 8502).
Despite the importance of the discovery of this ancient collection of Gnostic scriptures, several misfortunes including two world wars delayed its publication until 1955. By then the large Nag Hammadi collection of ancient Gnostic writings had also been recovered. It was found that copies of two of the texts in this codex -- the Apocryphon of John, and the Sophia of Jesus Christ -- had also been preserved in the Nag Hammadi collection. The texts from the Berlin Gnostic Codex were used to aid and augment translations of the Apocryphon of John and the Sophia of Jesus Christ as they now are published in Nag Hammadi Library.
But more importantly, the codex preserves the most complete surviving fragment of the Gospel of Mary (as the text is named in the manuscript, though it is clear this named Mary is the person we call Mary of Magdala). Two other small fragments of the Gospel of Mary from separate Greek editions were later unearthed in archaeological excavations at Oxyrhynchus in lower Egypt. (Fragments of the Gospel of Thomas were also found at this ancient site; see the Oxyrhynchus and Gospel of Thomas page for more information about Oxyrhynchus.) Finding three fragments of a text of this antiquity is extremely unusual, and it is thus evidenced that the Gospel of Mary was well distributed in early Christian times and existed in both an original Greek and a Coptic language translation.
Unfortunately the surviving manuscript of the Gospel of Mary is missing pages 1 to 6 and pages 11 to 14 -- pages that included sections of the text up to chapter 4, and portions of chapter 5 to 8. The extant text of the Gospel of Mary, as found in the Berlin Gnostic Codex, is presented below. The manuscript text begins on page 7, in the middle of a passage.