MPLS (Multi-Protocol Label Switching) over WDM (Wavelength Division Multiplexing) networks are gaining significant attention due to the efficiency in resource utilization that can be achieved by jointly considering the two network layers. This paper addresses the design of MPLS over WDM networks, where some of the WDM nodes may not have packet switching capabilities. Given the WDM network topology and the offered traffic matrix, which includes the location of the edge LSRs (Label Switched Routers), we jointly determine the location of the core LSRs (i.e. the core WDM nodes that also need to include packet switching capabilities) and the lightpath routes (which are terminated on the LSRs) that minimize the total network cost. We consider constraints both at the optical and packet layers: an MPLS hop constraint on the maximum number of LSRs traversed by each LSP (Label Switched Path), which guarantees a given packet level QoS, and a WDM path constraint on the maximum length of lightpaths, which accommodates the optical transmission impairments. A novel Integer Linear Programming (ILP) formulation based on an hop-indexed approach, which we call the HOP model, is proposed. A two-phase heuristic, derived from a decomposition of the HOP model in two simpler ILP models that are solved sequentially, is also developed. The computational results show that the heuristic is efficient and produces good quality solutions, as assessed by the lower bounds computed from the HOP model. In some cases, the optimal solution is obtained with the branch-and-bound method.