A mechanical approach to mean field spin models