The dynamic modeling of multibody system is crucial in motion simulations, design, and control of mechanisms. This paper proposes a Hamiltonian formulation on manifolds for mechanism modeling which involves three key steps: (1) the local parameterization of regular configuration space; (2) the coordinate formulation of the Legendre transformation; and (3) the derivation of Hamiltonian equations. Geometric numerical integrators can be naturally deployed on the proposed formulation and achieve a long-time energy-preserving integration. Based on parametric symplectic integrators and the chart-splicing technique, a novel energy-preserving scheme is proposed. Simulations on two constrained mechanisms verify our claims.