What do I do if my baby's poop is smelly and has mucous in it?

Other symptoms? If the kid is otherwise thriving I would just monitor the situation. Common viruses (rotovirus) and some ingested materials (antibiotics) cause the smelliest poo I deal with. A kid with poor fat absorption can have stinky so bad that will clear a room. Write down the symptoms involved and take it with you when you see babies doc.
Check for blood. Infants may develop an inflammation in the terminal area of their GI tract -- proctocolitis. This inflammation could be triggered by proteins secreted in breast milk and found in infant formula. Usually, the infants stools are positive for blood (a simple test which could be done by your pediatrician). Gi infections and inflammation is another possibility that your doctor may have to consider.
Call the doctor. Smelly or mucousy poop may not mean anything at all. I had one parent that said their baby's poop smelled, but I smelled it and it was fine. The one thing that mucousy poop can indicate that can be concerning is a cow's milk protein allergy (either from mom ingesting it or cow's milk based formula). There is also the possibility of a stool bacterial infection but that's more rare.