Semiconductor quantum dots in photonic integrated circuits enable scaling quantum-information processing to many single photons and quantum-optical gates. On-chip spectral filters are essential to achieve high-purity and coherent photon emission from quantum dots embedded in waveguides, without resorting to free-space optics. Such spectral filters should be tunable, to compensate for the inhomogeneous spectral distribution of the quantum dots transitions. Here, we report an on-chip filter monolithically integrated with quantum dots, that uses nanomechanical motion for tuning its resonant wavelength over 10 nm, enabling operation at cryogenic temperatures and avoiding cross-talk with the emitter. We demonstrate single-photon emission from a quantum dot under non-resonant excitation by employing only the on-chip filter. These results are key for the development of fully-integrated de-multiplexing, multi-path photon encoding schemes, and multi-emitter circuits.