I would paint the inside of the endcaps as well, unless you like the smell of MDF off-gassing. The legs should be sufficient, but I would suggest putting some felt on the bottom if they aren't going on carpet. One screw per leg should be fine, I have used furniture legs in the past, drilled and tapped the MDF, and screwed them in. ( doubled 3/4" baseplate ) The glue should be sufficient to hold them with a single screw.
Also, use 3 legs instead of 4, it will give you more stability, as it will always be flat, even if the floor is uneven. 4 will give it the ability to rock, if uneven.
"You take the blue pill - the story ends, you wake up in your bed and believe whatever you want to believe. You take the red pill - you stay in Wonderland and I show you how deep the rabbit-hole goes."