Reprogramming receptors to artificially respond to light has strong potential for molecular studies and interrogation of biological functions. Here we design a light-controlled ionotropic glutamate receptor by genetically encoding a photo-reactive unnatural amino acid (UAA). The photo-cross-linker p-azido-L-phenylalanine (AzF) was encoded in NMDA receptors (NMDARs), a class of glutamate-gated ion channels that play key roles in neuronal development and plasticity. AzF incorporation in the obligatory GluN1 subunit at the GluN1/GluN2B N-terminal domain (NTD) upper lobe dimer interface leads to an irreversible allosteric inhibition of channel activity upon UV illumination. In contrast, when pairing the UAA-containing GluN1 subunit with the GluN2A subunit, light-dependent inactivation is completely absent. By combining electrophysiological and biochemical analyses, we identify subunit-specific structural determinants at GluN1/GluN2 NTD dimer interfaces that critically dictate UV-controlled inactivation. Our work reveals that the two major NMDAR subtypes differ in their ectodomain subunit interactions, in particular their electrostatic contacts, resulting in GluN1 NTD coupling more tightly to GluN2B, than GluN2A, NTD. It also paves the way for engineering light-sensitive ligand-gated ion channels with subtype-specificity through the genetic code expansion.