X-Ray is only available for books for sale through Amazon, and all the configuration happens in the Amazon UI.
Leanpub authors who put their Leanpub-generated MOBI files up for sale on Amazon can follow the instructions in this article to enable X-Ray: