Why are mobs spawning on my roof?

To eliminate a few possibilities:

  • If it's spiders, spiders will climb onto your house roof and wait for you to exit to jump on you. It's annoying, and the reason why I always leave my house running and screaming.
  • The coal(!) you have placed near your door would allow a mob to jump up onto it, then onto your roof. Mobs can jump surprisingly high.
  • Your roof might not be illuminated enough. Light it up with more torches than you think are necessary. Roofs are notorious for being hard to light.