Change .4\linewidth to your liking. The use of \null\hfill ... \hfill\null is to centre the mdframes within the text block without having to wrap it inside a group. \centering with a group would also work.

@Werner: as far as I tested, your solution does not manage correctly a mdframe spanning over multiple pages. I guess that the initial reason to use a mdframe would be to support multi-pages. I did not find any solution yet.
–
user25100Jan 28 '13 at 0:47