The mechanical energy comprises of both potential energy and kinetic energy. When the momentum is zero it means that the velocity is zero. Since the kinetic energy is dependent on velocity, the kinetic energy becomes zero. Hence there is no kinetic energy but the object may possess potential energy.Therefore an object can have mechanical energy even if its momentum is zero.