Media Foundation offers you H.264 Video Encoder MFT/DMO which handles compression.
Unlike DirectShow (which you don't want to use, but it offers you a comparable option of compressing into both MPEG-4 and MPEG-4 AVC using third party encoders), with Media Foundation you can use the transform on its own, without inserting it into fully featured graph (topology). Microsoft offers you only H.264 encoder, starting with Windows 7 only (good for you).
MFT use is described in MSDN article, and following it step by step you will get compressed H.264 (MPEG-4 AVC) NAL units, however they are not exactly a "file". A MPEG-4 file, is data formatted per MPEG-4 Part 14 specification, for which Microsoft provides you with MPEG-4 File Sink. The latter basically assumes you are using a topology rather an individual component.
So your choices are either to (a) implement a custom video source node to be inserted into topology, and build the encoding topology to route data through H.264 encoder into MPEG-4 file sink, or (b) instantiate a standalone video encoder and file sink separately, and use them outside of topology setting them up and passing data between them yourselves. Or, another option (c) is to use Media Foundation Sink Writer API with is about the same as the latter mentioned with a focus on ease of use rather than flexibility and control over details.
As per media foundaiton documentaiton, it should provide all facilities which direct show provides.
No, it should not and it does not. Microsoft provides MPEG-4 video encoder and multiplexer only through Media Foundation in Windows 7+, and doesn't make them available to DirectShow at all (unless through a wrapper over MF component), however MF is inferior to DS in many aspects: support in older OSes, feature set, extensibility and overhead - just to name a few.