ما جاء في إدام رسول الله صلى الله عليه وسلم
25  
What Rasoolullah Would Eat with Bread
Ash-Shama'il Al-Muhammadiyah 164
'Abdu’llah ibn al-Harith said:
"Together with Allah’s Messenger (Allah bless him and give him peace), we ate grilled meat in the mosque.”
حَدَّثَنَا قُتَيْبَةُ، قَالَ‏:‏ حَدَّثَنَا ابْنُ لَهِيعَةَ، عَنْ سُلَيْمَانَ بْنِ زِيَادٍ، عَنْ عَبْدِ اللهِ بْنِ الْحَارِثِ، قَالَ‏:‏ أَكَلْنَا مَعَ رَسُولِ اللهِ صلى الله عليه وسلم شِوَاءً فِي الْمَسْجِدِ‏.‏
Grade: Da'if isnad (Zubair Alizai)  إسناده ضعيف   (Zubair Alizai) حكم   :
Reference : Ash-Shama'il Al-Muhammadiyah 164
In-book reference : Book 25, Hadith 15
Explanation
comments
From this we find that it is permissible to eat and drink in the masjid, on condition that the masjid does not become untidy, otherwise it is makruh to do so. It is possible that this was at the time of i'tikaaf (in Ramadaan). It was the practice of Sayyidina Rasulullah Sallallahu 'Alayhi Wasallam to observe i'tikaaf every year, and at that time it is obvious that one eats in the masjid.
Hadith Text
Reference