Metabolic labeling of glycans with clickable unnatural sugars has enabled glycan imaging and glycoproteomics in mixed cell populations. However, in vivo labeling and profiling of cell-type-specific glycans remains challenging. Here, we develop genetically encoded metabolic glycan labeling (GeMGL), a cell-type-specific strategy based on a bump-hole pair of an unnatural sugar and its matching engineered enzyme. N pentynylacetylglucosamine (GlcNAl) serves as a bumped analog of N acetylglucosamine (GlcNAc) that can be specifically incorporated into glycans of cells expressing an engineered mutant of UDP-GlcNAc pyrophosphorylase, AGX2F383G. GeMGL with the 1,3-di-O-propionylated GlcNAl (1,3-Pr2GlcNAl) and AGX2F383G pair is demonstrated in cell co-cultures, and used for specific labeling of glycans in mouse xenograft tumors. By generating a transgenic mouse line with AGX2F383G expressed under cardiomyocyte-specific promoter, we perform specific imaging of cardiomyocyte glycans in the heart and identified 582 cardiomyocyte O-GlcNAcylated proteins with no interference from other cardiac cell types. GeMGL will facilitate cell-type-specific glycoproteomics in various tissues and disease models.