Is Mahabharata a mere Ithihasa or whether the stories of Mahabharata have any hidden esoteric or metaphorical meanings?
It is part of Mahabharata, Bhishma Parva, Adhyaya 23-40. This is considered a very important philosophical scripture and extract of Upanishads. It is one of the three important scriptures (Prasthanatrayi) of Vedanta Darshana (other two being Upanishads and Brahma Sutras). Many Acharyas like Adi Shankaracharya, Ramanujacharya who expounded doctrines of Vedanta viz. Advaita, Vishishtadvaita, Dvaita etc., have written commentaries to establish or support their doctrines.
Well in Mahabharata we have the Sanat Sujatayia portion found in the Udyog Parva which is one of the important texts for the philosophy called Advaita Vedanta.
Quoting from Wikipedia:
The Sānatsujātiya refers to a portion of the Mahābhārata, a Hindu epic. It appears in the Udyoga Parva (book), and is composed of five chapters (Adyāya 41–46).2 One reason for the Sānatsujātiya's importance is that it was commented upon by Adi Shankara,2 the preeminent expositor of Advaita Vedanta, and one of the most important Hindu sages, philosophers, and mystics.
Buitenen wrote that "The Sānatsujātiya had a minor reputation as a philosophical classic.... The text certainly deserves more study than it has received" (p. 182).2 He also wrote that
The Sānatsujātiya should probably be best approached as a brief, late-upaniṣadic text that very early attracted to itself, by way of appendix, commentary, and continuation, other texts that were considered to be of the same inspiration.... Its core seems to be the triṣṭubh verses of the beginning, in which the problem of death is addressed. This is followed, in ślokas, by reflections on brahman and wisdom, on the twelve vices and twelve virtues, and on brahmacarya. It ends with a mystical hymn on the manifestations of the Supreme... with the refrain: "The yogins behold the sempiternal blessed Lord." (p. 1822)
Sanatsujata was the sage who dispelled the doubts that appeared in king Dhritarashtra's mind. This text along with YogaVashishta, Ashtavakra Gita etc are very important texts for the Advaita Vedanta school.
So, yes there are philosophical Vedantic teachings in Mahabharata.
The Vedantic and philosophical teaching is not hidden in Mahabharata. It is out there in the open. The sage Vyasa tells the reader the reason for his writing the Mahabharata. It is to teach the reader about the philosophy of the Sruti and the four Purusharthas (goals of life), dharma, artha, kama and moksha and how best to attain these goals. The most famous teaching is of course the Bhagavad Gita. In this process of teaching it gives the reader instruction about how to lead a useful life.
As the full-moon by its mild light expandeth the buds of the water-lily, so this Purana, by exposing the light of the Sruti hath expanded the human intellect.
(Mahabharata Adi Parva I)
This Bharata consists of a hundred thousand sacred slokas composed by the son of Satyavati, of immeasurable mental power. He that reads it to others, and they that hear it read, attain the world of Brahman and become equal to the very gods. This Bharata is equal unto the Vedas, is holy and excellent; is the worthiest of all to be listened to, and is a Purana worshipped by the Rishis. It contains much useful instruction on Artha and Kama. This sacred history maketh the heart desire for salvation. Learned persons by reciting this Veda of Krishna-Dwaipayana to those that are liberal, truthful, and believing, earn much wealth. Sins such as killing the embryo in the womb, are destroyed assuredly by this.
(Mahabharata Adi Parva LXII)
There are many philosophical teachings in the stories of Mahabharata, few of them are
Bhagavad Gita: Part of Bhishma Parva of Mahabharata. It has such philosophical teachings that most of scholars have provided commentaries on it.
Bhishma's teachings to Yudhishthira: Part of Santi Parva & Anusasana Parva of Mahabharata. It includes weighty treatises on topics such as kingcraft, metaphysics, cosmology, geography, mythology and discussions of the Sankya and Yoga philosophical schools.
Discussion between various sages and kings: can be found in pieces in entire Mahabharata
Anugita: Part of Aswamedha Parva of Mahabharata
Mahabharata is a huge text and there is a famous saying:
Anything which is there in the world is in Mahabharata, Mahabharata has everything which is there in the world.
Mahabharata: Adi Parva: Adivansavatarana Parva also claims something similar:
[Vaisampayana to son of Parikshit:] The sage Krishna-Dwaipayana regularly rising for three years, composed this wonderful history called Mahabharata. O bull amongst the Bharata monarchs, whatever is spoken [in Mahabharata] about virtue, wealth, pleasure, and salvation may be seen elsewhere; but whatever is not contained in this [Mahabharata] is not to be found anywhere.