Mosques on graves

Sheikh Saduq narrated in “Man La Yahdaruhu ‘l-Faqih” (1/178)

وسأله سماعة بن مهران ” عن زيارة القبور وبناء المساجد فيها، فقال: أما زيارة القبور فلا بأس بها، ولا ينبى عندها مساجد “.

And Sama`a b. Mihran asked him about visiting the graves and constructing masajid (pl. of masjid) in them.  So he said: As to visiting the graves then there is no harm with it, but one does not construct masajid on them.

Hadith authenticated by Muhammad Baqir al-Bahbudi, he included it in “Sahih Man La Yahdaruhu ‘l-Faqih”.

And at the same page Saduq wrote:

وقال النبي صلى الله عليه وآله: ” لا تتخذوا قبري قبلة ولا مسجدا فإن الله عز وجل لعن اليهود حين اتخذوا قبور أنبيائهم مساجد “.

Messenger (sallalahu alayhi wa ali) said: “Don’t take my grave as a qiblah or mosque (praying place), Allah Azwajal cursed jews because they took graves of their prophets as mosques (places of worship).