Yes, capital punishment is moral- either in retribution (convicted murderers) or preemptive action (violent psychopaths; jihadis).
Retributively, murder is the ultimate violation of individual rights and MUST be answered with death, out of respect for the victim. Ie:
ALL OF THE REASONS WHICH MAKE MURDER AN ATROCITY, MAKE THE DEATH PENALTY MANDATORY (so long as their guilt is proven).
Preemptively, a will-be murderer (ESPECIALLY the insane) is no different from a man-eating lion, except for the fact that lions lack opposable thumbs.
So in those cases, WHEN there’s no reasonable doubt, the death penalty is absolutely moral and completely necessary.
However, i don’t think any other crime should carry such a penalty; not even rape.
With regards to rapists, if one wished to prevent a man-eating lion from ever mauling anyone ever again, one need only remove its claws. . .