Joe Schmidt's men ended 2012 on a winning note, with McGrath's 73rd-minute try - his first in this season's RaboDirect PRO12 - confirming the result at the RDS Arena.
Connacht had a strong wind at their backs in the opening half, but failed to register any score to reflect their dominance of territory.
It was left to out-half Madigan to clinically pick off a converted try closing in on the break, profiting from his own quickly taken penalty. He added a second-half penalty and the extras to McGrath's late score as Connacht suffered their second festive derby defeat in a week.
Leinster's forwards grew into the contest, carrying well at close quarters, but the Michael Swift-inspired Connacht were finding holes in the hosts' defence.
Poolman just miscued a grubber kick as he latched onto a cross-field delivery from Dan Parks and Leinster snatched a crucial turnover after a dangerous catch and run from Robbie Henshaw. Having gained ground in a scrum, Parks was presented with his first shot at the posts but pulled the 14th minute penalty to the left and wide.
Lacking any territorial hold, Leinster had to maintain their discipline in defence and Jordi Murphy and Ben Marshall put in some meaty challenges. Smart running from Andrew Conway and Fergus McFadden got Leinster into firing range near the half hour mark, and they showed the visitors exactly how potent they can be.
Andrew Goodman and Dominic Ryan both barged defenders as the men in blue gained further momentum and a quick tap penalty from Madigan saw him break out of a tackle to score from close range. The out-half added a tricky conversion from the right and boosted by the seven-pointer, Leinster continually got over the gain-line as half-time approached.
Madigan increased Leinster's lead with a well-struck penalty towards the end of the third quarter.
Having turned down a kickable penalty, Brett Wilkinson knocked on a pass from the ensuing lineout. Marshall then blocked an attempted kick from Parks and Leinster broke downfield. The hosts pulled Connacht through phases of strength-sapping defence in the closing stages and the pressure told when McGrath, supported by Toner, thundered over to the right of the posts.
- Sports & Recreation