This is a pretty simple Fabric and NeoForge mod that highlights the mobs that prevent you from sleeping. To avoid it being exploitative, it'll only highlight the mobs if the message you get would be "Can't sleep now; monsters near by", and it only highlights for 3 seconds.
If installed on the client, it'll work in singleplayer and any server. If it's installed on the server, than everyone can see the highlights, even those without the mod.