In the text of the Mahabharata, the telling of the whole story is attributed to Vyasa, who is considered the scribe of both this text and the four Vedas within the Hindu faith. But historically the authorship of the epic is significantly foggier.
Likely dating back to the Indian Iron Age, the tale of the Mahabharata likely predates the advent of written Sanskrit, and as such the tale was initially passed down orally. Based on other references to the segments of the Mahabharata, the story may well date back to somewhere between 900 and 800 BC. With that said, the version of the story we know today began to be committed to writing around 400 BC.
With potentially hundreds of years of development, the story that we know today would hardly be a carbon copy of the one that was initially being told. As it stands, the Mahabharata is a composite of various versions told by various people, warts and all. Conflicting accounts of the afterlife, attitudes on animal sacrifice, and specifics of dharma all speak to the perspectives of a multiplicity of authors.
There are even regional variants on the tale. Mahabharata scholar V.S. Sukthankar mentions slightly differing versions in South versus North India. In his estimation, the Mahabharata as we know it today could have taken shape as late as 200 BC, when Krsna was added as a central character to its narrative.