Mucosal-associated invariant T (MAIT) cells are activated in a TCR-dependent manner by antigens derived from the riboflavin synthesis pathway, including 5-(2-oxopropylideneamino)-6-d-ribitylaminouracil (5-OP-RU), bound to MHC-related protein-1 (MR1). However, MAIT cell activation in vivo has not been studied in detail. Here, we have found and characterized additional molecular signals required for optimal activation and expansion of MAIT cells after pulmonary Legionella or Salmonella infection in mice. We show that either bone marrow-derived APCs or non-bone marrow-derived cells can activate MAIT cells in vivo, depending on the pathogen. Optimal MAIT cell activation in vivo requires signaling through the inducible T cell costimulator (ICOS), which is highly expressed on MAIT cells. Subsequent expansion and maintenance of MAIT-17/1-type responses are dependent on IL-23. Vaccination with IL-23 plus 5-OP-RU augments MAIT cell-mediated control of pulmonary Legionella infection. These findings reveal cellular and molecular targets for manipulating MAIT cell function under physiological conditions.