We study transfer of a quantum state through XX spin chains with static imperfections. We combine the two standard approaches for state transfer based on (i) modulated couplings between neighboring spins throughout the spin chain and (ii) weak coupling of the outermost spins to an unmodulated spin chain. The combined approach allows us to design spin chains with modulated couplings and localized boundary states, permitting high-fidelity state transfer in the presence of random static imperfections of the couplings. The modulated couplings are explicitly obtained from an exact algorithm using the close relation between tridiagonal matrices and orthogonal polynomials [Linear Algebr. Appl. 21, 245 (1978)]. The implemented algorithm and a graphical user interface for constructing spin chains with boundary states (spinGUIn) are provided as Supplemental Material.