It is not known when Mao Wenxi was born. His family was originally from Gaoyang (高陽, in modern Baoding, Hebei), although he was probably not born there, as his father Mao Guifan (毛龜範) served as the minister of husbandry for the Tang Dynasty imperial government. Mao Wenxi was said to have passed the imperial examinations in the Jinshi class at the young age of 13. At one point, he went to Chengdu and became an official under Wang Jian, the founding emperor of Former Shu, although historical accounts do not indicate whether that was before or after the founding of Former Shu.
Service under Wang Jian
Sometime during Wang Jian's reign as emperor of Former Shu, Mao Wenxi became the chief imperial scholar (翰林學士承旨, Hanlin Xueshi Chengzhi). (His becoming chief imperial scholar must be in or before 913, as that year, his absence at a feast held by Wang Jian's son and crown prince Wang Yuanying, along with Wang Jian's adoptive son Wang Zonghan (王宗翰) the Prince of Ji and the director of palace communications Pan Qiao was said to cause suspicions in Wang Yuanying that Mao and Pan had wrongly created dissension between him and Wang Zonghan. As a result, Wang Jian briefly ordered Pan's and Mao's exile, but after Wang Yuanying was subsequently killed in a conflict with Wang Jian's key advisor Tang Daoxi, it appeared that the exile order was not carried out. During the conflict, Wang Yuanying had briefly arrested Pan and Mao and almost tortured them to death.)
In 914, after Wang Jian executed an adoptive son, Wang Zongxun (王宗訓) the military governor of Wutai Circuit (武泰, headquartered in modern Chongqing) for disrespecting him, he made Pan the military governor of Wutai and made Mao the minister of rites (禮部尚書, Libu Shangshu), as well as acting Shumishi. In or around that year, Wang Jian contemplated a plan suggested to him for conquest of rival Later Liang's Jingnan Circuit (荊南, headquartered in modern Jingzhou, Hubei) — by destroying a dam on the Yangtze River and use the water to flood Jingnan's capital Jiangling Municipality. Mao urged against the plan, stating:
Gao Jichang [(the Later Liang military governor of Jingnan)] is the one who refuses to obey Your Imperial Majesty. What sins has his people committed? Your Imperial Majesty is trying to convince the realm under the heavens of your kindness. How would you have the heart to feed the people of a neighboring state to fish and turtles?
Wang Jian agreed and did not carry out the plan.
By 917, at which time Mao was carrying the additional honorary title of Situ (司徒, one of the Three Excellencies), he was facing political rivalries with the powerful eunuch Tang Wenyi (唐文扆) and Tang's ally, the chancellor Zhang Ge. At that time, Mao happened to be preparing to give a daughter in marriage to the son of another chancellor, Yu Chuansu. He held a feast with his family at the Office of the Director of Palace Communications, with music playing, without first receiving approval from Wang Jian. When Wang Jian heard the music and found it odd, Tang used the opportunity to make false accusations against Mao. As a result, Mao was demoted to the position of military advisor to the prefect of Mao Prefecture (茂州, in modern Ngawa Tibetan and Qiang Autonomous Prefecture, Sichuan), while his son Mao Xun (毛詢) was demoted to commoner rank and exiled to Wei Prefecture (維州, in modern Ngawa as well), and all of Mao Xun's assets were confiscated. Mao Wenxi's younger brother Mao Wenyan (毛文晏) was also demoted, while Yu Chuansu was removed from his chancellor position (but remained a mister). Mao Wenxi was replaced in his duty as acting director of palace communications by Yu's distant cousin Yu Ningji.
After Wang Jian's reign
At some point, Mao Wenxi must have been recalled to the Former Shu imperial government, for he was described to be among the officials who, along with Wang Jian's son and successor Wang Zongyan, surrendered to the invading army of Later Tang (which had earlier destroyed Later Liang) in 925. After Wang Yan was later executed by Later Tang's Emperor Zhuangzong, some Former Shu officials remained in the Later Tang imperial administration (under Emperor Zhuangzong's adoptive brother and successor Emperor Mingzong) while some returned to the Shu lands. Mao appeared to have done the latter, for he was described to have served under Meng Zhixiang, the Later Tang military governor of Xichuan Circuit (西川, headquartered in modern Chengdu), who would eventually the founding emperor of an independent state of Later Shu. In particular, Meng favored him, along with Ouyang Jiong and three others, for their poetic abilities. Mao wrote two volumes on the history of Former Shu, one volume on the art of tea, and a number of poems, and was said to have written a particularly famous poem about Mount Wu (巫山, in modern Chongqing). Traditional histories did not indicate when he died, including whether it was before or after Meng's establishment of Later Shu.