In the clades of animals that diverged from the bony fish, a group of Mas-related G-protein-coupled receptors (MRGPRs) evolved that have an active role in itch and allergic signals1,2. As an MRGPR, MRGPRX2 is known to sense basic secretagogues (agents that promote secretion) and is involved in itch signals and eliciting pseudoallergic reactions3,4,5,6. MRGPRX2 has been targeted by drug development efforts to prevent the side effects induced by certain drugs or to treat allergic diseases. Here we report a set of cryo-electron microscopy structures of the MRGPRX2–Gi1 trimer in complex with polycationic compound 48/80 or with inflammatory peptides. The structures of the MRGPRX2–Gi1 complex exhibited shallow, solvent-exposed ligand-binding pockets. We identified key common structural features of MRGPRX2 and describe a consensus motif for peptidic allergens. Beneath the ligand-binding pocket, the unusual kink formation at transmembrane domain 6 (TM6) and the replacement of the general toggle switch from Trp6.48 to Gly6.48 (superscript annotations as per Ballesteros–Weinstein nomenclature) suggest a distinct activation process. We characterized the interfaces of MRGPRX2 and the Gi trimer, and mapped the residues associated with key single-nucleotide polymorphisms on both the ligand and G-protein interfaces of MRGPRX2. Collectively, our results provide a structural basis for the sensing of cationic allergens by MRGPRX2, potentially facilitating the rational design of therapies to prevent unwanted pseudoallergic reactions.