The 28-year-old made 46 appearances for the Stags last season after signing from Oxford United midway through the previous campaign and has quickly established himself as a fans’ favourite.
Manager David Flitcroft said: “I’m absolutely buzzing that we have tied up Macca for another two years.
“He has a natural energy and enthusiasm for playing football and loves playing on the front foot.
“He is a player who always commits wholeheartedly and is the heartbeat on the training ground.
“Macca and his family have really settled in the area and even though the negotiations have been going on for a few weeks it was important that we secured him.
“When a player’s family are settled you get a player that is also settled and that was important.
“We have a very important relationship and he certainly knows what I think of him as a player and person.
“Macca will benefit from the new training ground and our intense training programme which I saw the benefits of towards the last four games of the season.”