The 26-year-old has also had spells with Hearts, Kilmarnock and Raith Rovers and has agreed a deal until the end of the season.
McHattie could make his debut for John Robertson's side in Saturday's home game against Queen of the South in the Ladbrokes Championship.