Leakage of mucus can be due to presence of hemorrhoids (inner ones) that interfere with proper closing of anus, and because of increased mucus production related to hemorrhoids.
You may have develop rectal mucosa prolapse that can be manifested with mucus leakage.
This condition is described as fecal incontinence, although a stool leakage isn't present.
See a gastroenterologist!