Girl Genius - Agatha H. and the Voice of the Castle: Book 3
Agatha Heterodyne is the last heir to the Maddest of Mad Scientist families, and now she's returning to her ancestral home, the warped little town of Mechanicsburg, to claim her inheritance. Unfortunately, it turns out that she's not the only one with that idea in mind. When an impostor claiming to be the rightful heir appears, Agatha must convince the artificial intelligence that animates her family's castle that she is, in fact, the new Heterodyne. But as Agatha soon discovers, this will be no simple task, as the Castle itself is completely insane.