server: Fix all scala-related warnings

Introduced dependency on the shapeless library for type safe casts.