MCC is the tool. MPLAB Code Configurator.
Select a device, select peripheral(s), select configuration for those peripheral(s) and it outputs configuration code for you (in C syntax).