MAD or Map-A-Droid is a system to collect data from the game. It uses real Android devices. MAD is able to scan for raids, quests, mon and their IVs.
MAD is the software running on your server. Devices connect to it and will then be controlled by the server.
The device needs run the game, must be rooted, pass the SafetyNet Check and SELinux must be permissive or moderate. To root your device, use Magisk.
RGC is an app developed by the MAD team to control the device in various ways. It handles the GPS spoofing, touch/text inputs, app starts/stops etc.
This app injects into the running Pokémon GO process and relays the Protos sent to Pokémon GO to the MAD server. A valid token is required to use it, you can purchase it on the MAD website.