We present a moving-least-square immersed boundary method for solving viscous incompressible flow involving deformable and rigid boundaries on a uniform Cartesian grid. For rigid boundaries, noslip conditions at the rigid interfaces are enforced using the immersed-boundary direct-forcing method. We propose a reconstruction approach that utilizes moving least squares (MLS) method to reconstruct the velocity at the forcing points in the vicinity of the rigid boundaries. For deformable boundaries, MLS method is employed to construct the interpolation and distribution operators for the immersed boundary points in the vicinity of the rigid boundaries instead of using discrete delta functions. The MLS approach allows us to avoid distributing the Lagrangian forces into the solid domains as well as to avoid using the velocity of points inside the solid domains to compute the velocity of the deformable boundaries. The present numerical technique has been validated by several examples including a Poiseuille flow in a tube, deformations of elastic capsules in shear flow and dynamics of red-blood cell in microfluidic devices.