Some heterocycles, namely 2-amino-4H-pyran-3-carbonitriles, were synthesized in a three-component reaction from substituted benzaldehydes, malononitrile, and ethyl acetoacetate. These heterocycles have been converted subsequently into 4H-pyrano[2,3-d]pyrimidine ring by ring-closing reaction with acetic anhydride in the presence of the concentrated sulfuric acid as catalyst. The successive alkylation reaction of lactam NH bond on pyrimidine-4-one ring was carried out using propargylic bromide in dry acetone in the presence of anhydrous potassium carbonate. The click chemistry of 3-propargyl-4H-pyrano[2,3-d]pyrimidine compounds has been accomplished by reaction with tetra-O-acetyl-α-d-glucopyranosyl azide using the metal-organic framework Cu@MOF-5 as a catalyst in absolute ethanol. All the synthesized 1H-1,2,3-triazoles 8a–y were screened for their in vitro Mycobacterium tuberculosis protein tyrosine phosphatase B (MtbPtpB) inhibition. Kinetic studies of the most active compounds 8v, 8x, and 8y showed their competitive inhibition toward the MtbPtpB enzyme. The detailed structure-activity relationship (SAR) in vitro and in silico studies suggested that the interaction of Arg63 amino acids with anion type of para-hydroxyl group via a salt bridge of iminium cation was essential for strong inhibitory activity against MtbPtpB.