The transcription factor TFEB is a master regulator of lysosomal biogenesis and autophagy1. The phosphorylation of TFEB by the mechanistic target of rapamycin complex 1 (mTORC1)2-5 is unique in its mTORC1 substrate recruitment mechanism, which is strictly dependent on the amino acid-mediated activation of the RagC GTPase activating protein FLCN6,7. TFEB lacks the TOR signalling motif responsible for the recruitment of other mTORC1 substrates. We used cryogenic-electron microscopy to determine the structure of TFEB as presented to mTORC1 for phosphorylation, which we refer to as the 'megacomplex'. Two full Rag-Ragulator complexes present each molecule of TFEB to the mTOR active site. One Rag-Ragulator complex is bound to Raptor in the canonical mode seen previously in the absence of TFEB. A second Rag-Ragulator complex (non-canonical) docks onto the first through a RagC GDP-dependent contact with the second Ragulator complex. The non-canonical Rag dimer binds the first helix of TFEB with a RagCGDP-dependent aspartate clamp in the cleft between the Rag G domains. In cellulo mutation of the clamp drives TFEB constitutively into the nucleus while having no effect on mTORC1 localization. The remainder of the 108-amino acid TFEB docking domain winds around Raptor and then back to RagA. The double use of RagC GDP contacts in both Rag dimers explains the strong dependence of TFEB phosphorylation on FLCN and the RagC GDP state.