Involved in the biosynthesis of caffeine (PubMed:18068204, PubMed:25133732). Specific for xanthosine and could not use xanthosine 5'-monophosphate (XMP) as substrate. Catalyzes the 7-N-methylation activity of xanthosine, but does not have 1-N- or 3-N-methylation activity (PubMed:18068204). S-adenosyl-L-methionine + xanthosine = 7-methylxanthosine + S-adenosyl-L-homocysteine Binds 1 Mg(2+) ion per subunit. Optimum pH is 7.0. Alkaloid biosynthesis. Expressed in stems, young leaves, floral buds, developing endosperm and immature fruits (grains) (PubMed:25249475). Detected in roots and old leaves, but not in mature fruits (PubMed:25249475). Saccharomyces cerevisiae (Yeast) expressing Coffea arabica (coffee) xanthosine methyltransferase (CaXMT1) and Camellia sinensis (tea) caffeine synthase (TCS1) accumulates caffeine. Tobacco plants (Nicotiana tabacum cv. Xanthi) expressing CaXMT1, CaMXMT1 and CaDXMT1 accumulate caffeine and become less appetant and toxic for caterpillars cutworms (Spodoptera litura). Caffeine also stimulates endogenous defense mechanisms against other pathogens (e.g. tobacco mosaic virus and Pseudomonas syringae) by triggering the expression of defense-related genes. Belongs to the methyltransferase superfamily. Type-7 methyltransferase family.