Regarding a "source" of magic, I always thought the concept behind the Xanth series was clever. Basically, a supernatural entity has to ponder the new rules to a cosmological game. This takes thousands of years, and over that time, parts of his essence, become integral to his global environment.