Spells aren't linked to an item, that's stupid. Anyone can own a book, it doesn't make you magical. Instead they are words learnt, similar to Skyrim Shouts. To cast a spell, simply select the spell and right click. This means you would have to remove specials, but they are basically spells on their own anyway. Perhaps make brick selection be magic. When you learn a new spell the server sends the client the data, which adds the spell to their brick hot bar/cart. Then when they use it, the client tells the server, the server checks its legit, then it fires.
When you cast a spell, it doesn't use mana or magicka, but it uses energy. Using any amount of magic drains energy which drains strength, speed, and blocking chance, but not very much. If you use even more energy, you can start to lose consciousness (black vignette), and eventually pass out (tumble), or worse; it could kill you.
Energy is regained simply by resting. Running will very slowly drain energy, but so slowly that running alone couldn't make you pass out or anything unless you ran for like an hour without stopping. When you stop, you slowly regain energy, but again very slowly. Sitting down would regain energy faster, but still, it wont let you run for a minute, then stop for a second. I can come up with numbers if you need them. The main way energy is restored is by food/water, which gives you temporary energy regeneration (somewhere around enough to run for another 10 minutes, depending on the food), or simply disconnecting, which will regain energy around three times as fast as sitting (how much energy gained would be calculated when the player rejoins, by getting the time he left and the current time, and mathing it out).
Magic is not very common, but its more of a target to reach around level 15-25. First of all, you must earn some sort of points (perhaps souls?) by killing plenty of decent leveled enemies. Perhaps animals/monsters don't have souls, or have weaker souls, but you must kill a crapton of enemies so you can use spells. This is simply so that people can't piggyback on others to get them to a place to learn a spell early on. It would not limit the player to learn spells very much, it would act as a system to stop them getting lots of spells at once, or early on. The amount of souls you have/earned isn't displayed, so you have to estimate, although you could be told in general how many you have.
Once you have enough souls, or whatever you call them, you can see a mage of some sort. You then do a quest for them, and they will reward you with teaching you a spell. Anyone can teach another player a spell they have learnt themselves, however when you do so, it makes the spell much less powerful for both of you, so it wouldn't be taken lightly. You can increase the spells power by either getting other players to share their spell with you (which would reduce their spell power, but increase yours a little), or doing certain quests that fit with the spell. Eg, a fire spell would require you to go to a volcano and maybe sacrifice something/someone. Something that isn't too bad so people prefer doing it rather than begging other players. Perhaps a boss fight, which multiple people can join in, and the loot/levels is split depending on how much damage was done to the boss per player.
As for what spells there are, probably 10 at most, as that's how many slots in your brick inventory/cart. Some suggestions for spells could be basic elemental ones: Earth, Fire, Water, Air. Defensive ones: (generic) Shield, Projectile Shield, Magic Shield. Then mental spells: Telekinesis, Telepathic, Scrying. Each spell has different effects (just like Demian's). Earth is traps, fire is generic offense (perhaps ignores armor?), water affects multiple enemies, and can push them around, and Air can suffocate enemies (or maybe something more interesting). Telekinesis allows players to activate things from a distance, allowing them to open doors from a distance, or activate levers or pick up items. Telepathic could make lower magic leveled enemies do your bidding. Simply turn on its friends would be enough. Scrying means seeing a far away place, but only places you've already seen. Perhaps make it raycast and create a camera where it hits. Could also be called television, but people would get confused XD Another suggestion that i nearly forgot about is healing. Simple enough, maybe if you aim at another player/bot it heals them, else it heals yourself.
Different spells are activated differently. For example telepathy would be continuous, and drain energy until turned off. If you fall unconscious while a continuous spell is running, it could kill you unless somebody feeds you food, or somehow else regains your consciousness. Other spells such as the shields and earth traps would be activated when in use, and would cost a little bit to set it up, and/or cost a tiny amount continuously. So if you activate shield, it would use a tiny amount of energy, then not cost anything (or very little) until someone attacks you, then it triggers, and starts to drain energy, until the enemy destroys the shield, or the spell is disabled. Other spells would just drain energy while using it, nice and simple, and would be a good first spell, as you can watch your energy, and learn how the system works.
In order for a spell to be considered successful, which is how you gain overall energy, it must either be triggered (activation spells), or simply be used at all. If your creating fire, it doesn't matter what it hits, you still are creating fire.
I have many other details in my head on how the system will work, and even how some of the code would work if you need that. If anyone finds this familiar, it is copied off the Inheritance Cycle, or the Eragon books.