Looking for a book about a boy who finds out he has magic in him. I must have read it some time between 2007-2010. Starts off with his home being destroyed by not so nice people, he escapes and meets a thief.
They then meet a “witch” who sees the boy has magic in him. They make it a mission to restore magic to the world. There is a huge battle and there are machines that were brought back with magic.