Several papers deal with the problem of counting the number of idempotent endomorphisms of a structure S onto a substructure T. In this paper we consider the case when T is a projective lattice-ordered abelian group with a distinguished strong order unit, or equivalently, a projective MV-algebra. Suppose A is the image (=range) of an idempotent endomorphism of the free n-generator MV-algebra M([0,1]n) of McNaughton functions on [0,1]n. We prove that the number r(A) of idempotent endomorphisms of M([0,1]n) onto A is finite if, and only if, the maximal spectral space μA is homeomorphic to a (Kuratowski) closed domain M of [0,1]n, in the sense that M=cl(int(M)). Further, the closed domain condition is decidable and r(A) is computable, once an idempotent endomorphism of M([0,1]n) onto A is explicitly given. Thus every finitely generated projective MV-algebra B comes equipped with a new invariant ι(B)=sup{r(A)|A≅B, for A the image of an idempotent endomorphism of M([0,1]k)}, and k the smallest number of generators of B. We compute ι(B) for many projective MV-algebras B existing in the literature. Various problems concerning idempotent endomorphisms of free MV-algebras are shown to be decidable. Via the Γ functor, our results and computations automatically transfer to finitely generated projective abelian ℓ-groups with a distinguished strong unit.