Mdf doesn't hold up very well if you screw into the edges. Try to use a dowel and glue instead. You can hold the parts together and drill with a tiny pilot through the legs into the edge of the MDF, then drill 5/6mm holes to a reasonable depth for the dowels using the pilot hole as a guide.
If you want to smooth the cut edges of MDF you can use 80/150/250/400 grit in 4 stages to get really nice paintable edges and then make a tiny radius along the edges.
Mdf doesn't hold up very well if you screw into the edges. Try to use a dowel and glue instead. You can hold the parts together and drill with a tiny pilot through the legs into the edge of the MDF, then drill 5/6mm holes to a reasonable depth for the dowels using the pilot hole as a guide.
If you want to smooth the cut edges of MDF you can use 80/150/250/400 grit in 4 stages to get really nice paintable edges and then make a tiny radius along the edges.