The 26-year-old played 30 times for the U’s this season and became Stags’ seventh signing of the January transfer window.
The Warrington-born winger progressed through the youth ranks at Lancashire club Burnley before turning professional with the Clarets in 2008.
He made 17 appearances for Burnley over a five-year period as he joined a number of clubs on loan during that same time.
MacDonald won eight caps for the Scotland under 19 side during the 2008/09 season and scored a fantastic tally of seven goals, including a brace against France when he was handed the captain’s armband. He also went on to win five caps for the under 21s, scoring one goal.
After spending the first half of the 2009/10 season on loan at Scottish side Falkirk, he returned to Turf Moor.
He didn’t feature under new manager Brian Laws in the following season, so again moved north of the border to join Inverness Caledonian Thistle where he scored his first professional goal in a 3-0 win over Motherwell.
The former Scotland under 21 international then had two successful loan spells with Plymouth Argyle where he scored six goals in 35 appearances across the 2011/12 and 2012/13 seasons.
Despite expressing a desire to move to the Pilgrims on a permanent basis, MacDonald was sent back out on loan to Burton Albion, with whom he signed permanently after spending the second half of the 2012/13 season with them.
The winger made over 60 appearances in an 18-month spell at the Pirelli Stadium, including 25 appearances in the Brewers' League Two winning-season, before joining Oxford United on a two-and-a-half year deal in February 2015.
MacDonald made 40 appearances and scored five goals as the U’s won promotion from League Two in the 2015/16 season.
The former Burnley man has made 30 appearances in all competitions so far this season as the U’s currently occupy 14th position in Sky Bet League One.