Involved in the biosynthesis of caffeine in cv. Puer (PubMed:32193380). Involved in the biosynthesis of theacrine in cv. Kucha, a caffeine-like xanthine alkaloid with diverse beneficial biological activities including anti-depressive, sedative, and hypnotic activities, improving learning and memory, increasing exercise activity, and preventing nonalcoholic fatty liver disease (PubMed:32193380). Catalyzes the conversion of 7-methylxanthine (7mX) to theobromine and of theobromine to caffeine (PubMed:32193380). Has 3-N- and 1-N-methylation activity (PubMed:32193380). 1,7-dimethylxanthine + S-adenosyl-L-methionine = caffeine + H(+) + S-adenosyl-L-homocysteine S-adenosyl-L-methionine + theobromine = caffeine + H(+) + S-adenosyl-L-homocysteine 7-methylxanthine + S-adenosyl-L-methionine = H(+) + S-adenosyl-L-homocysteine + theobromine Binds 1 Mg(2+) ion per subunit. kcat is 0.00012 sec(-1) with 1,3,7-trimethyluric acid as substrate. Alkaloid biosynthesis. Caffeine is catabolized to produce theacrine in Camellia sinensis var. assamica cv. Kucha, but not in cv. Puer. Belongs to the methyltransferase superfamily. Type-7 methyltransferase family.