Alan Chenkin, Handyman and fixer of things.
I would definitely sand with 220 grit sandpaper, and use a good primer. Why? Because MDF reacts to a finish like end grain wood, and will soak up the primer. Even if the varnish has good coverage on the wood, primer prevents any reaction between the varnish and the finish paint. once the primer is absorbed into the wood it should seal it, making the finish smooth enough to lightly sand again and apply a topcoat. (Some MDF may require 2 coats of a primer, like Kilz, or a white shellac). Sanding sealer will also work.
Once the MDF is sealed and sanded, lay down a light topcoat of glossy enamel with a good bristle brush (not a cheap brush). Here is a set of Purdy brushes.
If you have to roll a large area of shelving, the same rule applies. I would recommend a roller:
Work clean, the varnish may not come off completely, sanding it smooth and priming. Vacuum up the dust with a damp cloth or shop vacuum, and wear a mask!
You can get paints at a local hardware, paint, or “big-box” store. read all the instructions and drying times!
Best of luck with your project!