Efficient computation of the gravitational wave spectrum emitted by eccentric massive black hole binaries in stellar environments