He has frequently played the informal role of peacemaker, as Special Counsel Robert Mueller and his team have pursued interviews and documents from White House officials as part of their investigation into Russian interference during the 2016 presidential campaign.
Many Republicans on Capitol Hill, who see McGahn as a stable force and accessible official, were dismayed by Trump's announcement.
Senate Judiciary Committee Chairman Charles Grassley, (R), tweeted that he hopes "it's not true" that McGahn is leaving and urged Trump to not "let that happen."
McGahn's role in seeking to transform the judiciary - he helped select two Supreme Court nominees and dozens of picks for lower federal courts - made him a favourite of conservatives who view the endevour as the most successful project of Trump's presidency.
Trump's announcement of McGahn's departure came as a surprise, including to McGahn.
He was not aware that Trump planned to send the tweet before it posted, according to a person close to McGahn who was not authorised to speak publicly.
"He was surprised," this person said. While it had been an open secret inside the White House that McGahn planned to leave after Kavanaugh's confirmation process concludes, he had not discussed his plans directly with Trump, according to this person.
McGahn, who has told many friends that he has wearily endured countless political and legal battles, saw Trump's tweet as abrupt but typical of how the president acts - and it did not make him angry, according to two people familiar with his reaction. His reaction was, "Of course it happened this way," one person said.
McGahn's coming departure is widely seen within Trump's circle as the culmination of frustrations that have come with each new crisis that he has been forced to handle since Trump took office, from a scandal over then-national security adviser Michael Flynn's disclosure of contacts with Russian officials to the many times the President has lashed out about Mueller's probe.
Since April, former New York Mayor Rudy Giuliani has been serving as the President's lead outside lawyer focused on the Russia investigation and has been combative and public in his efforts as McGahn has stayed out of sight.
When Trump sought the firing of Mueller in June 2017, McGahn threatened to resign over the proposed move, according to two people familiar with the exchange. McGahn's warning to the President was first reported by the New York Times and denied by Trump, who called it "fake news."
In another showdown in March 2017, McGahn urged Attorney-General Jeff Sessions to not recuse himself from the Russia probe. And last April, Trump asked McGahn to persuade then-FBI Director James Comey to announce that Trump was not personally under investigation, but Comey rejected McGahn's entreaties.
In recent months, as he has worked on the Kavanaugh confirmation, McGahn's challenges have only mounted.
Sessions has been repeatedly belittled by the President and the Justice Department chief told the White House he might have to leave his job if Trump fired Deputy Attorney-General Rod Rosenstein, who oversees the Russia investigation, according to people familiar with the exchange.
Along with other current and former Trump aides, McGahn has met on multiple occasions with Mueller's team, for dozens of hours. Throughout that process, McGahn has had tense clashes with Trump's outside lawyers on Russia - as well as former White House lawyer Ty Cobb, who coordinated the White House's interaction with Mueller's team - questioning their cooperative strategy in the case.