Optical spectra of Fe-like Mo16+ and Mn-like Mo17+ ions were measured using the newly developed low-energy electron-beam ion trap at Fudan University. The observed emission spectra incorporated six lines from Mo16+ ions and five lines from Mo17+ ions. These eleven lines included ten lines that were measured for the first time. Spectra modeling was carried out based on the collisional-radiative (CR) modeling implemented in the flexible atomic code. Overall, a reasonable agreement of wavelengths and intensities was found between the experimental results and the CR modeling. It is demonstrated that ten of the eleven observed lines arised from the magnetic-dipole transitions within the ground configurations of Mo16+ and Mo17+ ions. Furthermore, the electron-density dependence of the line intensity ratios was investigated in the range of 109−1013 cm−3 using CR modeling. The theoretical ratios were consistent with the experimental line intensity ratios for two electron densities of 3.27×1011 cm−3 and 2.56×1011 cm−3. Moreover, several line intensity ratios were found to be sensitive to the electron density. The potential applications of these electron-density sensitive lines were demonstrated for plasma diagnostics.