Note that the human exome size is ~30Mb. So you can take the number of somatic mutations in a given tumor sample an divide that by 30 to obtain the Mut/Mb value (normally > 4-6 is considered 'hyper mutation')
Or maybe you can try this tool
You can start by this paper : https://genomemedicine.biomedcentral.com/articles/10.1186/s13073-017-0424-2
In the method part :
TMB was defined as the number of somatic, coding, base substitution, and indel mutations per megabase of genome examined.
The TMB is defined as the total number of nonsynonymous mutations per coding area of a tumor genome. Initially, it was determined using whole exome sequencing, but due to the high costs and long turnaround time of this method, targeted panel sequencing is currently being explored to measure TMB.
samtools flagstat can be used for total base calculation.