You may want to take your cat and a stool sample to your vet for evaluation. It could be various causes for this condition, but a visit to the vet should be your first priority. It may be a simple dietary change is needed. Your cat may be allergic to the food its eating.
Mucus in the stool is often a sign of internal parasites. Typically this is confirmed with a fecal float or other fecal analysis, however cats are hard to obtain fresh stool from. You can take your cat to a vet and ask for dewormer instead.
Parasites, foreign body, constipation, megacolon, irritable bowel disease, malabsorption illnesses, auto-immune diseases. In short, bring your cat to your veterinarian because a wide array of illnesses can cause that symptom.
Cats can get mucus in their stool for a number of reasons. He could have gotten into rotten or spoiled food, have food allergies or a parasitic infection. I would suggest making an appointment with your vet as soon as possible.