McGrath, sidelined from Test cricket for over a year because of injury, will arrive in Middlesex on July 16 after Australia's two-Test home series against Sri Lanka.
He will be available for four County championship matches and five Totesport League One-day games.
McGrath, 34, will look to form a lively new-ball partnership with South Africa's Nantie Hayward.
All-rounder Kluesener is required for the Proteas' tour of Sri Lanka.
Middlesex head coach and former England off-spinner John Emburey said: "We are delighted to have captured a world class bowler in Glenn, especially for such a vital period of the season."
McGrath, however, had a quiet return to international cricket last month taking just one wicket in three One-day games against strugglers Zimbabwe.
And he was effectively told by Australia's chairman of selectors, Trevor Hohns, that the Sri Lanka series could be his last if he fails to perform.
New South Wales quick McGrath is though still rated sixth in the world rankings and has an enviable Test record of 430 wickets from 95 matches at a miserly average of just over 21 apiece.
His name has become synonymous with accuracy and McGrath, who previously had a spell in County cricket with Worcestershire in 2000, is sure to boost a Middlesex side that have lost four of their last five matches.
On Friday, the County announced that Owais Shah would no longer captain the side while Andrew Strauss was on England duty with Ireland's Ed Joyce the new man in charge.