Sage Vyasa is traditionally regarded as the compiler of the Mahabharata.
Vyasa is also called Krishna Dvaipayana and Vedavyasa. In the Mahabharata’s traditional frame story, he is not only the compiler but also an important character: he is the biological father of Dhritarashtra, Pandu, and Vidura through the custom of niyoga after the death of Vichitravirya. This makes him closely connected to both the Kaurava and Pandava lines.
The epic tradition says that Ganesha wrote down the Mahabharata as Vyasa recited it, although this is a later and widely popular framing story rather than a historical account of textual composition. Vyasa is also traditionally associated with arranging the Vedas and composing or transmitting many Puranas.
Modern scholarship treats the Mahabharata as a large text that developed over centuries through oral transmission, composition, and redaction. Thus, “Vyasa” is the traditional attribution, not a securely documented single historical author in the modern sense. Valmiki is instead the traditional author of the Sanskrit Ramayana.