It says in Shulchan Aruch Orach Chaim SIman 71 SIf 7 that it’s ossur to say Krias Shema in a Beis HaKavaros and if one does they are not yotzee. The M”B is don there in regards to if the person has to go back or not. He also mentions the point that it’s OSSUR to say col divre koddesh (kadddish, tehillim, etc, etc) within daled amos of the kever. Either the reason is because of La’ag L’Rash like most Rishonim or the reason of the Rambam since it’s a place of tumah. In anycase, how can one possibly be makil neged the Mishnah Brurah (really neged the Shulchan Aruch and Rishonim, Gemara, etc) in this regard! How can we see pictures of gedolim saying divrei kodesh next to a kever??? Isn’t the Mishnah Brurah the posek achron? What about La’ag L’Rosh with all this Rishonim and the idea of makom tumah from the Rambam!! HaShem Yishmor!!!!!!
The Mishna Brura in 581:27 brings the age old custom of davening at the kevarim of tzadikim. There is no problem of loeg larash or of tumah, as is clear from Shulchan Aruch Y:D 367:3, 344:17, that anything which is done for the kavod of the niftar is permitted.
See Gesher Hachaim 15:6, Shu”t Minchas Elazar 3:53, Tzitz Eliezer 10:10, 19:2.