How to calculate full (mechanical) energy on the hyperbolic orbit? For example, for a comet that travels on the hyperbolic orbit around the sun.
The total energy is the sum of the kinetic energy and the potential energy. It is constant, unless some interaction such as a collision between bodies occurs. 

The kinetic energy is easy to understand. For a mass $m$ and velocity $v$ it is given by

$$E_k = ½mv^2$$

The potential energy formula is (technically) given as

$$U = -μm/r$$

where $μ$ is the Standard gravitational parameter. (I say technically because it can be hard to grasp the concept of negative energy. See the linked articles).

In the case of a hyperbolic orbit the velocity and distance from the sun must be measured; one cannot be derived from the other as is the case with a known elliptical orbit.

See also 


Specific orbital energy
Gravitational energy
Gravitational constant