it is running really rough, almost stalling
Check the fuel pump and the fuel pump regulator. Those would be the first things I would check. Does it run really rough the faster you go?
If you have over 100k miles and havn't changed the spark plugs, will damage wires also. If you've had a check engine light on for months but ignored it could be mass air flow meter, ignition coils will go bad(gives a constant misfire) have checked by a shop before it damages expensive(Catalytic conv.,engine) parts
Also check your fuel filter. If it's still the original, it's probably almost completely blocked.
Looking for a Used M-Class in your area?
CarGurus has 5,979 nationwide M-Class listings starting at $2,296.
Search Mercedes-Benz M-Class Questions
Mercedes-Benz M-Class Experts